Merge lp:~charlesk/indicator-datetime/lp-1246812-13.10 into lp:~indicator-applet-developers/indicator-datetime/trunk.13.10

Proposed by Charles Kerr
Status: Merged
Approved by: Charles Kerr
Approved revision: 282
Merged at revision: 282
Proposed branch: lp:~charlesk/indicator-datetime/lp-1246812-13.10
Merge into: lp:~indicator-applet-developers/indicator-datetime/trunk.13.10
Diff against target: 135 lines (+34/-58)
1 file modified
src/service.c (+34/-58)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/lp-1246812-13.10
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Ted Gould (community) Approve
Review via email: mp+193697@code.launchpad.net

Description of the change

Backport r286 http://bazaar.launchpad.net/~indicator-applet-developers/indicator-datetime/trunk.14.04/revision/286 to fix evolution activation when clicking calendar dates in the greeter profile of indicator-datetime.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Top-approving failed due to Jenkins hiccup.

Approving based on Ted approve and Jenkins' rebuild approve.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/service.c'
2--- src/service.c 2013-10-22 22:01:47 +0000
3+++ src/service.c 2013-11-03 10:47:17 +0000
4@@ -626,64 +626,40 @@
5 create_calendar_state (self));
6 }
7
8-static void
9-add_localtime_menuitem (GMenu * menu,
10- IndicatorDatetimeService * self,
11- const char * time_format,
12- const char * icon_name)
13+static GMenuModel *
14+create_calendar_section (IndicatorDatetimeService * self, int profile)
15 {
16+ const gboolean allow_activation = (profile == PROFILE_PHONE) || (profile == PROFILE_DESKTOP);
17+ GMenu * menu;
18 GDateTime * now;
19 char * label;
20- GMenuItem * menu_item;
21-
22+ GMenuItem * item;
23+
24+ menu = g_menu_new ();
25+
26+ /* add a menuitem that shows the current date & time */
27 now = indicator_datetime_service_get_localtime (self);
28- label = g_date_time_format (now, time_format);
29- menu_item = g_menu_item_new (label, NULL);
30- if (icon_name && *icon_name)
31- g_menu_item_set_attribute (menu_item, G_MENU_ATTRIBUTE_ICON, "s", icon_name);
32- g_menu_item_set_action_and_target_value (menu_item, "indicator.activate-planner", g_variant_new_int64(0));
33- g_menu_append_item (menu, menu_item);
34-
35- g_object_unref (menu_item);
36+ label = g_date_time_format (now, _("%A, %e %B %Y"));
37+ item = g_menu_item_new (label, NULL);
38+ g_menu_item_set_attribute (item, G_MENU_ATTRIBUTE_ICON, "s", "calendar");
39+ if (allow_activation)
40+ g_menu_item_set_action_and_target_value (item, "indicator.activate-planner", g_variant_new_int64(0));
41+ g_menu_append_item (menu, item);
42+ g_object_unref (item);
43 g_free (label);
44 g_date_time_unref (now);
45-}
46-
47-static void
48-add_calendar_menuitem (GMenu * menu)
49-{
50- GMenuItem * menu_item;
51-
52- menu_item = g_menu_item_new ("[calendar]", NULL);
53- g_menu_item_set_action_and_target_value (menu_item, "indicator.calendar", g_variant_new_int64(0));
54- g_menu_item_set_attribute (menu_item, "x-canonical-type", "s", "com.canonical.indicator.calendar");
55- g_menu_item_set_attribute (menu_item, "activation-action", "s", "indicator.activate-planner");
56-
57- g_menu_append_item (menu, menu_item);
58- g_object_unref (menu_item);
59-}
60-
61-static GMenuModel *
62-create_desktop_calendar_section (IndicatorDatetimeService * self)
63-{
64- GMenu * menu = g_menu_new ();
65-
66- /* strftime(3) format string to show the day of the week and the date */
67- add_localtime_menuitem (menu, self, _("%A, %e %B %Y"), "calendar");
68-
69- if (g_settings_get_boolean (self->priv->settings, SETTINGS_SHOW_CALENDAR_S))
70- add_calendar_menuitem (menu);
71-
72- return G_MENU_MODEL (menu);
73-}
74-
75-static GMenuModel *
76-create_phone_calendar_section (IndicatorDatetimeService * self)
77-{
78- GMenu * menu = g_menu_new ();
79-
80- /* strftime(3) format string to show date */
81- add_localtime_menuitem (menu, self, _("%A, %e %B %Y"), "calendar");
82+
83+ /* add a menuitem that shows the current date & time */
84+ if ((profile == PROFILE_DESKTOP) || (profile == PROFILE_GREETER))
85+ {
86+ item = g_menu_item_new ("[calendar]", NULL);
87+ g_menu_item_set_action_and_target_value (item, "indicator.calendar", g_variant_new_int64(0));
88+ g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.calendar");
89+ if (allow_activation)
90+ g_menu_item_set_attribute (item, "activation-action", "s", "indicator.activate-planner");
91+ g_menu_append_item (menu, item);
92+ g_object_unref (item);
93+ }
94
95 return G_MENU_MODEL (menu);
96 }
97@@ -1277,14 +1253,14 @@
98 switch (profile)
99 {
100 case PROFILE_PHONE:
101- sections[n++] = create_phone_calendar_section (self);
102+ sections[n++] = create_calendar_section (self, profile);
103 sections[n++] = create_phone_appointments_section (self);
104 sections[n++] = create_phone_settings_section (self);
105 header_action = "indicator.phone-header";
106 break;
107
108 case PROFILE_DESKTOP:
109- sections[n++] = create_desktop_calendar_section (self);
110+ sections[n++] = create_calendar_section (self, profile);
111 sections[n++] = create_desktop_appointments_section (self);
112 sections[n++] = create_locations_section (self);
113 sections[n++] = create_desktop_settings_section (self);
114@@ -1292,7 +1268,7 @@
115 break;
116
117 case PROFILE_GREETER:
118- sections[n++] = create_desktop_calendar_section (self);
119+ sections[n++] = create_calendar_section (self, profile);
120 header_action = "indicator.desktop-header";
121 break;
122 }
123@@ -1495,9 +1471,9 @@
124
125 if (sections & SECTION_CALENDAR)
126 {
127- rebuild_section (phone->submenu, 0, create_phone_calendar_section (self));
128- rebuild_section (desktop->submenu, 0, create_desktop_calendar_section (self));
129- rebuild_section (greeter->submenu, 0, create_desktop_calendar_section (self));
130+ rebuild_section (phone->submenu, 0, create_calendar_section(self, PROFILE_PHONE));
131+ rebuild_section (desktop->submenu, 0, create_calendar_section(self, PROFILE_DESKTOP));
132+ rebuild_section (greeter->submenu, 0, create_calendar_section(self, PROFILE_GREETER));
133 }
134
135 if (sections & SECTION_APPOINTMENTS)

Subscribers

People subscribed via source and target branches