Merge lp:~larsu/indicator-datetime/reset-date into lp:indicator-datetime/14.04

Proposed by Lars Karlitski
Status: Merged
Approved by: Charles Kerr
Approved revision: 296
Merged at revision: 296
Proposed branch: lp:~larsu/indicator-datetime/reset-date
Merge into: lp:indicator-datetime/14.04
Diff against target: 43 lines (+18/-1)
1 file modified
src/service.c (+18/-1)
To merge this branch: bzr merge lp:~larsu/indicator-datetime/reset-date
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Information
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+203736@code.launchpad.net

Description of the change

Set calendar to the current date when the menu is popped up

This makes use of the "submenu-action" attribute to get notified when the menu is popped up.

Charles, if your big refactoring-branch should land before this, do you mind adapting this patch for that? Thanks

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
Charles Kerr (charlesk) wrote :

The code looks fine and it works. Thanks larsu :)

review: Approve
Revision history for this message
Sebastien Bacher (seb128) wrote :

What happens if you run that code without the new libindicator version? (or asked differently, should we update the depends on libindicator?)

review: Needs Information
Revision history for this message
Lars Karlitski (larsu) wrote :

The old libindicator will simply ignore the new menu item attribute. I don't think we need to bump the dependency.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Great, I just wanted to make sure, thanks

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 2014-01-21 21:47:02 +0000
+++ src/service.c 2014-01-29 13:32:47 +0000
@@ -1359,6 +1359,21 @@
1359 g_free (zone);1359 g_free (zone);
1360}1360}
13611361
1362static void
1363on_calendar_active_changed (GSimpleAction *action G_GNUC_UNUSED,
1364 GVariant *state,
1365 gpointer user_data)
1366{
1367 IndicatorDatetimeService *self = user_data;
1368
1369 /* reset the date when the menu is shown */
1370 if (g_variant_get_boolean (state) && self->priv->calendar_date)
1371 {
1372 g_clear_pointer (&self->priv->calendar_date, g_date_time_unref);
1373 update_calendar_action_state (self);
1374 }
1375}
1376
1362/***1377/***
1363****1378****
1364***/1379***/
@@ -1431,6 +1446,7 @@
1431 g_menu_item_set_attribute (header, "x-canonical-type",1446 g_menu_item_set_attribute (header, "x-canonical-type",
1432 "s", "com.canonical.indicator.root");1447 "s", "com.canonical.indicator.root");
1433 g_menu_item_set_submenu (header, G_MENU_MODEL (submenu));1448 g_menu_item_set_submenu (header, G_MENU_MODEL (submenu));
1449 g_menu_item_set_attribute (header, "submenu-action", "s", "indicator.calendar-active");
1434 g_object_unref (submenu);1450 g_object_unref (submenu);
14351451
1436 /* add header to the menu */1452 /* add header to the menu */
@@ -1586,7 +1602,8 @@
1586 { "activate-phone-clock-app", on_phone_clock_activated },1602 { "activate-phone-clock-app", on_phone_clock_activated },
1587 { "activate-planner", on_activate_planner, "x", NULL },1603 { "activate-planner", on_activate_planner, "x", NULL },
1588 { "activate-appointment", on_activate_appointment, "s", NULL },1604 { "activate-appointment", on_activate_appointment, "s", NULL },
1589 { "set-location", on_set_location, "s" }1605 { "set-location", on_set_location, "s" },
1606 { "calendar-active", NULL, NULL, "false", on_calendar_active_changed }
1590 };1607 };
15911608
1592 p->actions = g_simple_action_group_new ();1609 p->actions = g_simple_action_group_new ();

Subscribers

People subscribed via source and target branches