Merge lp:~indicator-applet-developers/indicator-datetime/ubuntu into lp:~ubuntu-desktop/indicator-datetime/ubuntu

Proposed by Ted Gould
Status: Merged
Merged at revision: 45
Proposed branch: lp:~indicator-applet-developers/indicator-datetime/ubuntu
Merge into: lp:~ubuntu-desktop/indicator-datetime/ubuntu
Diff against target: 514 lines (+207/-94)
8 files modified
ChangeLog (+40/-0)
configure (+10/-10)
configure.ac (+2/-2)
debian/changelog (+12/-0)
src/datetime-prefs-locations.c (+69/-1)
src/datetime-service.c (+43/-25)
src/dbus-shared.h (+0/-4)
src/indicator-datetime.c (+31/-52)
To merge this branch: bzr merge lp:~indicator-applet-developers/indicator-datetime/ubuntu
Reviewer Review Type Date Requested Status
Ken VanDine Pending
Review via email: mp+57764@code.launchpad.net
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 'ChangeLog'
2--- ChangeLog 2011-04-07 18:22:08 +0000
3+++ ChangeLog 2011-04-14 20:03:31 +0000
4@@ -1,5 +1,45 @@
5 # Generated by Makefile. Do not edit.
6
7+2011-04-14 Ted Gould <ted@gould.cx>
8+
9+ 0.2.3
10+
11+2011-04-14 Ted Gould <ted@gould.cx>
12+
13+ Check for resume in the service and update the label as well
14+
15+2011-04-13 Michael Terry <mike@mterry.name>
16+
17+ watch for resume in the service, not the indicator; update today's menu label after resume
18+
19+2011-04-12 Ted Gould <ted@gould.cx>
20+
21+ If an item is removed, make sure we choose one.
22+
23+2011-04-11 karl-qdh <karl@qdh.org.uk>
24+
25+ Make selection change on remove item
26+
27+2011-04-12 Ted Gould <ted@gould.cx>
28+
29+ Work around libindicator not sending a close event by looking for it directly in the indicator
30+
31+2011-04-11 karl-qdh <karl@qdh.org.uk>
32+
33+ Fixed niggles
34+
35+2011-04-11 karl-qdh <karl@qdh.org.uk>
36+
37+ syntax fail
38+
39+2011-04-11 karl-qdh <karl@qdh.org.uk>
40+
41+ Improve debug messages and only react when hiding
42+
43+2011-04-11 karl-qdh <karl@qdh.org.uk>
44+
45+ Calendar reset, should work for mike
46+
47 2011-04-07 Ted Gould <ted@gould.cx>
48
49 0.2.2
50
51=== modified file 'configure'
52--- configure 2011-04-07 18:22:08 +0000
53+++ configure 2011-04-14 20:03:31 +0000
54@@ -1,6 +1,6 @@
55 #! /bin/sh
56 # Guess values for system-dependent variables and create Makefiles.
57-# Generated by GNU Autoconf 2.67 for indicator-datetime 0.2.2.
58+# Generated by GNU Autoconf 2.67 for indicator-datetime 0.2.3.
59 #
60 # Report bugs to <ted@canonical.com>.
61 #
62@@ -703,8 +703,8 @@
63 # Identity of this package.
64 PACKAGE_NAME='indicator-datetime'
65 PACKAGE_TARNAME='indicator-datetime'
66-PACKAGE_VERSION='0.2.2'
67-PACKAGE_STRING='indicator-datetime 0.2.2'
68+PACKAGE_VERSION='0.2.3'
69+PACKAGE_STRING='indicator-datetime 0.2.3'
70 PACKAGE_BUGREPORT='ted@canonical.com'
71 PACKAGE_URL=''
72
73@@ -1502,7 +1502,7 @@
74 # Omit some internal or obsolete options to make the list less imposing.
75 # This message is too long to be a string in the A/UX 3.1 sh.
76 cat <<_ACEOF
77-\`configure' configures indicator-datetime 0.2.2 to adapt to many kinds of systems.
78+\`configure' configures indicator-datetime 0.2.3 to adapt to many kinds of systems.
79
80 Usage: $0 [OPTION]... [VAR=VALUE]...
81
82@@ -1573,7 +1573,7 @@
83
84 if test -n "$ac_init_help"; then
85 case $ac_init_help in
86- short | recursive ) echo "Configuration of indicator-datetime 0.2.2:";;
87+ short | recursive ) echo "Configuration of indicator-datetime 0.2.3:";;
88 esac
89 cat <<\_ACEOF
90
91@@ -1701,7 +1701,7 @@
92 test -n "$ac_init_help" && exit $ac_status
93 if $ac_init_version; then
94 cat <<\_ACEOF
95-indicator-datetime configure 0.2.2
96+indicator-datetime configure 0.2.3
97 generated by GNU Autoconf 2.67
98
99 Copyright (C) 2010 Free Software Foundation, Inc.
100@@ -2072,7 +2072,7 @@
101 This file contains any messages produced by compilers while
102 running configure, to aid debugging if configure makes a mistake.
103
104-It was created by indicator-datetime $as_me 0.2.2, which was
105+It was created by indicator-datetime $as_me 0.2.3, which was
106 generated by GNU Autoconf 2.67. Invocation command line was
107
108 $ $0 $@
109@@ -2893,7 +2893,7 @@
110
111 # Define the identity of the package.
112 PACKAGE=indicator-datetime
113- VERSION=0.2.2
114+ VERSION=0.2.3
115
116
117 cat >>confdefs.h <<_ACEOF
118@@ -14964,7 +14964,7 @@
119 # report actual input values of CONFIG_FILES etc. instead of their
120 # values after options handling.
121 ac_log="
122-This file was extended by indicator-datetime $as_me 0.2.2, which was
123+This file was extended by indicator-datetime $as_me 0.2.3, which was
124 generated by GNU Autoconf 2.67. Invocation command line was
125
126 CONFIG_FILES = $CONFIG_FILES
127@@ -15030,7 +15030,7 @@
128 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
129 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
130 ac_cs_version="\\
131-indicator-datetime config.status 0.2.2
132+indicator-datetime config.status 0.2.3
133 configured by $0, generated by GNU Autoconf 2.67,
134 with options \\"\$ac_cs_config\\"
135
136
137=== modified file 'configure.ac'
138--- configure.ac 2011-04-07 18:22:08 +0000
139+++ configure.ac 2011-04-14 20:03:31 +0000
140@@ -1,11 +1,11 @@
141
142-AC_INIT(indicator-datetime, 0.2.2, ted@canonical.com)
143+AC_INIT(indicator-datetime, 0.2.3, ted@canonical.com)
144 AC_COPYRIGHT([Copyright 2009,2010 Canonical])
145
146 AC_PREREQ(2.53)
147
148 AM_CONFIG_HEADER(config.h)
149-AM_INIT_AUTOMAKE(indicator-datetime, 0.2.2)
150+AM_INIT_AUTOMAKE(indicator-datetime, 0.2.3)
151
152 AM_MAINTAINER_MODE
153
154
155=== modified file 'debian/changelog'
156--- debian/changelog 2011-04-07 19:25:05 +0000
157+++ debian/changelog 2011-04-14 20:03:31 +0000
158@@ -1,3 +1,15 @@
159+indicator-datetime (0.2.3-0ubuntu1~ppa1) natty; urgency=low
160+
161+ * New upstream release.
162+ ∘ Use GTK directly for detecting when the menu appears and disappears
163+ to reset the date (LP: #649800)
164+ ∘ Handle items being removed from the locations list by choosing
165+ another item in the list (LP: #740948)
166+ ∘ Check for resume in the service and update the label as well
167+ (LP: #759854)
168+
169+ -- Ted Gould <ted@ubuntu.com> Thu, 14 Apr 2011 14:51:20 -0500
170+
171 indicator-datetime (0.2.2-0ubuntu1) natty; urgency=low
172
173 [ Ted Gould ]
174
175=== modified file 'src/datetime-prefs-locations.c'
176--- src/datetime-prefs-locations.c 2011-03-30 13:12:30 +0000
177+++ src/datetime-prefs-locations.c 2011-04-14 20:03:31 +0000
178@@ -77,13 +77,81 @@
179 gtk_tree_path_free (iter->data);
180 }
181 g_list_free (paths);
182-
183+
184+ // Find the next item to select
185+ GtkTreeIter *last_selected = g_list_nth_data(tree_iters, 0);
186+ GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL (store), last_selected);
187+ GtkTreeIter titer;
188+ if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) {
189+ g_debug("Failed to get last selected iter from path");
190+ last_selected = NULL;
191+ } else {
192+ if (!gtk_tree_model_iter_next(GTK_TREE_MODEL (store), &titer)) {
193+ if (gtk_tree_path_prev(path)) {
194+ if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) {
195+ g_debug("Failed to get iter from path");
196+ last_selected = NULL;
197+ } else {
198+ last_selected = &titer;
199+ }
200+ } else {
201+ g_debug("handle_remove: Failed to find another location to select (assume single selected)");
202+ last_selected = NULL;
203+ }
204+ } else {
205+ g_debug("Got next item in model");
206+ last_selected = &titer;
207+ }
208+ }
209+
210+ if (last_selected) {
211+ gboolean clear = TRUE;
212+ path = gtk_tree_model_get_path(GTK_TREE_MODEL (store), last_selected);
213+
214+ // Step over the path to find an item which isn't in the delete list
215+ if (g_list_length(tree_iters) > 1) {
216+ for (iter = tree_iters; iter; iter = iter->next) {
217+ GtkTreePath *ipath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), (GtkTreeIter *)iter->data);
218+ if (gtk_tree_path_compare(path, ipath) == 0) {
219+ clear = FALSE;
220+ break;
221+ }
222+ }
223+ while (clear == FALSE) {
224+ if (gtk_tree_path_prev(path)) {
225+ clear = TRUE;
226+ for (iter = tree_iters; iter; iter = iter->next) {
227+ GtkTreePath *ipath = gtk_tree_model_get_path(GTK_TREE_MODEL (store), (GtkTreeIter *)iter->data);
228+ if (gtk_tree_path_compare(path, ipath) == 0) {
229+ clear = FALSE;
230+ break;
231+ }
232+ }
233+ if (clear) {
234+ if (!gtk_tree_model_get_iter(GTK_TREE_MODEL (store), &titer, path)) {
235+ g_debug("Failed to get iter from path");
236+ last_selected = NULL;
237+ } else {
238+ last_selected = &titer;
239+ }
240+ }
241+ } else {
242+ last_selected = NULL;
243+ break;
244+ }
245+ }
246+ }
247+ }
248+
249 /* Now delete each iterator */
250 for (iter = tree_iters; iter; iter = iter->next) {
251 gtk_list_store_remove (store, (GtkTreeIter *)iter->data);
252 g_free (iter->data);
253 }
254 g_list_free (tree_iters);
255+
256+ if (last_selected)
257+ gtk_tree_selection_select_iter(selection, last_selected);
258 }
259
260 static void
261
262=== modified file 'src/datetime-service.c'
263--- src/datetime-service.c 2011-04-07 18:22:08 +0000
264+++ src/datetime-service.c 2011-04-14 20:03:31 +0000
265@@ -440,28 +440,6 @@
266 return TRUE;
267 }
268
269-static gboolean
270-close_menu_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant)
271-{
272- if (calendar == NULL) return FALSE;
273- g_debug("Resetting date on menu close");
274- start_time_appointments = 0;
275- // TODO create a variant which will be an array of 3 ints {y,m,d}
276- GVariant *date_variant;
277- time_t curtime;
278- struct tm *t1;
279- time(&curtime);
280- t1 = localtime(&curtime);
281- GVariant *date[3];
282- date[0] = g_variant_new_uint32(t1->tm_year + 1900);
283- date[1] = g_variant_new_uint32(t1->tm_mon);
284- date[2] = g_variant_new_uint32(t1->tm_mday);
285- date_variant = g_variant_new_array(NULL, date, 3);
286-
287- dbusmenu_menuitem_property_set_variant (calendar, CALENDAR_MENUITEM_PROP_SET_DATE, date_variant);
288- return TRUE;
289-}
290-
291 static guint ecaltimer = 0;
292
293 static void
294@@ -1221,6 +1199,40 @@
295 return;
296 }
297
298+static void
299+session_active_change_cb (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name,
300+ GVariant * parameters, gpointer user_data)
301+{
302+ // Just returned from suspend
303+ if (g_strcmp0(signal_name, "SystemIdleHintChanged") == 0) {
304+ gboolean idle = FALSE;
305+ g_variant_get(parameters, "(b)", &idle);
306+ if (!idle) {
307+ datetime_interface_update(DATETIME_INTERFACE(user_data));
308+ update_datetime(NULL);
309+ setup_timer();
310+ }
311+ }
312+ return;
313+}
314+
315+/* for hooking into console kit signal on wake from suspend */
316+static void
317+system_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
318+{
319+ GError * error = NULL;
320+
321+ GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
322+
323+ if (error != NULL) {
324+ g_warning("Could not grab DBus proxy for ConsoleKit: %s", error->message);
325+ g_error_free(error);
326+ return;
327+ }
328+
329+ g_signal_connect(proxy, "g-signal", G_CALLBACK(session_active_change_cb), user_data);
330+}
331+
332 /* Callback from getting the address */
333 static void
334 geo_address_cb (GeoclueAddress * address, int timestamp, GHashTable * addy_data, GeoclueAccuracy * accuracy, GError * error, gpointer user_data)
335@@ -1439,9 +1451,6 @@
336
337 build_menus(root);
338
339- // Connect to the close signal to reset the calendar date
340- g_signal_connect(root, "event::closed", G_CALLBACK(close_menu_cb), NULL);
341-
342 /* Cache the timezone */
343 update_current_timezone();
344
345@@ -1458,6 +1467,15 @@
346 /* Setup the timer */
347 setup_timer();
348
349+ /* And watch for system resumes */
350+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
351+ G_DBUS_PROXY_FLAGS_NONE,
352+ NULL,
353+ "org.freedesktop.ConsoleKit",
354+ "/org/freedesktop/ConsoleKit/Manager",
355+ "org.freedesktop.ConsoleKit.Manager",
356+ NULL, system_proxy_cb, dbus);
357+
358 mainloop = g_main_loop_new(NULL, FALSE);
359 g_main_loop_run(mainloop);
360
361
362=== modified file 'src/dbus-shared.h'
363--- src/dbus-shared.h 2011-03-31 19:30:50 +0000
364+++ src/dbus-shared.h 2011-04-14 20:03:31 +0000
365@@ -29,11 +29,7 @@
366
367 #define DBUSMENU_CALENDAR_MENUITEM_TYPE "x-canonical-calendar-item"
368
369-// The following properties are not *really* properties, but are just
370-// a way of accessing the calendar from the service
371 #define CALENDAR_MENUITEM_PROP_MARKS "calendar-marks"
372-#define CALENDAR_MENUITEM_PROP_SET_DATE "calendar-set-date"
373-
374
375 #define APPOINTMENT_MENUITEM_TYPE "appointment-item"
376 #define APPOINTMENT_MENUITEM_PROP_LABEL "appointment-label"
377
378=== modified file 'src/indicator-datetime.c'
379--- src/indicator-datetime.c 2011-03-31 19:30:50 +0000
380+++ src/indicator-datetime.c 2011-04-14 20:03:31 +0000
381@@ -171,9 +171,7 @@
382 static void guess_label_size (IndicatorDatetime * self);
383 static void setup_timer (IndicatorDatetime * self, GDateTime * datetime);
384 static void update_time (IndicatorDatetime * self);
385-static void session_active_change_cb (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data);
386 static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data);
387-static void system_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
388 static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data);
389 static gint generate_strftime_bitmask (const char *time_str);
390 static void timezone_update_labels (indicator_item_t * mi_data);
391@@ -269,6 +267,35 @@
392 }
393
394 static void
395+menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointer user_data)
396+{
397+ IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
398+ g_debug("notify visible signal recieved");
399+
400+ // we should only react if we're currently visible
401+ gboolean visible;
402+ g_object_get(G_OBJECT(menu), "visible", &visible, NULL);
403+ if (visible) return;
404+ g_debug("notify visible menu hidden, resetting date");
405+
406+ time_t curtime;
407+
408+ time(&curtime);
409+ struct tm *today = localtime(&curtime);
410+ int y = today->tm_year;
411+ int m = today->tm_mon;
412+ int d = today->tm_mday;
413+
414+ // Set the calendar to todays date
415+ ido_calendar_menu_item_set_date (self->priv->ido_calendar, y+1900, m, d);
416+
417+ // Make sure the day-selected signal is sent so the menu updates - may duplicate
418+ /*GVariant *variant = g_variant_new_uint32((guint)curtime);
419+ guint timestamp = (guint)time(NULL);
420+ dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(self->priv->ido_calendar), "day-selected", variant, timestamp);*/
421+}
422+
423+static void
424 indicator_datetime_init (IndicatorDatetime *self)
425 {
426 self->priv = INDICATOR_DATETIME_GET_PRIVATE(self);
427@@ -348,6 +375,8 @@
428
429 self->priv->menu = dbusmenu_gtkmenu_new(SERVICE_NAME, MENU_OBJ);
430
431+ g_signal_connect(self->priv->menu, "notify::visible", G_CALLBACK(menu_visible_notfy_cb), self);
432+
433 DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(self->priv->menu);
434 dbusmenu_client_add_type_handler_full(DBUSMENU_CLIENT(client), DBUSMENU_CALENDAR_MENUITEM_TYPE, new_calendar_item, self, NULL);
435 dbusmenu_client_add_type_handler_full(DBUSMENU_CLIENT(client), APPOINTMENT_MENUITEM_TYPE, new_appointment_item, self, NULL);
436@@ -365,34 +394,8 @@
437 service_proxy_cb,
438 self);
439
440- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
441- G_DBUS_PROXY_FLAGS_NONE,
442- NULL,
443- "org.freedesktop.ConsoleKit",
444- "/org/freedesktop/ConsoleKit/Manager",
445- "org.freedesktop.ConsoleKit.Manager",
446- NULL, system_proxy_cb, self);
447 return;
448 }
449-/* for hooking into console kit signal on wake from suspend */
450-static void
451-system_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
452-{
453- GError * error = NULL;
454-
455- IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
456- g_return_if_fail(self != NULL);
457-
458- GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
459-
460- if (error != NULL) {
461- g_warning("Could not grab DBus proxy for %s: %s", SERVICE_NAME, error->message);
462- g_error_free(error);
463- return;
464- }
465- g_signal_connect(proxy, "g-signal", G_CALLBACK(session_active_change_cb), self);
466-
467-}
468
469 /* Callback from trying to create the proxy for the serivce, this
470 could include starting the service. Sometime it'll fail and
471@@ -824,18 +827,6 @@
472 return;
473 }
474
475-static void
476-session_active_change_cb (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name,
477- GVariant * parameters, gpointer user_data)
478-{
479- // Just returned from suspend
480- IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
481- if (g_strcmp0(signal_name, "SystemIdleHintChanged") == 0 && g_variant_get_boolean(parameters) == FALSE) {
482- update_time(self);
483- }
484- return;
485-}
486-
487 /* Receives all signals from the service, routed to the appropriate functions */
488 static void
489 receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name,
490@@ -1233,13 +1224,6 @@
491 } else {
492 g_debug("\tMarks: <cleared>");
493 }
494- } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_SET_DATE)) {
495- if (value != NULL) {
496- gsize size = 3;
497- const gint * array = g_variant_get_fixed_array(value, &size, sizeof(gint));
498- g_debug("Setting date y-m-d: %d-%d-%d", array[0], array[1], array[2]);
499- ido_calendar_menu_item_set_date (IDO_CALENDAR_MENU_ITEM (mi_data), array[0], array[1], array[2]);
500- }
501 }
502 return;
503 }
504@@ -1418,11 +1402,6 @@
505 calendar_prop_change_cb(newitem, CALENDAR_MENUITEM_PROP_MARKS, propval, ido);
506 }
507
508- propval = dbusmenu_menuitem_property_get_variant(newitem, CALENDAR_MENUITEM_PROP_SET_DATE);
509- if (propval != NULL) {
510- calendar_prop_change_cb(newitem, CALENDAR_MENUITEM_PROP_SET_DATE, propval, ido);
511- }
512-
513 return TRUE;
514 }
515

Subscribers

People subscribed via source and target branches