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
This commit is contained in:
@@ -39,7 +39,7 @@ AC_CONFIG_AUX_DIR([build-aux])
|
||||
m4_define([gtk_binary_version], [3.0.0])
|
||||
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.32.0])
|
||||
m4_define([glib_required_version], [2.33.1])
|
||||
m4_define([pango_required_version], [1.30.0])
|
||||
m4_define([atk_required_version], [2.2.0])
|
||||
m4_define([cairo_required_version], [1.10.0])
|
||||
|
||||
@@ -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);
|
||||
@@ -319,12 +297,6 @@ gtk_application_shutdown_x11 (GtkApplication *application)
|
||||
g_free (application->priv->client_path);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -43,8 +43,6 @@ GActionObservable * gtk_application_window_get_observable (GtkAppl
|
||||
G_GNUC_INTERNAL
|
||||
GtkAccelGroup * gtk_application_window_get_accel_group (GtkApplicationWindow *window);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
const gchar * gtk_application_get_dbus_object_path (GtkApplication *application);
|
||||
G_GNUC_INTERNAL
|
||||
const gchar * gtk_application_get_app_menu_object_path (GtkApplication *application);
|
||||
G_GNUC_INTERNAL
|
||||
|
||||
@@ -777,7 +777,7 @@ gtk_application_window_real_realize (GtkWidget *widget)
|
||||
g_dbus_connection_get_unique_name (window->priv->session));
|
||||
|
||||
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_APPLICATION_OBJECT_PATH",
|
||||
gtk_application_get_dbus_object_path (application));
|
||||
g_application_get_dbus_object_path (G_APPLICATION (application)));
|
||||
|
||||
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_WINDOW_OBJECT_PATH",
|
||||
window->priv->object_path);
|
||||
|
||||
Reference in New Issue
Block a user