aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datetime-prefs.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 5248911..f38a863 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -225,7 +225,8 @@ tz_query_answered (GObject *object, GAsyncResult *res, gpointer user_data)
g_variant_unref (answers);
}
-void proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+static void
+proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
{
GError * error = NULL;
@@ -244,6 +245,35 @@ void proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
NULL, tz_query_answered, NULL);
}
+static void
+service_name_owner_changed (GDBusProxy * proxy, GParamSpec *pspec, gpointer user_data)
+{
+ GtkWidget * widget = GTK_WIDGET (user_data);
+ gchar * owner = g_dbus_proxy_get_name_owner (proxy);
+
+ gtk_widget_set_sensitive (widget, (owner != NULL));
+
+ g_free (owner);
+}
+
+static void
+service_proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+{
+ GError * error = NULL;
+
+ proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+
+ if (error != NULL) {
+ g_critical("Could not grab DBus proxy for indicator-datetime-service: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
+ /* And now, do initial proxy configuration */
+ g_signal_connect (proxy, "notify::g-name-owner", G_CALLBACK (service_name_owner_changed), user_data);
+ service_name_owner_changed (proxy, NULL, user_data);
+}
+
static gboolean
are_spinners_focused (void)
{
@@ -634,6 +664,17 @@ create_dialog (void)
"org.gnome.SettingsDaemon.DateTimeMechanism",
NULL, proxy_ready, NULL);
+ /* Grab proxy for datetime service, to see if it's running. It would
+ actually be more ideal to see if the indicator module itself is running,
+ but that doesn't yet claim a name on the bus. Presumably the service
+ would have been started by any such indicator, so this will at least tell
+ us if there *was* a datetime module run this session. */
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, NULL,
+ "com.canonical.indicator.datetime",
+ "/com/canonical/indicator/datetime/service",
+ "com.canonical.indicator.datetime.service",
+ NULL, service_proxy_ready, WIG ("showClockCheck"));
+
#undef WIG
g_object_unref (conf);
@@ -678,7 +719,6 @@ main (int argc, char ** argv)
unique_app_watch_window (app, GTK_WINDOW (dlg));
gtk_widget_show_all (dlg);
- g_signal_connect (dlg, "response", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect (dlg, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_main ();
}