From 7364cf8dcb250e69748cdf077556778dd60a5f1d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 25 Jul 2013 13:08:34 -0500 Subject: for the phone menu, add a 'Time & Date settings...' menuitem to launch 'system-settings time-date' --- data/com.canonical.indicator.datetime | 2 +- src/service.c | 38 ++++++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/data/com.canonical.indicator.datetime b/data/com.canonical.indicator.datetime index f1b5304..b26b5ec 100644 --- a/data/com.canonical.indicator.datetime +++ b/data/com.canonical.indicator.datetime @@ -10,5 +10,5 @@ ObjectPath=/com/canonical/indicator/datetime/desktop ObjectPath=/com/canonical/indicator/datetime/desktop_greeter [phone] -ObjectPath=/com/canonical/indicator/datetime/desktop +ObjectPath=/com/canonical/indicator/datetime/phone diff --git a/src/service.c b/src/service.c index b270e89..4a7dedf 100644 --- a/src/service.c +++ b/src/service.c @@ -1133,10 +1133,18 @@ on_set_location (GSimpleAction * a G_GNUC_UNUSED, ***/ static GMenuModel * -create_settings_section (IndicatorDatetimeService * self G_GNUC_UNUSED) +create_desktop_settings_section (IndicatorDatetimeService * self G_GNUC_UNUSED) { GMenu * menu = g_menu_new (); - g_menu_append (menu, _("Date & Time Settings…"), "indicator.activate-settings"); + g_menu_append (menu, _("Date & Time Settings…"), "indicator.activate-desktop-settings"); + return G_MENU_MODEL (menu); +} + +static GMenuModel * +create_phone_settings_section (IndicatorDatetimeService * self G_GNUC_UNUSED) +{ + GMenu * menu = g_menu_new (); + g_menu_append (menu, _("Time & Date settings…"), "indicator.activate-phone-settings"); return G_MENU_MODEL (menu); } @@ -1156,13 +1164,14 @@ create_menu (IndicatorDatetimeService * self, int profile) switch (profile) { case PROFILE_PHONE: + sections[n++] = create_phone_settings_section (self); break; case PROFILE_DESKTOP: sections[n++] = create_calendar_section (self); sections[n++] = create_appointments_section (self); sections[n++] = create_locations_section (self); - sections[n++] = create_settings_section (self); + sections[n++] = create_desktop_settings_section (self); break; case PROFILE_GREETER: @@ -1210,15 +1219,15 @@ execute_command (const gchar * cmd) if (!g_spawn_command_line_async (cmd, &err)) { - g_warning ("Unable to start %s: %s", cmd, err->message); + g_warning ("Unable to start \"%s\": %s", cmd, err->message); g_error_free (err); } } static void -on_settings_activated (GSimpleAction * a G_GNUC_UNUSED, - GVariant * param G_GNUC_UNUSED, - gpointer gself G_GNUC_UNUSED) +on_desktop_settings_activated (GSimpleAction * a G_GNUC_UNUSED, + GVariant * param G_GNUC_UNUSED, + gpointer gself G_GNUC_UNUSED) { #ifdef HAVE_CCPANEL execute_command ("gnome-control-center indicator-datetime"); @@ -1227,6 +1236,14 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED, #endif } +static void +on_phone_settings_activated (GSimpleAction * a G_GNUC_UNUSED, + GVariant * param G_GNUC_UNUSED, + gpointer gself G_GNUC_UNUSED) +{ + execute_command ("system-settings time-date"); +} + static void on_activate_planner (GSimpleAction * a G_GNUC_UNUSED, GVariant * param, @@ -1278,7 +1295,8 @@ init_gactions (IndicatorDatetimeService * self) priv_t * p = self->priv; GActionEntry entries[] = { - { "activate-settings", on_settings_activated }, + { "activate-desktop-settings", on_desktop_settings_activated }, + { "activate-phone-settings", on_phone_settings_activated }, { "activate-planner", on_activate_planner, "x", NULL }, { "set-location", on_set_location, "s" } }; @@ -1328,6 +1346,7 @@ static void rebuild_now (IndicatorDatetimeService * self, int sections) { priv_t * p = self->priv; + struct ProfileMenuInfo * phone = &p->menus[PROFILE_PHONE]; struct ProfileMenuInfo * desktop = &p->menus[PROFILE_DESKTOP]; struct ProfileMenuInfo * greeter = &p->menus[PROFILE_GREETER]; @@ -1354,7 +1373,8 @@ rebuild_now (IndicatorDatetimeService * self, int sections) if (sections & SECTION_SETTINGS) { - rebuild_section (desktop->submenu, 3, create_settings_section (self)); + rebuild_section (phone->submenu, 0, create_phone_settings_section (self)); + rebuild_section (desktop->submenu, 3, create_desktop_settings_section (self)); } } -- cgit v1.2.3