Merge lp:~karl-qdh/indicator-datetime/onlyenabledcalendars into lp:indicator-datetime/0.3

Proposed by Karl Lattimer
Status: Merged
Merged at revision: 100
Proposed branch: lp:~karl-qdh/indicator-datetime/onlyenabledcalendars
Merge into: lp:indicator-datetime/0.3
Diff against target: 108 lines (+30/-5)
2 files modified
configure.ac (+7/-4)
src/datetime-service.c (+23/-1)
To merge this branch: bzr merge lp:~karl-qdh/indicator-datetime/onlyenabledcalendars
Reviewer Review Type Date Requested Status
Ted Gould Pending
Review via email: mp+56151@code.launchpad.net

Description of the change

working patch to show only enabled calendars

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 'configure.ac'
2--- configure.ac 2011-03-23 21:03:40 +0000
3+++ configure.ac 2011-04-04 12:56:34 +0000
4@@ -66,6 +66,7 @@
5 GLIB_REQUIRED_VERSION=2.26
6 GTK_REQUIRED_VERSION=2.12
7 GTK3_REQUIRED_VERSION=3.0
8+GCONF_REQUIRED_VERSION=2.31
9
10 AS_IF([test "x$with_gtk" = x3],
11 [PKG_CHECK_MODULES(INDICATOR, indicator3 >= $INDICATOR_REQUIRED_VERSION
12@@ -86,7 +87,7 @@
13
14 AS_IF([test "x$with_gtk" = x3],
15 [PKG_CHECK_MODULES(SERVICE, indicator >= $INDICATOR_REQUIRED_VERSION
16- glib-2.0 >= $GLIB_REQUIRED_VERSION
17+ glib-2.0 >= $GLIB_REQUIRED_VERSION
18 dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
19 dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
20 libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
21@@ -97,11 +98,12 @@
22 libedataserver-1.2 >= EDS_REQUIRED_VERSION
23 libedataserverui-1.2 >= EDS_REQUIRED_VERSION
24 cairo >= CAIRO_REQUIRED_VERSION
25- gdk-2.0 >= GDK_REQUIRED_VERSION)
26+ gdk-2.0 >= GDK_REQUIRED_VERSION
27+ gconf-2.0 >= GCONF_REQUIRED_VERSION)
28 ],
29 [test "x$with_gtk" = x2],
30 [PKG_CHECK_MODULES(SERVICE, indicator >= $INDICATOR_REQUIRED_VERSION
31- glib-2.0 >= $GLIB_REQUIRED_VERSION
32+ glib-2.0 >= $GLIB_REQUIRED_VERSION
33 dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION
34 dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION
35 libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
36@@ -112,7 +114,8 @@
37 libedataserver-1.2 >= EDS_REQUIRED_VERSION
38 libedataserverui-1.2 >= EDS_REQUIRED_VERSION
39 cairo >= CAIRO_REQUIRED_VERSION
40- gdk-2.0 >= GDK_REQUIRED_VERSION)
41+ gdk-2.0 >= GDK_REQUIRED_VERSION
42+ gconf-2.0 >= GCONF_REQUIRED_VERSION)
43 ],
44 [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])]
45 )
46
47=== modified file 'src/datetime-service.c'
48--- src/datetime-service.c 2011-03-30 21:55:14 +0000
49+++ src/datetime-service.c 2011-04-04 12:56:34 +0000
50@@ -28,6 +28,7 @@
51 #include <glib/gi18n.h>
52 #include <gio/gio.h>
53 #include <math.h>
54+#include <gconf/gconf-client.h>
55
56 #include <libdbusmenu-gtk/menuitem.h>
57 #include <libdbusmenu-glib/server.h>
58@@ -82,6 +83,7 @@
59 static gboolean updating_appointments = FALSE;
60 static time_t start_time_appointments = (time_t) 0;
61 GSettings *conf;
62+GConfClient* gconf;
63
64
65 /* Geoclue trackers */
66@@ -698,7 +700,13 @@
67 comp_instances = NULL;
68 }
69 }
70-
71+ GSList *cal_list = gconf_client_get_list(gconf, "/apps/evolution/calendar/display/selected_calendars", GCONF_VALUE_STRING, &gerror);
72+ if (gerror) {
73+ g_debug("Failed to get evolution preference for enabled calendars");
74+ g_error_free(gerror);
75+ gerror = NULL;
76+ cal_list = NULL;
77+ }
78 // Generate instances for all sources
79 for (g = e_source_list_peek_groups (sources); g; g = g->next) {
80 ESourceGroup *group = E_SOURCE_GROUP (g->data);
81@@ -716,6 +724,18 @@
82 gerror = NULL;
83 continue;
84 }
85+ const gchar *ecal_uid = e_source_peek_uid(source);
86+ gboolean match = FALSE;
87+ g_debug("Checking ecal_uid is enabled: %s", ecal_uid);
88+ for (i = 0; i<g_slist_length(cal_list);i++) {
89+ char *cuid = (char *)g_slist_nth_data(cal_list, i);
90+ if (g_strcmp0(cuid, ecal_uid) == 0) {
91+ match = TRUE;
92+ break;
93+ }
94+ }
95+ if (!match) continue;
96+ g_debug("ecal_uid is enabled, generating instances");
97
98 e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, (gpointer) source);
99 }
100@@ -1300,6 +1320,8 @@
101
102 /* Set up GSettings */
103 conf = g_settings_new(SETTINGS_INTERFACE);
104+ /* Set up gconf for getting evolution enabled calendars */
105+ gconf = gconf_client_get_default();
106 // TODO Add a signal handler to catch gsettings changes and respond to them
107
108 /* Building the base menu */

Subscribers

People subscribed via source and target branches