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
=== modified file 'src/service.c'
--- src/service.c 2013-10-22 22:01:47 +0000
+++ src/service.c 2013-11-03 10:47:17 +0000
@@ -626,64 +626,40 @@
626 create_calendar_state (self));626 create_calendar_state (self));
627}627}
628628
629static void629static GMenuModel *
630add_localtime_menuitem (GMenu * menu,630create_calendar_section (IndicatorDatetimeService * self, int profile)
631 IndicatorDatetimeService * self,
632 const char * time_format,
633 const char * icon_name)
634{631{
632 const gboolean allow_activation = (profile == PROFILE_PHONE) || (profile == PROFILE_DESKTOP);
633 GMenu * menu;
635 GDateTime * now;634 GDateTime * now;
636 char * label;635 char * label;
637 GMenuItem * menu_item;636 GMenuItem * item;
638637
638 menu = g_menu_new ();
639
640 /* add a menuitem that shows the current date & time */
639 now = indicator_datetime_service_get_localtime (self);641 now = indicator_datetime_service_get_localtime (self);
640 label = g_date_time_format (now, time_format);642 label = g_date_time_format (now, _("%A, %e %B %Y"));
641 menu_item = g_menu_item_new (label, NULL);643 item = g_menu_item_new (label, NULL);
642 if (icon_name && *icon_name)644 g_menu_item_set_attribute (item, G_MENU_ATTRIBUTE_ICON, "s", "calendar");
643 g_menu_item_set_attribute (menu_item, G_MENU_ATTRIBUTE_ICON, "s", icon_name);645 if (allow_activation)
644 g_menu_item_set_action_and_target_value (menu_item, "indicator.activate-planner", g_variant_new_int64(0));646 g_menu_item_set_action_and_target_value (item, "indicator.activate-planner", g_variant_new_int64(0));
645 g_menu_append_item (menu, menu_item);647 g_menu_append_item (menu, item);
646648 g_object_unref (item);
647 g_object_unref (menu_item);
648 g_free (label);649 g_free (label);
649 g_date_time_unref (now);650 g_date_time_unref (now);
650}651
651652 /* add a menuitem that shows the current date & time */
652static void653 if ((profile == PROFILE_DESKTOP) || (profile == PROFILE_GREETER))
653add_calendar_menuitem (GMenu * menu)654 {
654{655 item = g_menu_item_new ("[calendar]", NULL);
655 GMenuItem * menu_item;656 g_menu_item_set_action_and_target_value (item, "indicator.calendar", g_variant_new_int64(0));
656657 g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.calendar");
657 menu_item = g_menu_item_new ("[calendar]", NULL);658 if (allow_activation)
658 g_menu_item_set_action_and_target_value (menu_item, "indicator.calendar", g_variant_new_int64(0));659 g_menu_item_set_attribute (item, "activation-action", "s", "indicator.activate-planner");
659 g_menu_item_set_attribute (menu_item, "x-canonical-type", "s", "com.canonical.indicator.calendar");660 g_menu_append_item (menu, item);
660 g_menu_item_set_attribute (menu_item, "activation-action", "s", "indicator.activate-planner");661 g_object_unref (item);
661662 }
662 g_menu_append_item (menu, menu_item);
663 g_object_unref (menu_item);
664}
665
666static GMenuModel *
667create_desktop_calendar_section (IndicatorDatetimeService * self)
668{
669 GMenu * menu = g_menu_new ();
670
671 /* strftime(3) format string to show the day of the week and the date */
672 add_localtime_menuitem (menu, self, _("%A, %e %B %Y"), "calendar");
673
674 if (g_settings_get_boolean (self->priv->settings, SETTINGS_SHOW_CALENDAR_S))
675 add_calendar_menuitem (menu);
676
677 return G_MENU_MODEL (menu);
678}
679
680static GMenuModel *
681create_phone_calendar_section (IndicatorDatetimeService * self)
682{
683 GMenu * menu = g_menu_new ();
684
685 /* strftime(3) format string to show date */
686 add_localtime_menuitem (menu, self, _("%A, %e %B %Y"), "calendar");
687663
688 return G_MENU_MODEL (menu);664 return G_MENU_MODEL (menu);
689}665}
@@ -1277,14 +1253,14 @@
1277 switch (profile)1253 switch (profile)
1278 {1254 {
1279 case PROFILE_PHONE:1255 case PROFILE_PHONE:
1280 sections[n++] = create_phone_calendar_section (self);1256 sections[n++] = create_calendar_section (self, profile);
1281 sections[n++] = create_phone_appointments_section (self);1257 sections[n++] = create_phone_appointments_section (self);
1282 sections[n++] = create_phone_settings_section (self);1258 sections[n++] = create_phone_settings_section (self);
1283 header_action = "indicator.phone-header";1259 header_action = "indicator.phone-header";
1284 break;1260 break;
12851261
1286 case PROFILE_DESKTOP:1262 case PROFILE_DESKTOP:
1287 sections[n++] = create_desktop_calendar_section (self);1263 sections[n++] = create_calendar_section (self, profile);
1288 sections[n++] = create_desktop_appointments_section (self);1264 sections[n++] = create_desktop_appointments_section (self);
1289 sections[n++] = create_locations_section (self);1265 sections[n++] = create_locations_section (self);
1290 sections[n++] = create_desktop_settings_section (self);1266 sections[n++] = create_desktop_settings_section (self);
@@ -1292,7 +1268,7 @@
1292 break;1268 break;
12931269
1294 case PROFILE_GREETER:1270 case PROFILE_GREETER:
1295 sections[n++] = create_desktop_calendar_section (self);1271 sections[n++] = create_calendar_section (self, profile);
1296 header_action = "indicator.desktop-header";1272 header_action = "indicator.desktop-header";
1297 break;1273 break;
1298 }1274 }
@@ -1495,9 +1471,9 @@
14951471
1496 if (sections & SECTION_CALENDAR)1472 if (sections & SECTION_CALENDAR)
1497 {1473 {
1498 rebuild_section (phone->submenu, 0, create_phone_calendar_section (self));1474 rebuild_section (phone->submenu, 0, create_calendar_section(self, PROFILE_PHONE));
1499 rebuild_section (desktop->submenu, 0, create_desktop_calendar_section (self));1475 rebuild_section (desktop->submenu, 0, create_calendar_section(self, PROFILE_DESKTOP));
1500 rebuild_section (greeter->submenu, 0, create_desktop_calendar_section (self));1476 rebuild_section (greeter->submenu, 0, create_calendar_section(self, PROFILE_GREETER));
1501 }1477 }
15021478
1503 if (sections & SECTION_APPOINTMENTS)1479 if (sections & SECTION_APPOINTMENTS)

Subscribers

People subscribed via source and target branches