ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03398
[Merge] lp:~mterry/indicator-datetime/fix-show-clock into lp:indicator-datetime
Michael Terry has proposed merging lp:~mterry/indicator-datetime/fix-show-clock into lp:indicator-datetime.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
For more details, see:
https://code.launchpad.net/~mterry/indicator-datetime/fix-show-clock/+merge/52890
This makes the show-clock preference work. As part of this, once you disable the clock, you can't get back to the preferences. So I added a .desktop file.
There's a bug in the panel, where when you hide the clock, there's an unclickable gap in the panel. This occurred even when I tried a different method of hiding the clock (emitting ENTRY_REMOVED). So I'll file a bug about that.
Also... Now we have two Time & Date preference apps. We should hide the gnome-system-tools one or do something there.
--
https://code.launchpad.net/~mterry/indicator-datetime/fix-show-clock/+merge/52890
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2011-02-17 19:30:43 +0000
+++ data/Makefile.am 2011-03-10 17:28:53 +0000
@@ -12,9 +12,15 @@
pkgdata_DATA = datetime-dialog.ui
+@INTLTOOL_DESKTOP_RULE@
+desktopdir = $(datadir)/applications
+desktop_DATA = indicator-datetime-preferences.desktop
+
EXTRA_DIST = \
$(gsettings_SCHEMAS) \
datetime-dialog.ui \
+ indicator-datetime-preferences.desktop \
+ indicator-datetime-preferences.desktop.in \
indicator-datetime.service.in
-CLEANFILES = indicator-datetime.service
+CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service
=== added file 'data/indicator-datetime-preferences.desktop.in'
--- data/indicator-datetime-preferences.desktop.in 1970-01-01 00:00:00 +0000
+++ data/indicator-datetime-preferences.desktop.in 2011-03-10 17:28:53 +0000
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Version=1.0
+
+_Name=Time & Date
+_Comment=Change your clock and date settings
+
+Icon=time-admin
+TryExec=indicator-datetime-preferences
+Exec=indicator-datetime-preferences
+
+StartupNotify=true
+
+Type=Application
+Categories=GNOME;GTK;Utility;DesktopSettings;Settings;
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2011-02-23 18:28:53 +0000
+++ po/POTFILES.in 2011-03-10 17:28:53 +0000
@@ -5,3 +5,4 @@
src/utils.c
src/settings-shared.h
[type: gettext/glade]data/datetime-dialog.ui
+data/indicator-datetime-preferences.desktop.in
=== modified file 'src/indicator-datetime.c'
--- src/indicator-datetime.c 2011-03-04 12:03:49 +0000
+++ src/indicator-datetime.c 2011-03-10 17:28:53 +0000
@@ -76,6 +76,7 @@
gchar * time_string;
+ gboolean show_clock;
gint time_mode;
gboolean show_seconds;
gboolean show_date;
@@ -105,6 +106,7 @@
found and looked up. */
enum {
PROP_0,
+ PROP_SHOW_CLOCK,
PROP_TIME_FORMAT,
PROP_SHOW_SECONDS,
PROP_SHOW_DAY,
@@ -123,6 +125,7 @@
GtkWidget * right;
};
+#define PROP_SHOW_CLOCK_S "show-clock"
#define PROP_TIME_FORMAT_S "time-format"
#define PROP_SHOW_SECONDS_S "show-seconds"
#define PROP_SHOW_DAY_S "show-day"
@@ -196,6 +199,13 @@
io_class->get_accessible_desc = get_accessible_desc;
g_object_class_install_property (object_class,
+ PROP_SHOW_CLOCK,
+ g_param_spec_boolean(PROP_SHOW_CLOCK_S,
+ "Whether to show the clock in the menu bar.",
+ "Shows indicator-datetime in the shell's menu bar.",
+ TRUE, /* default */
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
PROP_TIME_FORMAT,
g_param_spec_int(PROP_TIME_FORMAT_S,
"A choice of which format should be used on the panel",
@@ -254,6 +264,7 @@
self->priv->idle_measure = 0;
self->priv->max_width = 0;
+ self->priv->show_clock = TRUE;
self->priv->time_mode = SETTINGS_TIME_LOCALE;
self->priv->show_seconds = FALSE;
self->priv->show_date = FALSE;
@@ -270,6 +281,11 @@
self->priv->settings = g_settings_new(SETTINGS_INTERFACE);
if (self->priv->settings != NULL) {
+ g_settings_bind(self->priv->settings,
+ SETTINGS_SHOW_CLOCK_S,
+ self,
+ PROP_SHOW_CLOCK_S,
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind_with_mapping(self->priv->settings,
SETTINGS_TIME_FORMAT_S,
self,
@@ -478,6 +494,13 @@
gboolean update = FALSE;
switch(prop_id) {
+ case PROP_SHOW_CLOCK: {
+ if (g_value_get_boolean(value) != self->priv->show_clock) {
+ self->priv->show_clock = g_value_get_boolean(value);
+ gtk_widget_set_visible (GTK_WIDGET (self->priv->label), self->priv->show_clock);
+ }
+ break;
+ }
case PROP_TIME_FORMAT: {
gint newval = g_value_get_int(value);
if (newval != self->priv->time_mode) {
@@ -581,6 +604,9 @@
IndicatorDatetime * self = INDICATOR_DATETIME(object);
switch(prop_id) {
+ case PROP_SHOW_CLOCK:
+ g_value_set_boolean(value, self->priv->show_clock);
+ break;
case PROP_TIME_FORMAT:
g_value_set_int(value, self->priv->time_mode);
break;
@@ -1330,7 +1356,7 @@
g_signal_connect(G_OBJECT(self->priv->label), "screen-changed", G_CALLBACK(update_text_gravity), self);
guess_label_size(self);
update_label(self, NULL);
- gtk_widget_show(GTK_WIDGET(self->priv->label));
+ gtk_widget_set_visible(GTK_WIDGET (self->priv->label), self->priv->show_clock);
}
if (self->priv->timer == 0) {
Follow ups