From 99d674768ae3679459acb161c60d6fd19062e7c5 Mon Sep 17 00:00:00 2001 From: Viktor Odintsev Date: Wed, 13 Sep 2017 02:00:59 +0300 Subject: [PATCH] Pass socket id to D-Bus service to embed settings window --- panel/main.c | 10 +++------- panel/panel-dbus-client.c | 2 ++ panel/panel-dbus-client.h | 1 + panel/panel-dbus-service-infos.xml | 3 ++- panel/panel-dbus-service.c | 6 ++++-- panel/panel-preferences-dialog.c | 8 +------- panel/panel-preferences-dialog.h | 2 +- 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/panel/main.c b/panel/main.c index b6fa80fb..0b025071 100644 --- a/panel/main.c +++ b/panel/main.c @@ -63,7 +63,7 @@ static gboolean opt_version = FALSE; static gboolean opt_disable_wm_check = FALSE; static gchar *opt_plugin_event = NULL; static gchar **opt_arguments = NULL; -static gchar *opt_socket_id = NULL; +static guint opt_socket_id = 0; @@ -87,7 +87,7 @@ static GOptionEntry option_entries[] = { "disable-wm-check", 'd', 0, G_OPTION_ARG_NONE, &opt_disable_wm_check, N_("Do not wait for a window manager on startup"), NULL }, { "version", 'V', 0, G_OPTION_ARG_NONE, &opt_version, N_("Print version information and exit"), NULL }, { "plugin-event", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_plugin_event, NULL, NULL }, - { "socket-id", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_socket_id, NULL, NULL }, + { "socket-id", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_INT, &opt_socket_id, NULL, NULL }, { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &opt_arguments, NULL, NULL }, { NULL } }; @@ -290,7 +290,7 @@ main (gint argc, gchar **argv) else if (opt_preferences >= 0) { /* send a signal to the running instance to show the preferences dialog */ - succeed = panel_dbus_client_display_preferences_dialog (opt_preferences, &error); + succeed = panel_dbus_client_display_preferences_dialog (opt_preferences, opt_socket_id, &error); goto dbus_return; } else if (opt_add_items >= 0) @@ -372,10 +372,6 @@ main (gint argc, gchar **argv) /* set EWMH source indication */ wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER); - /* open dialog if we started from launch_panel */ - if (opt_preferences >= 0) - panel_preferences_dialog_show_from_id (opt_preferences, opt_socket_id); - gtk_main (); /* make sure there are no incomming events when we close */ diff --git a/panel/panel-dbus-client.c b/panel/panel-dbus-client.c index 5f748f58..16ceff84 100644 --- a/panel/panel-dbus-client.c +++ b/panel/panel-dbus-client.c @@ -64,6 +64,7 @@ panel_dbus_client_get_proxy (GError **error) gboolean panel_dbus_client_display_preferences_dialog (guint active, + guint socket_id, GError **error) { XfcePanelExportedService *dbus_proxy; @@ -77,6 +78,7 @@ panel_dbus_client_display_preferences_dialog (guint active, result = xfce_panel_exported_service_call_display_preferences_dialog_sync (dbus_proxy, active, + socket_id, NULL, error); diff --git a/panel/panel-dbus-client.h b/panel/panel-dbus-client.h index cbd3dde1..fd842b65 100644 --- a/panel/panel-dbus-client.h +++ b/panel/panel-dbus-client.h @@ -23,6 +23,7 @@ #include gboolean panel_dbus_client_display_preferences_dialog (guint active, + guint socket_id, GError **error); gboolean panel_dbus_client_display_items_dialog (guint active, diff --git a/panel/panel-dbus-service-infos.xml b/panel/panel-dbus-service-infos.xml index 42e977d2..e9a4b60f 100644 --- a/panel/panel-dbus-service-infos.xml +++ b/panel/panel-dbus-service-infos.xml @@ -9,7 +9,7 @@ +