Merge lp:~mterry/indicator-datetime/fix-show-clock into lp:indicator-datetime/0.3

Proposed by Michael Terry
Status: Merged
Merged at revision: 61
Proposed branch: lp:~mterry/indicator-datetime/fix-show-clock
Merge into: lp:indicator-datetime/0.3
Diff against target: 143 lines (+49/-2)
4 files modified
data/Makefile.am (+7/-1)
data/indicator-datetime-preferences.desktop.in (+14/-0)
po/POTFILES.in (+1/-0)
src/indicator-datetime.c (+27/-1)
To merge this branch: bzr merge lp:~mterry/indicator-datetime/fix-show-clock
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+52890@code.launchpad.net

Description of the change

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.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/Makefile.am'
2--- data/Makefile.am 2011-02-17 19:30:43 +0000
3+++ data/Makefile.am 2011-03-10 17:28:53 +0000
4@@ -12,9 +12,15 @@
5
6 pkgdata_DATA = datetime-dialog.ui
7
8+@INTLTOOL_DESKTOP_RULE@
9+desktopdir = $(datadir)/applications
10+desktop_DATA = indicator-datetime-preferences.desktop
11+
12 EXTRA_DIST = \
13 $(gsettings_SCHEMAS) \
14 datetime-dialog.ui \
15+ indicator-datetime-preferences.desktop \
16+ indicator-datetime-preferences.desktop.in \
17 indicator-datetime.service.in
18
19-CLEANFILES = indicator-datetime.service
20+CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service
21
22=== added file 'data/indicator-datetime-preferences.desktop.in'
23--- data/indicator-datetime-preferences.desktop.in 1970-01-01 00:00:00 +0000
24+++ data/indicator-datetime-preferences.desktop.in 2011-03-10 17:28:53 +0000
25@@ -0,0 +1,14 @@
26+[Desktop Entry]
27+Version=1.0
28+
29+_Name=Time & Date
30+_Comment=Change your clock and date settings
31+
32+Icon=time-admin
33+TryExec=indicator-datetime-preferences
34+Exec=indicator-datetime-preferences
35+
36+StartupNotify=true
37+
38+Type=Application
39+Categories=GNOME;GTK;Utility;DesktopSettings;Settings;
40
41=== modified file 'po/POTFILES.in'
42--- po/POTFILES.in 2011-02-23 18:28:53 +0000
43+++ po/POTFILES.in 2011-03-10 17:28:53 +0000
44@@ -5,3 +5,4 @@
45 src/utils.c
46 src/settings-shared.h
47 [type: gettext/glade]data/datetime-dialog.ui
48+data/indicator-datetime-preferences.desktop.in
49
50=== modified file 'src/indicator-datetime.c'
51--- src/indicator-datetime.c 2011-03-04 12:03:49 +0000
52+++ src/indicator-datetime.c 2011-03-10 17:28:53 +0000
53@@ -76,6 +76,7 @@
54
55 gchar * time_string;
56
57+ gboolean show_clock;
58 gint time_mode;
59 gboolean show_seconds;
60 gboolean show_date;
61@@ -105,6 +106,7 @@
62 found and looked up. */
63 enum {
64 PROP_0,
65+ PROP_SHOW_CLOCK,
66 PROP_TIME_FORMAT,
67 PROP_SHOW_SECONDS,
68 PROP_SHOW_DAY,
69@@ -123,6 +125,7 @@
70 GtkWidget * right;
71 };
72
73+#define PROP_SHOW_CLOCK_S "show-clock"
74 #define PROP_TIME_FORMAT_S "time-format"
75 #define PROP_SHOW_SECONDS_S "show-seconds"
76 #define PROP_SHOW_DAY_S "show-day"
77@@ -196,6 +199,13 @@
78 io_class->get_accessible_desc = get_accessible_desc;
79
80 g_object_class_install_property (object_class,
81+ PROP_SHOW_CLOCK,
82+ g_param_spec_boolean(PROP_SHOW_CLOCK_S,
83+ "Whether to show the clock in the menu bar.",
84+ "Shows indicator-datetime in the shell's menu bar.",
85+ TRUE, /* default */
86+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
87+ g_object_class_install_property (object_class,
88 PROP_TIME_FORMAT,
89 g_param_spec_int(PROP_TIME_FORMAT_S,
90 "A choice of which format should be used on the panel",
91@@ -254,6 +264,7 @@
92 self->priv->idle_measure = 0;
93 self->priv->max_width = 0;
94
95+ self->priv->show_clock = TRUE;
96 self->priv->time_mode = SETTINGS_TIME_LOCALE;
97 self->priv->show_seconds = FALSE;
98 self->priv->show_date = FALSE;
99@@ -270,6 +281,11 @@
100
101 self->priv->settings = g_settings_new(SETTINGS_INTERFACE);
102 if (self->priv->settings != NULL) {
103+ g_settings_bind(self->priv->settings,
104+ SETTINGS_SHOW_CLOCK_S,
105+ self,
106+ PROP_SHOW_CLOCK_S,
107+ G_SETTINGS_BIND_DEFAULT);
108 g_settings_bind_with_mapping(self->priv->settings,
109 SETTINGS_TIME_FORMAT_S,
110 self,
111@@ -478,6 +494,13 @@
112 gboolean update = FALSE;
113
114 switch(prop_id) {
115+ case PROP_SHOW_CLOCK: {
116+ if (g_value_get_boolean(value) != self->priv->show_clock) {
117+ self->priv->show_clock = g_value_get_boolean(value);
118+ gtk_widget_set_visible (GTK_WIDGET (self->priv->label), self->priv->show_clock);
119+ }
120+ break;
121+ }
122 case PROP_TIME_FORMAT: {
123 gint newval = g_value_get_int(value);
124 if (newval != self->priv->time_mode) {
125@@ -581,6 +604,9 @@
126 IndicatorDatetime * self = INDICATOR_DATETIME(object);
127
128 switch(prop_id) {
129+ case PROP_SHOW_CLOCK:
130+ g_value_set_boolean(value, self->priv->show_clock);
131+ break;
132 case PROP_TIME_FORMAT:
133 g_value_set_int(value, self->priv->time_mode);
134 break;
135@@ -1330,7 +1356,7 @@
136 g_signal_connect(G_OBJECT(self->priv->label), "screen-changed", G_CALLBACK(update_text_gravity), self);
137 guess_label_size(self);
138 update_label(self, NULL);
139- gtk_widget_show(GTK_WIDGET(self->priv->label));
140+ gtk_widget_set_visible(GTK_WIDGET (self->priv->label), self->priv->show_clock);
141 }
142
143 if (self->priv->timer == 0) {

Subscribers

People subscribed via source and target branches