diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-04-30 12:34:47 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-04-30 17:50:45 -0400 |
commit | af71917015fc93c0dce5423b6f29e602d8fe751d (patch) | |
tree | c35590faa445c149414590117c3d88224a02ee35 /gtk/gtkapplication.c | |
parent | babd137e325931ee7b791dec8df825ad1262a320 (diff) | |
download | gtk+-af71917015fc93c0dce5423b6f29e602d8fe751d.tar.gz |
GtkApplication: adjust to GApplication changes
GApplication now makes the session bus and object path available as a
public API on the application instance. Use that instead of trying to
guess values for ourselves.
This causes this version of Gtk+ to depend on GLib 2.32.2, so bumping
version dependency accordingly.
https://bugzilla.gnome.org/show_bug.cgi?id=671249
Diffstat (limited to 'gtk/gtkapplication.c')
-rw-r--r-- | gtk/gtkapplication.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index 945e333b1d..06403d39ed 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -149,7 +149,7 @@ struct _GtkApplicationPrivate #ifdef GDK_WINDOWING_X11 GDBusConnection *session_bus; const gchar *application_id; - gchar *object_path; + const gchar *object_path; gchar *app_menu_path; guint app_menu_id; @@ -274,34 +274,13 @@ gtk_application_window_removed_x11 (GtkApplication *application, gtk_application_window_unpublish (GTK_APPLICATION_WINDOW (window)); } -static gchar * -object_path_from_appid (const gchar *appid) -{ - gchar *appid_path, *iter; - - appid_path = g_strconcat ("/", appid, NULL); - for (iter = appid_path; *iter; iter++) - { - if (*iter == '.') - *iter = '/'; - - if (*iter == '-') - *iter = '_'; - } - - return appid_path; -} - static void gtk_application_startup_session_dbus (GtkApplication *app); static void gtk_application_startup_x11 (GtkApplication *application) { - const gchar *application_id; - - application_id = g_application_get_application_id (G_APPLICATION (application)); - application->priv->session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); - application->priv->object_path = object_path_from_appid (application_id); + application->priv->session_bus = g_application_get_dbus_connection (G_APPLICATION (application)); + application->priv->object_path = g_application_get_dbus_object_path (G_APPLICATION (application)); gtk_application_startup_session_dbus (GTK_APPLICATION (application)); } @@ -309,9 +288,8 @@ gtk_application_startup_x11 (GtkApplication *application) static void gtk_application_shutdown_x11 (GtkApplication *application) { - g_free (application->priv->object_path); + application->priv->session_bus = NULL; application->priv->object_path = NULL; - g_clear_object (&application->priv->session_bus); g_clear_object (&application->priv->sm_proxy); g_clear_object (&application->priv->client_proxy); @@ -320,12 +298,6 @@ gtk_application_shutdown_x11 (GtkApplication *application) } const gchar * -gtk_application_get_dbus_object_path (GtkApplication *application) -{ - return application->priv->object_path; -} - -const gchar * gtk_application_get_app_menu_object_path (GtkApplication *application) { return application->priv->app_menu_path; |