aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-07-25 13:08:34 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-07-25 13:08:34 -0500
commit7364cf8dcb250e69748cdf077556778dd60a5f1d (patch)
tree71035367a9e913a49b7f20b5c07f760ab88b8aeb
parent909eac7b7007ed089596324d0df4485fbafb9e48 (diff)
downloadayatana-indicator-datetime-7364cf8dcb250e69748cdf077556778dd60a5f1d.tar.gz
ayatana-indicator-datetime-7364cf8dcb250e69748cdf077556778dd60a5f1d.tar.bz2
ayatana-indicator-datetime-7364cf8dcb250e69748cdf077556778dd60a5f1d.zip
for the phone menu, add a 'Time & Date settings...' menuitem to launch 'system-settings time-date'
-rw-r--r--data/com.canonical.indicator.datetime2
-rw-r--r--src/service.c38
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");
@@ -1228,6 +1237,14 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED,
}
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,
gpointer gself)
@@ -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));
}
}