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

Proposed by Ted Gould
Status: Merged
Merged at revision: 41
Proposed branch: lp:~indicator-applet-developers/indicator-datetime/ubuntu
Merge into: lp:~ubuntu-desktop/indicator-datetime/ubuntu
Diff against target: 1346 lines (+576/-178)
14 files modified
ChangeLog (+127/-0)
configure (+11/-11)
configure.ac (+3/-3)
data/Makefile.am (+7/-1)
data/Makefile.in (+41/-12)
data/indicator-datetime-preferences.desktop (+14/-0)
data/indicator-datetime-preferences.desktop.in (+14/-0)
debian/changelog (+21/-0)
po/POTFILES.in (+1/-0)
src/datetime-prefs.c (+41/-2)
src/datetime-service.c (+173/-137)
src/dbus-shared.h (+1/-0)
src/indicator-datetime.c (+118/-12)
src/settings-shared.h (+4/-0)
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+53707@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-03-03 20:49:49 +0000
3+++ ChangeLog 2011-03-16 21:26:01 +0000
4@@ -1,5 +1,132 @@
5 # Generated by Makefile. Do not edit.
6
7+2011-03-16 Ted Gould <ted@gould.cx>
8+
9+ 0.1.98
10+
11+2011-03-16 Ted Gould <ted@gould.cx>
12+
13+ Updating to required IDO version
14+
15+2011-03-16 Ted Gould <ted@gould.cx>
16+
17+ Get more signals from the calendar and use them for good.
18+
19+2011-03-15 karl-qdh <karl@qdh.org.uk>
20+
21+ Fixed up much of the calendar browsing
22+
23+2011-03-15 karl-qdh <karl@qdh.org.uk>
24+
25+ Fixed missed build error, caused by sync problems between netbook and laptop.
26+
27+2011-03-14 Ted Gould <ted@gould.cx>
28+
29+ Fix appointment time format
30+
31+2011-03-14 karl-qdh <karl@qdh.org.uk>
32+
33+ Merged back with the pre-requisite branch and updated to include ted's suggested _()'s in strftime
34+
35+2011-03-08 karl-qdh <karl@qdh.org.uk>
36+
37+ Fixed time format of appointments not respecting the configuration
38+
39+2011-03-14 Ted Gould <ted@gould.cx>
40+
41+ Commenting out value as we're not using it yet.
42+
43+2011-03-14 Ted Gould <ted@gould.cx>
44+
45+ Change the appointments so that they're modified by the calendar month
46+
47+2011-03-14 karl-qdh <karl@qdh.org.uk>
48+
49+ Fixing ted's comments
50+
51+2011-03-08 karl-qdh <karl@qdh.org.uk>
52+
53+ Fixed calendar browsing with month-changed and removed bogus off by one error
54+
55+2011-03-08 karl-qdh <karl@qdh.org.uk>
56+
57+ Changed update appointment items so there's less of a delay when refreshing between no-appointments and appointments loaded.
58+ Fixed the handle_event signalling from the client to the service.
59+ Started hooking up calendar browsing.
60+
61+2011-03-08 karl-qdh <karl@qdh.org.uk>
62+
63+ Fixed incorrect year in tm struct for indicator-datetime.c:month_changed_cb, still receiving a segfault in
64+ datetime-service.c when we try to use the variant. Checked the variant value over dbus and its fine.
65+
66+2011-03-06 karl-qdh <karl@qdh.org.uk>
67+
68+ Tried using uint but still segfaulting in variant code
69+
70+2011-03-06 karl-qdh <karl@qdh.org.uk>
71+
72+ Hooking up the signals from the calendar and getting it working on service side
73+
74+2011-03-10 Ted Gould <ted@gould.cx>
75+
76+ 0.1.97
77+
78+2011-03-10 Ted Gould <ted@gould.cx>
79+
80+ Making it so the clock can be hidden entirely. Adding a desktop file to get to the preferences when it is hidden.
81+
82+2011-03-10 Michael Terry <mike@mterry.name>
83+
84+ make show-clock work
85+
86+2011-03-10 Ted Gould <ted@gould.cx>
87+
88+ Make showing the calendar into a property in the indicator
89+
90+2011-03-10 Michael Terry <mike@mterry.name>
91+
92+ make 'show monthly calendar' checkbox work
93+
94+2011-03-10 Ted Gould <ted@gould.cx>
95+
96+ Check to see if the service is running
97+
98+2011-03-10 Ted Gould <ted@gould.cx>
99+
100+ Use the shared header file for the service and interface names.
101+
102+2011-03-10 Michael Terry <mike@mterry.name>
103+
104+ prefs: only let user change clock prefs if the clock is running; don't connect to response signal, it's no longer a dialog
105+
106+2011-03-08 Ted Gould <ted@gould.cx>
107+
108+ Show the week numbers if configured to do so.
109+
110+2011-03-04 karl-qdh <karl@qdh.org.uk>
111+
112+ Fixed #729020 - Week numbers not respecting configuration on startup
113+
114+2011-03-07 Ted Gould <ted@gould.cx>
115+
116+ Fix the icon size lookup
117+
118+2011-03-04 karl-qdh <karl@qdh.org.uk>
119+
120+ Fix for gtk lookup icon size returning negative numbers
121+
122+2011-03-04 karl-qdh <karl@qdh.org.uk>
123+
124+ Few more minor cleanups
125+
126+2011-03-04 karl-qdh <karl@qdh.org.uk>
127+
128+ Merging back with trunk
129+
130+2011-03-04 karl-qdh <karl@qdh.org.uk>
131+
132+ Cleaning up a few dead comments and code
133+
134 2011-03-03 Ted Gould <ted@gould.cx>
135
136 0.1.96
137
138=== modified file 'configure'
139--- configure 2011-03-03 20:49:49 +0000
140+++ configure 2011-03-16 21:26:01 +0000
141@@ -1,6 +1,6 @@
142 #! /bin/sh
143 # Guess values for system-dependent variables and create Makefiles.
144-# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.96.
145+# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.98.
146 #
147 # Report bugs to <ted@canonical.com>.
148 #
149@@ -703,8 +703,8 @@
150 # Identity of this package.
151 PACKAGE_NAME='indicator-datetime'
152 PACKAGE_TARNAME='indicator-datetime'
153-PACKAGE_VERSION='0.1.96'
154-PACKAGE_STRING='indicator-datetime 0.1.96'
155+PACKAGE_VERSION='0.1.98'
156+PACKAGE_STRING='indicator-datetime 0.1.98'
157 PACKAGE_BUGREPORT='ted@canonical.com'
158 PACKAGE_URL=''
159
160@@ -1502,7 +1502,7 @@
161 # Omit some internal or obsolete options to make the list less imposing.
162 # This message is too long to be a string in the A/UX 3.1 sh.
163 cat <<_ACEOF
164-\`configure' configures indicator-datetime 0.1.96 to adapt to many kinds of systems.
165+\`configure' configures indicator-datetime 0.1.98 to adapt to many kinds of systems.
166
167 Usage: $0 [OPTION]... [VAR=VALUE]...
168
169@@ -1573,7 +1573,7 @@
170
171 if test -n "$ac_init_help"; then
172 case $ac_init_help in
173- short | recursive ) echo "Configuration of indicator-datetime 0.1.96:";;
174+ short | recursive ) echo "Configuration of indicator-datetime 0.1.98:";;
175 esac
176 cat <<\_ACEOF
177
178@@ -1701,7 +1701,7 @@
179 test -n "$ac_init_help" && exit $ac_status
180 if $ac_init_version; then
181 cat <<\_ACEOF
182-indicator-datetime configure 0.1.96
183+indicator-datetime configure 0.1.98
184 generated by GNU Autoconf 2.67
185
186 Copyright (C) 2010 Free Software Foundation, Inc.
187@@ -2072,7 +2072,7 @@
188 This file contains any messages produced by compilers while
189 running configure, to aid debugging if configure makes a mistake.
190
191-It was created by indicator-datetime $as_me 0.1.96, which was
192+It was created by indicator-datetime $as_me 0.1.98, which was
193 generated by GNU Autoconf 2.67. Invocation command line was
194
195 $ $0 $@
196@@ -2893,7 +2893,7 @@
197
198 # Define the identity of the package.
199 PACKAGE=indicator-datetime
200- VERSION=0.1.96
201+ VERSION=0.1.98
202
203
204 cat >>confdefs.h <<_ACEOF
205@@ -12221,7 +12221,7 @@
206 DBUSMENUGTK_REQUIRED_VERSION=0.3.94
207 GIO_REQUIRED_VERSION=2.25.11
208 # Note: the GIO check below also ensures the proper glib with gsettings support is present
209-INDICATOR_DISPLAY_OBJECTS=0.1.10
210+INDICATOR_DISPLAY_OBJECTS=0.2.2
211 GEOCLUE_REQUIRED_VERSION=0.12.0
212 OOBS_REQUIRED_VERSION=2.31.0
213 ECAL_REQUIRED_VERSION=2.30
214@@ -14964,7 +14964,7 @@
215 # report actual input values of CONFIG_FILES etc. instead of their
216 # values after options handling.
217 ac_log="
218-This file was extended by indicator-datetime $as_me 0.1.96, which was
219+This file was extended by indicator-datetime $as_me 0.1.98, which was
220 generated by GNU Autoconf 2.67. Invocation command line was
221
222 CONFIG_FILES = $CONFIG_FILES
223@@ -15030,7 +15030,7 @@
224 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
225 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
226 ac_cs_version="\\
227-indicator-datetime config.status 0.1.96
228+indicator-datetime config.status 0.1.98
229 configured by $0, generated by GNU Autoconf 2.67,
230 with options \\"\$ac_cs_config\\"
231
232
233=== modified file 'configure.ac'
234--- configure.ac 2011-03-03 20:49:49 +0000
235+++ configure.ac 2011-03-16 21:26:01 +0000
236@@ -1,11 +1,11 @@
237
238-AC_INIT(indicator-datetime, 0.1.96, ted@canonical.com)
239+AC_INIT(indicator-datetime, 0.1.98, ted@canonical.com)
240 AC_COPYRIGHT([Copyright 2009,2010 Canonical])
241
242 AC_PREREQ(2.53)
243
244 AM_CONFIG_HEADER(config.h)
245-AM_INIT_AUTOMAKE(indicator-datetime, 0.1.96)
246+AM_INIT_AUTOMAKE(indicator-datetime, 0.1.98)
247
248 AM_MAINTAINER_MODE
249
250@@ -56,7 +56,7 @@
251 DBUSMENUGTK_REQUIRED_VERSION=0.3.94
252 GIO_REQUIRED_VERSION=2.25.11
253 # Note: the GIO check below also ensures the proper glib with gsettings support is present
254-INDICATOR_DISPLAY_OBJECTS=0.1.10
255+INDICATOR_DISPLAY_OBJECTS=0.2.2
256 GEOCLUE_REQUIRED_VERSION=0.12.0
257 OOBS_REQUIRED_VERSION=2.31.0
258 ECAL_REQUIRED_VERSION=2.30
259
260=== modified file 'data/Makefile.am'
261--- data/Makefile.am 2011-03-03 20:41:18 +0000
262+++ data/Makefile.am 2011-03-16 21:26:01 +0000
263@@ -12,9 +12,15 @@
264
265 pkgdata_DATA = datetime-dialog.ui
266
267+@INTLTOOL_DESKTOP_RULE@
268+desktopdir = $(datadir)/applications
269+desktop_DATA = indicator-datetime-preferences.desktop
270+
271 EXTRA_DIST = \
272 $(gsettings_SCHEMAS) \
273 datetime-dialog.ui \
274+ indicator-datetime-preferences.desktop \
275+ indicator-datetime-preferences.desktop.in \
276 indicator-datetime.service.in
277
278-CLEANFILES = indicator-datetime.service
279+CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service
280
281=== modified file 'data/Makefile.in'
282--- data/Makefile.in 2011-03-03 20:49:49 +0000
283+++ data/Makefile.in 2011-03-16 21:26:01 +0000
284@@ -76,8 +76,8 @@
285 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
286 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
287 am__installdirs = "$(DESTDIR)$(dbus_servicesdir)" \
288- "$(DESTDIR)$(pkgdatadir)"
289-DATA = $(dbus_services_DATA) $(pkgdata_DATA)
290+ "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pkgdatadir)"
291+DATA = $(dbus_services_DATA) $(desktop_DATA) $(pkgdata_DATA)
292 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
293 ACLOCAL = @ACLOCAL@
294 ALL_LINGUAS = @ALL_LINGUAS@
295@@ -242,12 +242,16 @@
296 dbus_servicesdir = $(DBUSSERVICEDIR)
297 dbus_services_DATA = indicator-datetime.service
298 pkgdata_DATA = datetime-dialog.ui
299+desktopdir = $(datadir)/applications
300+desktop_DATA = indicator-datetime-preferences.desktop
301 EXTRA_DIST = \
302 $(gsettings_SCHEMAS) \
303 datetime-dialog.ui \
304+ indicator-datetime-preferences.desktop \
305+ indicator-datetime-preferences.desktop.in \
306 indicator-datetime.service.in
307
308-CLEANFILES = indicator-datetime.service
309+CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service
310 all: all-am
311
312 .SUFFIXES:
313@@ -307,6 +311,26 @@
314 test -n "$$files" || exit 0; \
315 echo " ( cd '$(DESTDIR)$(dbus_servicesdir)' && rm -f" $$files ")"; \
316 cd "$(DESTDIR)$(dbus_servicesdir)" && rm -f $$files
317+install-desktopDATA: $(desktop_DATA)
318+ @$(NORMAL_INSTALL)
319+ test -z "$(desktopdir)" || $(MKDIR_P) "$(DESTDIR)$(desktopdir)"
320+ @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \
321+ for p in $$list; do \
322+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
323+ echo "$$d$$p"; \
324+ done | $(am__base_list) | \
325+ while read files; do \
326+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(desktopdir)'"; \
327+ $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \
328+ done
329+
330+uninstall-desktopDATA:
331+ @$(NORMAL_UNINSTALL)
332+ @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \
333+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
334+ test -n "$$files" || exit 0; \
335+ echo " ( cd '$(DESTDIR)$(desktopdir)' && rm -f" $$files ")"; \
336+ cd "$(DESTDIR)$(desktopdir)" && rm -f $$files
337 install-pkgdataDATA: $(pkgdata_DATA)
338 @$(NORMAL_INSTALL)
339 test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
340@@ -368,7 +392,7 @@
341 check: check-am
342 all-am: Makefile $(DATA)
343 installdirs:
344- for dir in "$(DESTDIR)$(dbus_servicesdir)" "$(DESTDIR)$(pkgdatadir)"; do \
345+ for dir in "$(DESTDIR)$(dbus_servicesdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pkgdatadir)"; do \
346 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
347 done
348 install: install-am
349@@ -417,7 +441,8 @@
350
351 info-am:
352
353-install-data-am: install-dbus_servicesDATA install-pkgdataDATA
354+install-data-am: install-dbus_servicesDATA install-desktopDATA \
355+ install-pkgdataDATA
356
357 install-dvi: install-dvi-am
358
359@@ -461,7 +486,8 @@
360
361 ps-am:
362
363-uninstall-am: uninstall-dbus_servicesDATA uninstall-pkgdataDATA
364+uninstall-am: uninstall-dbus_servicesDATA uninstall-desktopDATA \
365+ uninstall-pkgdataDATA
366
367 .MAKE: install-am install-strip
368
369@@ -469,20 +495,23 @@
370 distclean distclean-generic distclean-libtool distdir dvi \
371 dvi-am html html-am info info-am install install-am \
372 install-data install-data-am install-dbus_servicesDATA \
373- install-dvi install-dvi-am install-exec install-exec-am \
374- install-html install-html-am install-info install-info-am \
375- install-man install-pdf install-pdf-am install-pkgdataDATA \
376- install-ps install-ps-am install-strip installcheck \
377- installcheck-am installdirs maintainer-clean \
378+ install-desktopDATA install-dvi install-dvi-am install-exec \
379+ install-exec-am install-html install-html-am install-info \
380+ install-info-am install-man install-pdf install-pdf-am \
381+ install-pkgdataDATA install-ps install-ps-am install-strip \
382+ installcheck installcheck-am installdirs maintainer-clean \
383 maintainer-clean-generic mostlyclean mostlyclean-generic \
384 mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
385- uninstall-dbus_servicesDATA uninstall-pkgdataDATA
386+ uninstall-dbus_servicesDATA uninstall-desktopDATA \
387+ uninstall-pkgdataDATA
388
389 @GSETTINGS_RULES@
390
391 %.service: %.service.in
392 sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
393
394+@INTLTOOL_DESKTOP_RULE@
395+
396 # Tell versions [3.59,3.63) of GNU make to not export all variables.
397 # Otherwise a system limit (for SysV at least) may be exceeded.
398 .NOEXPORT:
399
400=== added file 'data/indicator-datetime-preferences.desktop'
401--- data/indicator-datetime-preferences.desktop 1970-01-01 00:00:00 +0000
402+++ data/indicator-datetime-preferences.desktop 2011-03-16 21:26:01 +0000
403@@ -0,0 +1,14 @@
404+[Desktop Entry]
405+Version=1.0
406+
407+Name=Time & Date
408+Comment=Change your clock and date settings
409+
410+Icon=time-admin
411+TryExec=indicator-datetime-preferences
412+Exec=indicator-datetime-preferences
413+
414+StartupNotify=true
415+
416+Type=Application
417+Categories=GNOME;GTK;Utility;DesktopSettings;Settings;
418
419=== added file 'data/indicator-datetime-preferences.desktop.in'
420--- data/indicator-datetime-preferences.desktop.in 1970-01-01 00:00:00 +0000
421+++ data/indicator-datetime-preferences.desktop.in 2011-03-16 21:26:01 +0000
422@@ -0,0 +1,14 @@
423+[Desktop Entry]
424+Version=1.0
425+
426+_Name=Time & Date
427+_Comment=Change your clock and date settings
428+
429+Icon=time-admin
430+TryExec=indicator-datetime-preferences
431+Exec=indicator-datetime-preferences
432+
433+StartupNotify=true
434+
435+Type=Application
436+Categories=GNOME;GTK;Utility;DesktopSettings;Settings;
437
438=== modified file 'debian/changelog'
439--- debian/changelog 2011-03-03 22:21:25 +0000
440+++ debian/changelog 2011-03-16 21:26:01 +0000
441@@ -1,3 +1,24 @@
442+indicator-datetime (0.1.98-0ubuntu1~ppa1) natty; urgency=low
443+
444+ * New upstream release.
445+ ∘ Make appointments match calendar month
446+ ∘ Fix time format of appointments
447+ ∘ Get date change signals from calendar and adjust based on them.
448+ ∘ Crash fixes (LP: #733833, LP: #729444)
449+ ∘ Valgrind invalid read (LP: #729175)
450+ ∘ Translation fixes to date label (LP: #729632)
451+
452+ -- Ted Gould <ted@ubuntu.com> Wed, 16 Mar 2011 16:17:38 -0500
453+
454+indicator-datetime (0.1.97-0ubuntu1~ppa1) natty; urgency=low
455+
456+ * New upstream release.
457+ * Fix handling of reoccruing events
458+ * Handle settings in the indicator
459+ * Allow for hiding the calendar and the clock
460+
461+ -- Ted Gould <ted@ubuntu.com> Thu, 10 Mar 2011 23:14:41 -0600
462+
463 indicator-datetime (0.1.96-0ubuntu1) natty; urgency=low
464
465 [ Ted Gould ]
466
467=== modified file 'po/POTFILES.in'
468--- po/POTFILES.in 2011-03-03 20:41:18 +0000
469+++ po/POTFILES.in 2011-03-16 21:26:01 +0000
470@@ -5,3 +5,4 @@
471 src/utils.c
472 src/settings-shared.h
473 [type: gettext/glade]data/datetime-dialog.ui
474+data/indicator-datetime-preferences.desktop.in
475
476=== modified file 'src/datetime-prefs.c'
477--- src/datetime-prefs.c 2011-03-03 18:14:14 +0000
478+++ src/datetime-prefs.c 2011-03-16 21:26:01 +0000
479@@ -35,6 +35,7 @@
480 #include <unique/unique.h>
481 #include <polkitgtk/polkitgtk.h>
482
483+#include "dbus-shared.h"
484 #include "settings-shared.h"
485 #include "utils.h"
486 #include "datetime-prefs-locations.h"
487@@ -225,7 +226,8 @@
488 g_variant_unref (answers);
489 }
490
491-void proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
492+static void
493+proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
494 {
495 GError * error = NULL;
496
497@@ -244,6 +246,35 @@
498 NULL, tz_query_answered, NULL);
499 }
500
501+static void
502+service_name_owner_changed (GDBusProxy * proxy, GParamSpec *pspec, gpointer user_data)
503+{
504+ GtkWidget * widget = GTK_WIDGET (user_data);
505+ gchar * owner = g_dbus_proxy_get_name_owner (proxy);
506+
507+ gtk_widget_set_sensitive (widget, (owner != NULL));
508+
509+ g_free (owner);
510+}
511+
512+static void
513+service_proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
514+{
515+ GError * error = NULL;
516+
517+ proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
518+
519+ if (error != NULL) {
520+ g_critical("Could not grab DBus proxy for indicator-datetime-service: %s", error->message);
521+ g_error_free(error);
522+ return;
523+ }
524+
525+ /* And now, do initial proxy configuration */
526+ g_signal_connect (proxy, "notify::g-name-owner", G_CALLBACK (service_name_owner_changed), user_data);
527+ service_name_owner_changed (proxy, NULL, user_data);
528+}
529+
530 static gboolean
531 are_spinners_focused (void)
532 {
533@@ -634,6 +665,15 @@
534 "org.gnome.SettingsDaemon.DateTimeMechanism",
535 NULL, proxy_ready, NULL);
536
537+ /* Grab proxy for datetime service, to see if it's running. It would
538+ actually be more ideal to see if the indicator module itself is running,
539+ but that doesn't yet claim a name on the bus. Presumably the service
540+ would have been started by any such indicator, so this will at least tell
541+ us if there *was* a datetime module run this session. */
542+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, NULL,
543+ SERVICE_NAME, SERVICE_OBJ, SERVICE_IFACE,
544+ NULL, service_proxy_ready, WIG ("showClockCheck"));
545+
546 #undef WIG
547
548 g_object_unref (conf);
549@@ -678,7 +718,6 @@
550 unique_app_watch_window (app, GTK_WINDOW (dlg));
551
552 gtk_widget_show_all (dlg);
553- g_signal_connect (dlg, "response", G_CALLBACK(gtk_main_quit), NULL);
554 g_signal_connect (dlg, "destroy", G_CALLBACK(gtk_main_quit), NULL);
555 gtk_main ();
556 }
557
558=== modified file 'src/datetime-service.c'
559--- src/datetime-service.c 2011-03-03 20:49:49 +0000
560+++ src/datetime-service.c 2011-03-16 21:26:01 +0000
561@@ -82,6 +82,7 @@
562 static GList * dconflocations = NULL;
563 static GList * comp_instances = NULL;
564 static gboolean updating_appointments = FALSE;
565+static time_t start_time_appointments = (time_t) 0;
566 GSettings *conf;
567
568
569@@ -277,13 +278,43 @@
570 }
571
572 static gboolean
573-month_changed_cb (DbusmenuMenuitem * menuitem, GVariant *variant, guint timestamp)
574-{
575- // TODO: * Decode the month/year from the string we received
576- // * Check what our current month/year are
577- // * Set some globals so when we-re-run update appointment menu items it gets the right start date
578- // * update appointment menu items
579- g_debug("Received month changed : %s", g_variant_get_string(variant, NULL));
580+month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
581+{
582+ start_time_appointments = (time_t)g_variant_get_uint32(variant);
583+
584+ g_debug("Received month changed with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments));
585+ update_appointment_menu_items(NULL);
586+ return TRUE;
587+}
588+
589+static gboolean
590+day_selected_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
591+{
592+ start_time_appointments = (time_t)g_variant_get_uint32(variant);
593+
594+ g_debug("Received day-selected with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments));
595+ update_appointment_menu_items(NULL);
596+ return TRUE;
597+}
598+
599+static gboolean
600+day_selected_double_click_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
601+{
602+ time_t evotime = (time_t)g_variant_get_uint32(variant);
603+
604+ g_debug("Received day-selected-double-click with timestamp: %d -> %s",(int)evotime, ctime(&evotime));
605+
606+ gchar *ad = isodate_from_time_t(evotime);
607+ gchar *cmd = g_strconcat("evolution calendar:///?startdate=", ad, NULL);
608+
609+ GError * error = NULL;
610+
611+ g_debug("Issuing command '%s'", cmd);
612+ if (!g_spawn_command_line_async(cmd, &error)) {
613+ g_warning("Unable to start %s: %s", (char *)cmd, error->message);
614+ g_error_free(error);
615+ }
616+
617 return TRUE;
618 }
619
620@@ -335,8 +366,6 @@
621 check_for_calendar (gpointer user_data)
622 {
623 g_return_val_if_fail (calendar != NULL, FALSE);
624-
625- if (!g_settings_get_boolean(conf, SETTINGS_SHOW_CALENDAR_S)) return FALSE;
626
627 gchar *evo = g_find_program_in_path("evolution");
628 if (evo != NULL) {
629@@ -364,8 +393,10 @@
630 stop_ecal_timer();
631 }
632
633- // Connect to event::month-changed
634+ // Connect to calendar events
635 g_signal_connect(calendar, "event::month-changed", G_CALLBACK(month_changed_cb), NULL);
636+ g_signal_connect(calendar, "event::day-selected", G_CALLBACK(day_selected_cb), NULL);
637+ g_signal_connect(calendar, "event::day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), NULL);
638 g_free(evo);
639 } else {
640 g_debug("Unable to find calendar app.");
641@@ -404,8 +435,6 @@
642
643 gboolean show = g_settings_get_boolean (conf, SETTINGS_SHOW_LOCATIONS_S);
644
645- // TODO: Remove items from the dconflocations at the end of the iteration
646- // Make sure if there are multiple locations, our current location is shown
647 if (len > 0) {
648 dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
649 dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
650@@ -432,7 +461,6 @@
651 }
652 }
653 g_strfreev (locations);
654- // Get the evolution calendar timezone as a place and time and add it
655 return FALSE;
656 }
657
658@@ -514,43 +542,16 @@
659
660 // TODO: Convert the timezone into a 3 letter abbreviation if it's different to current_timezone
661 // TODO: Add the appointment timezone to the list if it's not already there.
662-
663- GSList *period_list = NULL, *l;
664- if (e_cal_component_has_recurrences (comp)) {
665- e_cal_component_get_rdate_list (comp, &period_list);
666- g_debug("ECalComponent has recurrences");
667- } else {
668- g_debug("ECalComponent doesn't have recurrences");
669- }
670
671 struct comp_instance *ci;
672 ci = g_new (struct comp_instance, 1);
673
674- // Do we get rdate_list?
675- if (period_list != NULL) {
676- g_debug("Got recurring periods");
677- for (l = period_list; l; l = l->next) {
678- ECalComponentPeriod *period = l->data;
679- struct tm tmp_tm = icaltimetype_to_tm_with_zone (&period->start, appointment_zone, current_zone);
680- time_t start = mktime(&tmp_tm);
681- g_debug("period time: %d", (int)start);
682-
683- tmp_tm = icaltimetype_to_tm_with_zone (&period->u.end, appointment_zone, current_zone);
684- time_t end = mktime(&tmp_tm);
685-
686- if (start >= instance_start && end < instance_end) {
687- ci->start = start;
688- ci->end = end;
689- }
690- }
691- } else {
692- ci->start = instance_start;
693- ci->end = instance_end;
694- g_debug("Got no recurring periods set time to start %s, end %s", ctime(&instance_start), ctime(&instance_end));
695- }
696+ g_debug("Using times start %s, end %s", ctime(&instance_start), ctime(&instance_end));
697
698 ci->comp = comp;
699 ci->source = E_SOURCE(data);
700+ ci->start = instance_start;
701+ ci->end = instance_end;
702
703 comp_instances = g_list_append(comp_instances, ci);
704 return TRUE;
705@@ -566,39 +567,57 @@
706 {
707 // FFR: we should take into account short term timers, for instance
708 // tea timers, pomodoro timers etc... that people may add, this is hinted to in the spec.
709+ g_debug("Update appointments called");
710 if (calendar == NULL) return FALSE;
711 if (!g_settings_get_boolean(conf, SETTINGS_SHOW_EVENTS_S)) return FALSE;
712 if (updating_appointments) return TRUE;
713 updating_appointments = TRUE;
714
715- time_t t1, t2;
716+ time_t curtime = 0, t1 = 0, t2 = 0;
717 gchar *ad;
718 GList *l;
719- //GList *allobjects = NULL;
720 GSList *g;
721 GError *gerror = NULL;
722 gint i;
723- gint width, height;
724+ gint width = 0, height = 0;
725 ESourceList * sources = NULL;
726-
727- time(&t1);
728- time(&t2);
729- t2 += (time_t) (7 * 24 * 60 * 60); /* 7 days ahead of now, we actually need number_of_days_in_this_month */
730
731- /* Remove all of the previous appointments */
732- if (appointments != NULL) {
733- g_debug("Freeing old appointments");
734- while (appointments != NULL) {
735- DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointments->data);
736- g_debug("Freeing old appointment: %p", litem);
737- // Remove all the existing menu items which are in appointments.
738- appointments = g_list_remove(appointments, litem);
739- dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
740- g_object_unref(G_OBJECT(litem));
741+ // Get today & work out query times
742+ time(&curtime);
743+ struct tm *today = localtime(&curtime);
744+ const int mday = today->tm_mday;
745+ const int mon = today->tm_mon;
746+ const int year = today->tm_year;
747+
748+ struct tm *start_tm = NULL;
749+ int this_year = today->tm_year + 1900;
750+ int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
751+ if ((this_year % 400 == 0) || (this_year % 100 > 0 && this_year % 4 == 0)) days[1] = 29;
752+
753+ int highlightdays = days[mon] - mday + 1;
754+ t1 = curtime; // By default the current time is the appointment start time.
755+
756+ if (start_time_appointments > 0) {
757+ start_tm = localtime(&start_time_appointments);
758+ int start_month = start_tm->tm_mon;
759+ int start_year = start_tm->tm_year + 1900;
760+ if ((start_month != mon) || (start_year != this_year)) {
761+ // Set t1 to the start of that month.
762+ struct tm month_start = {0};
763+ month_start.tm_year = start_tm->tm_year;
764+ month_start.tm_mon = start_tm->tm_mon;
765+ month_start.tm_mday = 1;
766+ t1 = mktime(&month_start);
767+ highlightdays = days[mon];
768 }
769 }
770
771- // TODO Remove all highlights from the calendar widget
772+ g_debug("Will highlight %d days from %s", highlightdays, ctime(&t1));
773+
774+ t2 = t1 + (time_t) (highlightdays * 24 * 60 * 60);
775+
776+ // Remove all highlights from the calendar widget
777+ dbusmenu_menuitem_property_set (calendar, CALENDAR_MENUITEM_PROP_CLEAR_MARKS, NULL);
778
779 if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
780 g_debug("Failed to get ecal sources\n");
781@@ -616,14 +635,14 @@
782 }
783 }
784
785- // iterate the query for all sources
786+ // Generate instances for all sources
787 for (g = e_source_list_peek_groups (sources); g; g = g->next) {
788 ESourceGroup *group = E_SOURCE_GROUP (g->data);
789 GSList *s;
790
791 for (s = e_source_group_peek_sources (group); s; s = s->next) {
792 ESource *source = E_SOURCE (s->data);
793- //g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
794+ g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
795 ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT);
796 e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL);
797
798@@ -634,34 +653,80 @@
799 continue;
800 }
801
802- g_debug("Generating instances");
803 e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, (gpointer) source);
804- g_debug("Number of objects returned: %d", g_list_length(comp_instances));
805 }
806 }
807+ g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances));
808 GList *sorted_comp_instances = g_list_sort(comp_instances, compare_comp_instances);
809 comp_instances = NULL;
810+ g_debug("Components sorted");
811+
812+ /* Remove all of the previous appointments */
813+ if (appointments != NULL) {
814+ g_debug("Freeing old appointments");
815+ while (appointments != NULL) {
816+ DbusmenuMenuitem * litem = DBUSMENU_MENUITEM(appointments->data);
817+ g_debug("Freeing old appointment: %p", litem);
818+ // Remove all the existing menu items which are in appointments.
819+ appointments = g_list_remove(appointments, litem);
820+ dbusmenu_menuitem_child_delete(root, DBUSMENU_MENUITEM(litem));
821+ g_object_unref(G_OBJECT(litem));
822+ }
823+ }
824+
825+ gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
826+ if (width <= 0) width = 12;
827+ if (height <= 0) height = 12;
828+ if (width > 30) width = 12;
829+ if (height > 30) height = 12;
830+
831+ gchar *time_format_str = g_settings_get_string(conf, SETTINGS_TIME_FORMAT_S);
832+ gint apt_output;
833+ if (g_strcmp0(time_format_str, "12-hour") == 0) {
834+ apt_output = SETTINGS_TIME_12_HOUR;
835+ } else if (g_strcmp0(time_format_str, "24-hour") == 0) {
836+ apt_output = SETTINGS_TIME_24_HOUR;
837+ } else {
838+ apt_output = SETTINGS_TIME_LOCALE;
839+ }
840+
841 i = 0;
842-
843- gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
844- if (width == 0) width = 12;
845- if (height == 0) height = 12;
846 for (l = sorted_comp_instances; l; l = l->next) {
847 struct comp_instance *ci = l->data;
848 ECalComponent *ecalcomp = ci->comp;
849 ECalComponentText valuetext;
850- //ECalComponentDateTime datetime;
851 gchar *summary, *cmd;
852 char right[20];
853 //const gchar *uri;
854 DbusmenuMenuitem * item;
855-
856- g_debug("Start Object %p", ecalcomp);
857-
858- // TODO Mark days
859+
860+ ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
861+ struct tm *due = NULL;
862+ if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start);
863+ else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end);
864+ else continue;
865+
866+ const int dmday = due->tm_mday;
867+ const int dmon = due->tm_mon;
868+ const int dyear = due->tm_year;
869+
870+ // Mark day
871+ g_debug("Marking date %s", ctime(&ci->start));
872+ dbusmenu_menuitem_property_set_int (calendar, CALENDAR_MENUITEM_PROP_MARK, due->tm_mday);
873+
874+
875+ // If the appointment time is less than the selected date,
876+ // don't create an appointment item for it.
877+ if (vtype == E_CAL_COMPONENT_EVENT) {
878+ if (ci->start < start_time_appointments) continue;
879+ } else if (vtype == E_CAL_COMPONENT_TODO) {
880+ if (ci->end < start_time_appointments) continue;
881+ }
882
883 if (i >= 5) continue;
884 i++;
885+
886+ g_debug("Create menu item");
887
888 item = dbusmenu_menuitem_new();
889 dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE);
890@@ -675,58 +740,27 @@
891 dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_LABEL, summary);
892 g_debug("Summary: %s", summary);
893 g_free (summary);
894-
895- //appointment_zone = icaltimezone_get_builtin_timezone_from_tzid(datetime.tzid);
896- //current_zone = icaltimezone_get_builtin_timezone_from_tzid(current_timezone);
897- //if (!appointment_zone || datetime.value->is_date) { // If it's today put in the current timezone?
898- // appointment_zone = current_zone;
899- //}
900- // FIXME need to get the timezone of the above datetime,
901- // and get the icaltimezone of the geoclue timezone/selected timezone (whichever is preferred)
902- // TODO: Convert the timezone into a 3 letter abbreviation if it's different to current_timezone
903- // TODO: Add the appointment timezone to the list if it's not already there.
904-
905- //tmp_tm = icaltimetype_to_tm_with_zone (datetime.value, appointment_zone, current_zone);
906-
907+
908 // Due text
909- ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
910-
911- // Get today
912- time_t curtime = time(NULL);
913- struct tm *today = localtime(&curtime);
914-
915- int mday = today->tm_mday;
916- int mon = today->tm_mon;
917- int year = today->tm_year;
918-
919- struct tm *due;
920- g_debug("Start time %s", ctime(&ci->start));
921- if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start);
922- else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end);
923- else continue;
924-
925- strftime(right, 20, "%a %l:%M %p", due);
926- g_debug("Start time %s -> %s", asctime(due), right);
927-
928- int dmday = due->tm_mday;
929- int dmon = due->tm_mon;
930- int dyear = due->tm_year;
931-
932- if ((mday == dmday) && (mon == dmon) && (year == dyear))
933- strftime(right, 20, "%l:%M %p", due);
934- else
935- strftime(right, 20, "%a %l:%M %p", due);
936-
937- g_debug("Appointment time: %s", right);
938- //g_debug("Appointment timezone: %s", datetime.tzid);
939- //g_debug("Appointment timezone: %s", icaltimezone_get_tzid(appointment_zone)); // These two should be the same
940- //g_debug("Calendar timezone: %s", ecal_timezone);
941-
942+ if (apt_output == SETTINGS_TIME_12_HOUR) {
943+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
944+ strftime(right, 20, _(DEFAULT_TIME_12_FORMAT), due);
945+ else
946+ strftime(right, 20, _(DEFAULT_TIME_12_FORMAT_WITH_DAY), due);
947+ } else if (apt_output == SETTINGS_TIME_24_HOUR) {
948+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
949+ strftime(right, 20, _(DEFAULT_TIME_24_FORMAT), due);
950+ else
951+ strftime(right, 20, _(DEFAULT_TIME_24_FORMAT_WITH_DAY), due);
952+ } else {
953+ if ((mday == dmday) && (mon == dmon) && (year == dyear))
954+ strftime(right, 20, _(DEFAULT_TIME_FORMAT), due);
955+ else
956+ strftime(right, 20, _(DEFAULT_TIME_FORMAT_WITH_DAY), due);
957+ }
958+ g_debug("Appointment time: %s, for date %s", right, asctime(due));
959 dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, right);
960
961- //e_cal_component_free_datetime (&datetime);
962-
963-
964 // Now we pull out the URI for the calendar event and try to create a URI that'll work when we execute evolution
965 // FIXME Because the URI stuff is really broken, we're going to open the calendar at todays date instead
966 //e_cal_component_get_uid(ecalcomp, &uri);
967@@ -743,14 +777,11 @@
968 // Draw the correct icon for the appointment type and then tint it using mask fill.
969 // For now we'll create a circle
970 if (color_spec != NULL) {
971- // Fixme causes segfault, but we have colours now yay!
972 GdkColor color;
973 gdk_color_parse (color_spec, &color);
974-
975+ g_debug("Creating a cairo surface: size, %d by %d", width, height);
976 cairo_surface_t *surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height );
977- // Width keeps becoming zero!!
978- if (width == 0) width = 12;
979- if (height == 0) height = 12;
980+
981 cairo_t *cr = cairo_create(surface);
982 gdk_cairo_set_source_color(cr, &color);
983 cairo_paint(cr);
984@@ -760,9 +791,6 @@
985 cairo_stroke(cr);
986 // Convert to pixbuf, in gtk3 this is done with gdk_pixbuf_get_from_surface
987 cairo_content_t content = cairo_surface_get_content (surface) | CAIRO_CONTENT_COLOR;
988- // Width keeps becoming zero!!
989- if (width == 0) width = 12;
990- if (height == 0) height = 12;
991 GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
992 !!(content & CAIRO_CONTENT_ALPHA),
993 8, width, height);
994@@ -793,15 +821,16 @@
995 spixels += sstride;
996 dpixels += dstride;
997 }
998-
999- cairo_surface_destroy (surface);
1000- cairo_destroy(cr);
1001-
1002+
1003 dbusmenu_menuitem_property_set_image (item, APPOINTMENT_MENUITEM_PROP_ICON, pixbuf);
1004+ } else {
1005+ g_debug("Creating pixbuf from surface failed");
1006 }
1007+ cairo_surface_destroy (surface);
1008+ cairo_destroy(cr);
1009 }
1010 dbusmenu_menuitem_child_add_position (root, item, 2+i);
1011- appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove
1012+ appointments = g_list_append (appointments, item); // Keep track of the items here to make them easy to remove
1013 g_debug("Adding appointment: %p", item);
1014 }
1015
1016@@ -809,8 +838,8 @@
1017 for (l = sorted_comp_instances; l; l = l->next) {
1018 const struct comp_instance *ci = l->data;
1019 g_object_unref(ci->comp);
1020- g_list_free(sorted_comp_instances);
1021 }
1022+ g_list_free(sorted_comp_instances);
1023
1024 updating_appointments = FALSE;
1025 g_debug("End of objects");
1026@@ -844,6 +873,12 @@
1027 check_timezone_sync();
1028 }
1029
1030+static void
1031+time_format_changed (void)
1032+{
1033+ update_appointment_menu_items(NULL);
1034+}
1035+
1036 /* Does the work to build the default menu, really calls out
1037 to other functions but this is the core to clean up the
1038 main function. */
1039@@ -896,6 +931,7 @@
1040 g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL);
1041 g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL);
1042 g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL);
1043+ g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL);
1044
1045 DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
1046 dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
1047
1048=== modified file 'src/dbus-shared.h'
1049--- src/dbus-shared.h 2011-03-03 20:41:18 +0000
1050+++ src/dbus-shared.h 2011-03-16 21:26:01 +0000
1051@@ -34,6 +34,7 @@
1052 #define CALENDAR_MENUITEM_PROP_MARK "calendar-mark"
1053 #define CALENDAR_MENUITEM_PROP_UNMARK "calendar-unmark"
1054 #define CALENDAR_MENUITEM_PROP_CLEAR_MARKS "calendar-clear-marks"
1055+#define CALENDAR_MENUITEM_PROP_SET_DATE "calendar-set-date"
1056
1057
1058 #define APPOINTMENT_MENUITEM_TYPE "appointment-item"
1059
1060=== modified file 'src/indicator-datetime.c'
1061--- src/indicator-datetime.c 2011-03-03 20:49:49 +0000
1062+++ src/indicator-datetime.c 2011-03-16 21:26:01 +0000
1063@@ -76,6 +76,7 @@
1064
1065 gchar * time_string;
1066
1067+ gboolean show_clock;
1068 gint time_mode;
1069 gboolean show_seconds;
1070 gboolean show_date;
1071@@ -84,6 +85,7 @@
1072 gboolean custom_show_seconds;
1073
1074 gboolean show_week_numbers;
1075+ gboolean show_calendar;
1076 gint week_start;
1077
1078 guint idle_measure;
1079@@ -105,12 +107,14 @@
1080 found and looked up. */
1081 enum {
1082 PROP_0,
1083+ PROP_SHOW_CLOCK,
1084 PROP_TIME_FORMAT,
1085 PROP_SHOW_SECONDS,
1086 PROP_SHOW_DAY,
1087 PROP_SHOW_DATE,
1088 PROP_CUSTOM_TIME_FORMAT,
1089- PROP_SHOW_WEEK_NUMBERS
1090+ PROP_SHOW_WEEK_NUMBERS,
1091+ PROP_SHOW_CALENDAR
1092 };
1093
1094 typedef struct _indicator_item_t indicator_item_t;
1095@@ -123,12 +127,14 @@
1096 GtkWidget * right;
1097 };
1098
1099+#define PROP_SHOW_CLOCK_S "show-clock"
1100 #define PROP_TIME_FORMAT_S "time-format"
1101 #define PROP_SHOW_SECONDS_S "show-seconds"
1102 #define PROP_SHOW_DAY_S "show-day"
1103 #define PROP_SHOW_DATE_S "show-date"
1104 #define PROP_CUSTOM_TIME_FORMAT_S "custom-time-format"
1105 #define PROP_SHOW_WEEK_NUMBERS_S "show-week-numbers"
1106+#define PROP_SHOW_CALENDAR_S "show-calendar"
1107
1108 #define INDICATOR_DATETIME_GET_PRIVATE(o) \
1109 (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_DATETIME_TYPE, IndicatorDatetimePrivate))
1110@@ -196,6 +202,13 @@
1111 io_class->get_accessible_desc = get_accessible_desc;
1112
1113 g_object_class_install_property (object_class,
1114+ PROP_SHOW_CLOCK,
1115+ g_param_spec_boolean(PROP_SHOW_CLOCK_S,
1116+ "Whether to show the clock in the menu bar.",
1117+ "Shows indicator-datetime in the shell's menu bar.",
1118+ TRUE, /* default */
1119+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1120+ g_object_class_install_property (object_class,
1121 PROP_TIME_FORMAT,
1122 g_param_spec_int(PROP_TIME_FORMAT_S,
1123 "A choice of which format should be used on the panel",
1124@@ -240,6 +253,13 @@
1125 "Shows the week numbers in the monthly calendar in indicator-datetime's menu.",
1126 FALSE, /* default */
1127 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1128+ g_object_class_install_property (object_class,
1129+ PROP_SHOW_CALENDAR,
1130+ g_param_spec_boolean(PROP_SHOW_CALENDAR_S,
1131+ "Whether to show the calendar.",
1132+ "Shows the monthly calendar in indicator-datetime's menu.",
1133+ TRUE, /* default */
1134+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1135 return;
1136 }
1137
1138@@ -254,6 +274,7 @@
1139 self->priv->idle_measure = 0;
1140 self->priv->max_width = 0;
1141
1142+ self->priv->show_clock = TRUE;
1143 self->priv->time_mode = SETTINGS_TIME_LOCALE;
1144 self->priv->show_seconds = FALSE;
1145 self->priv->show_date = FALSE;
1146@@ -270,6 +291,11 @@
1147
1148 self->priv->settings = g_settings_new(SETTINGS_INTERFACE);
1149 if (self->priv->settings != NULL) {
1150+ g_settings_bind(self->priv->settings,
1151+ SETTINGS_SHOW_CLOCK_S,
1152+ self,
1153+ PROP_SHOW_CLOCK_S,
1154+ G_SETTINGS_BIND_DEFAULT);
1155 g_settings_bind_with_mapping(self->priv->settings,
1156 SETTINGS_TIME_FORMAT_S,
1157 self,
1158@@ -303,6 +329,11 @@
1159 self,
1160 PROP_SHOW_WEEK_NUMBERS_S,
1161 G_SETTINGS_BIND_DEFAULT);
1162+ g_settings_bind(self->priv->settings,
1163+ SETTINGS_SHOW_CALENDAR_S,
1164+ self,
1165+ PROP_SHOW_CALENDAR_S,
1166+ G_SETTINGS_BIND_DEFAULT);
1167 } else {
1168 g_warning("Unable to get settings for '" SETTINGS_INTERFACE "'");
1169 }
1170@@ -478,6 +509,13 @@
1171 gboolean update = FALSE;
1172
1173 switch(prop_id) {
1174+ case PROP_SHOW_CLOCK: {
1175+ if (g_value_get_boolean(value) != self->priv->show_clock) {
1176+ self->priv->show_clock = g_value_get_boolean(value);
1177+ gtk_widget_set_visible (GTK_WIDGET (self->priv->label), self->priv->show_clock);
1178+ }
1179+ break;
1180+ }
1181 case PROP_TIME_FORMAT: {
1182 gint newval = g_value_get_int(value);
1183 if (newval != self->priv->time_mode) {
1184@@ -541,6 +579,13 @@
1185 }
1186 break;
1187 }
1188+ case PROP_SHOW_CALENDAR: {
1189+ if (g_value_get_boolean(value) != self->priv->show_calendar) {
1190+ self->priv->show_calendar = g_value_get_boolean(value);
1191+ gtk_widget_set_visible (GTK_WIDGET (self->priv->ido_calendar), self->priv->show_calendar);
1192+ }
1193+ break;
1194+ }
1195 default:
1196 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
1197 return;
1198@@ -581,6 +626,9 @@
1199 IndicatorDatetime * self = INDICATOR_DATETIME(object);
1200
1201 switch(prop_id) {
1202+ case PROP_SHOW_CLOCK:
1203+ g_value_set_boolean(value, self->priv->show_clock);
1204+ break;
1205 case PROP_TIME_FORMAT:
1206 g_value_set_int(value, self->priv->time_mode);
1207 break;
1208@@ -599,6 +647,9 @@
1209 case PROP_SHOW_WEEK_NUMBERS:
1210 g_value_set_boolean(value, self->priv->show_week_numbers);
1211 break;
1212+ case PROP_SHOW_CALENDAR:
1213+ g_value_set_boolean(value, self->priv->show_calendar);
1214+ break;
1215 default:
1216 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
1217 return;
1218@@ -762,7 +813,7 @@
1219
1220 if (self->priv->show_seconds ||
1221 (self->priv->time_mode == SETTINGS_TIME_CUSTOM && self->priv->custom_show_seconds)) {
1222- self->priv->timer = g_timeout_add_seconds(1, timer_func, self);
1223+ self->priv->timer = g_timeout_add_full(G_PRIORITY_HIGH, 865, timer_func, self, NULL);
1224 } else {
1225 if (datetime == NULL) {
1226 datetime = g_date_time_new_now_local();
1227@@ -1102,6 +1153,10 @@
1228 ido_calendar_menu_item_unmark_day (IDO_CALENDAR_MENU_ITEM (mi_data), g_variant_get_int16(value));
1229 } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_CLEAR_MARKS)) {
1230 ido_calendar_menu_item_clear_marks (IDO_CALENDAR_MENU_ITEM (mi_data));
1231+ } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_SET_DATE)) {
1232+ gsize size = 3;
1233+ const gint * array = g_variant_get_fixed_array(value, &size, sizeof(gint));
1234+ ido_calendar_menu_item_set_date (IDO_CALENDAR_MENU_ITEM (mi_data), array[0], array[1], array[2]);
1235 } else {
1236 g_warning("Indicator Item property '%s' unknown", prop);
1237 }
1238@@ -1189,15 +1244,54 @@
1239 month_changed_cb (IdoCalendarMenuItem *ido,
1240 gpointer user_data)
1241 {
1242- gchar datestring[20];
1243- guint d,m,y;
1244- DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
1245- ido_calendar_menu_item_get_date(ido, &y, &m, &d);
1246- g_sprintf(datestring, "%d-%d-%d", y, m, d);
1247- GVariant *variant = g_variant_new_string(datestring);
1248- guint timestamp = (guint)time(NULL);
1249- dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "event::month-changed", variant, timestamp);
1250- g_debug("Got month changed signal: %s", datestring);
1251+ guint d,m,y;
1252+ DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
1253+ ido_calendar_menu_item_get_date(ido, &y, &m, &d);
1254+ struct tm date = {0};
1255+ date.tm_mday = d;
1256+ date.tm_mon = m;
1257+ date.tm_year = y - 1900;
1258+ guint selecteddate = (guint)mktime(&date);
1259+ g_debug("Got month changed signal: %s", asctime(&date));
1260+ GVariant *variant = g_variant_new_uint32(selecteddate);
1261+ guint timestamp = (guint)time(NULL);
1262+ dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "month-changed", variant, timestamp);
1263+}
1264+
1265+static void
1266+day_selected_cb (IdoCalendarMenuItem *ido,
1267+ gpointer user_data)
1268+{
1269+ guint d,m,y;
1270+ DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
1271+ ido_calendar_menu_item_get_date(ido, &y, &m, &d);
1272+ struct tm date = {0};
1273+ date.tm_mday = d;
1274+ date.tm_mon = m;
1275+ date.tm_year = y - 1900;
1276+ guint selecteddate = (guint)mktime(&date);
1277+ g_debug("Got day selected signal: %s", asctime(&date));
1278+ GVariant *variant = g_variant_new_uint32(selecteddate);
1279+ guint timestamp = (guint)time(NULL);
1280+ dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "day-selected", variant, timestamp);
1281+}
1282+
1283+static void
1284+day_selected_double_click_cb (IdoCalendarMenuItem *ido,
1285+ gpointer user_data)
1286+{
1287+ guint d,m,y;
1288+ DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
1289+ ido_calendar_menu_item_get_date(ido, &y, &m, &d);
1290+ struct tm date = {0};
1291+ date.tm_mday = d;
1292+ date.tm_mon = m;
1293+ date.tm_year = y - 1900;
1294+ guint selecteddate = (guint)mktime(&date);
1295+ g_debug("Got day selected double click signal: %s", asctime(&date));
1296+ GVariant *variant = g_variant_new_uint32(selecteddate);
1297+ guint timestamp = (guint)time(NULL);
1298+ dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "day-selected-double-click", variant, timestamp);
1299 }
1300
1301 static gboolean
1302@@ -1221,9 +1315,21 @@
1303
1304 IdoCalendarMenuItem *ido = IDO_CALENDAR_MENU_ITEM (ido_calendar_menu_item_new ());
1305 self->priv->ido_calendar = ido;
1306+
1307+ GtkCalendarDisplayOptions flags = ido_calendar_menu_item_get_display_options (self->priv->ido_calendar);
1308+ if (self->priv->show_week_numbers == TRUE)
1309+ flags |= GTK_CALENDAR_SHOW_WEEK_NUMBERS;
1310+ else
1311+ flags &= ~GTK_CALENDAR_SHOW_WEEK_NUMBERS;
1312+ ido_calendar_menu_item_set_display_options (self->priv->ido_calendar, flags);
1313+
1314+ gtk_widget_set_visible (GTK_WIDGET (self->priv->ido_calendar), self->priv->show_calendar);
1315
1316 dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent);
1317 g_signal_connect_after(ido, "month-changed", G_CALLBACK(month_changed_cb), (gpointer)newitem);
1318+ g_signal_connect_after(ido, "day-selected", G_CALLBACK(day_selected_cb), (gpointer)newitem);
1319+ g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem);
1320+
1321 return TRUE;
1322 }
1323
1324@@ -1323,7 +1429,7 @@
1325 g_signal_connect(G_OBJECT(self->priv->label), "screen-changed", G_CALLBACK(update_text_gravity), self);
1326 guess_label_size(self);
1327 update_label(self, NULL);
1328- gtk_widget_show(GTK_WIDGET(self->priv->label));
1329+ gtk_widget_set_visible(GTK_WIDGET (self->priv->label), self->priv->show_clock);
1330 }
1331
1332 if (self->priv->timer == 0) {
1333
1334=== modified file 'src/settings-shared.h'
1335--- src/settings-shared.h 2011-02-25 14:18:57 +0000
1336+++ src/settings-shared.h 2011-03-16 21:26:01 +0000
1337@@ -51,5 +51,9 @@
1338 #define DEFAULT_TIME_24_FORMAT N_("%H:%M")
1339
1340 #define DEFAULT_TIME_FORMAT DEFAULT_TIME_12_FORMAT
1341+#define DEFAULT_TIME_FORMAT_WITH_DAY DEFAULT_TIME_12_FORMAT
1342+
1343+#define DEFAULT_TIME_12_FORMAT_WITH_DAY N_("%a %l:%M %p")
1344+#define DEFAULT_TIME_24_FORMAT_WITH_DAY N_("%a %H:%M")
1345
1346 #endif

Subscribers

People subscribed via source and target branches