diff options
author | Ted Gould <ted@gould.cx> | 2011-03-10 22:50:30 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-10 22:50:30 -0600 |
commit | f4135733d15691d2da278ce7c9a7795c070eb9a8 (patch) | |
tree | f4f698540c7678fa1a426bfb496ef05825f630ce | |
parent | 154354ac577a3b05f2b3acc70a0772683f855e08 (diff) | |
parent | 721aa2d317bf0fa15579e1775812e02dcf7043fb (diff) | |
download | ayatana-indicator-datetime-f4135733d15691d2da278ce7c9a7795c070eb9a8.tar.gz ayatana-indicator-datetime-f4135733d15691d2da278ce7c9a7795c070eb9a8.tar.bz2 ayatana-indicator-datetime-f4135733d15691d2da278ce7c9a7795c070eb9a8.zip |
Making it so the clock can be hidden entirely. Adding a desktop file to get to the preferences when it is hidden.
-rw-r--r-- | data/Makefile.am | 8 | ||||
-rw-r--r-- | data/indicator-datetime-preferences.desktop.in | 14 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/indicator-datetime.c | 28 |
4 files changed, 49 insertions, 2 deletions
diff --git a/data/Makefile.am b/data/Makefile.am index 669db77..b9a9532 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -12,9 +12,15 @@ dbus_services_DATA = indicator-datetime.service 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 diff --git a/data/indicator-datetime-preferences.desktop.in b/data/indicator-datetime-preferences.desktop.in new file mode 100644 index 0000000..f37765b --- /dev/null +++ b/data/indicator-datetime-preferences.desktop.in @@ -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; diff --git a/po/POTFILES.in b/po/POTFILES.in index 84ce021..d22e5f9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -5,3 +5,4 @@ src/datetime-prefs-locations.c src/utils.c src/settings-shared.h [type: gettext/glade]data/datetime-dialog.ui +data/indicator-datetime-preferences.desktop.in diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 0bbc56d..46ed0d9 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -76,6 +76,7 @@ struct _IndicatorDatetimePrivate { gchar * time_string; + gboolean show_clock; gint time_mode; gboolean show_seconds; gboolean show_date; @@ -106,6 +107,7 @@ struct _IndicatorDatetimePrivate { found and looked up. */ enum { PROP_0, + PROP_SHOW_CLOCK, PROP_TIME_FORMAT, PROP_SHOW_SECONDS, PROP_SHOW_DAY, @@ -125,6 +127,7 @@ struct _indicator_item_t { 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" @@ -199,6 +202,13 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass) 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", @@ -264,6 +274,7 @@ indicator_datetime_init (IndicatorDatetime *self) 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; @@ -280,6 +291,11 @@ indicator_datetime_init (IndicatorDatetime *self) 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, @@ -493,6 +509,13 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec 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) { @@ -603,6 +626,9 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe 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; @@ -1357,7 +1383,7 @@ get_label (IndicatorObject * io) 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) { |