[Xfce4-commits] [xfce/xfce4-panel] 01/01: Pass socket id to D-Bus service to embed settings window (Bug #13854)

noreply at xfce.org noreply at xfce.org
Wed Sep 13 23:31:31 CEST 2017


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit ca42838b6f396c5ffa01a37bb891341f517125e2
Author: Viktor Odintsev <ninetls at xfce.org>
Date:   Wed Sep 13 02:00:59 2017 +0300

    Pass socket id to D-Bus service to embed settings window (Bug #13854)
---
 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 b6fa80f..0b02507 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 5f748f5..16ceff8 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 cbd3dde..fd842b6 100644
--- a/panel/panel-dbus-client.h
+++ b/panel/panel-dbus-client.h
@@ -23,6 +23,7 @@
 #include <gdk/gdk.h>
 
 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 42e977d..e9a4b60 100644
--- a/panel/panel-dbus-service-infos.xml
+++ b/panel/panel-dbus-service-infos.xml
@@ -9,7 +9,7 @@
     <annotation name="org.gtk.GDBus.C.Name" value="ExportedService" />
 
     <!--
-      DisplayPreferencesDialog (active : UINT, socket-id : STRING) : VOID
+      DisplayPreferencesDialog (active : UINT, socket-id : UINT) : VOID
 
       active    : The active panel number in the dialog, starting
                   at zero.
@@ -19,6 +19,7 @@
     -->
     <method name="DisplayPreferencesDialog">
       <arg name="active" direction="in" type="u" />
+      <arg name="socket_id" direction="in" type="u" />
     </method>
 
     <!--
diff --git a/panel/panel-dbus-service.c b/panel/panel-dbus-service.c
index c176788..cb2fc0f 100644
--- a/panel/panel-dbus-service.c
+++ b/panel/panel-dbus-service.c
@@ -49,6 +49,7 @@ static void      panel_dbus_service_plugin_event_result        (XfcePanelPluginP
 static gboolean  panel_dbus_service_display_preferences_dialog (XfcePanelExportedService *skeleton,
                                                                 GDBusMethodInvocation    *invocation,
                                                                 guint                     active,
+                                                                guint                     socket_id,
                                                                 PanelDBusService         *service);
 static gboolean  panel_dbus_service_display_items_dialog       (XfcePanelExportedService *skeleton,
                                                                 GDBusMethodInvocation    *invocation,
@@ -196,12 +197,13 @@ static gboolean
 panel_dbus_service_display_preferences_dialog (XfcePanelExportedService *skeleton,
                                                GDBusMethodInvocation    *invocation,
                                                guint                     active,
+                                               guint                     socket_id,
                                                PanelDBusService         *service)
 {
   panel_return_val_if_fail (PANEL_IS_DBUS_SERVICE (service), FALSE);
 
-  /* show the items dialog */
-  panel_item_dialog_show_from_id (active);
+  /* show the preferences dialog */
+  panel_preferences_dialog_show_from_id (active, socket_id);
 
   xfce_panel_exported_service_complete_display_preferences_dialog(skeleton, invocation);
 
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 387c480..c787b3f 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -1513,16 +1513,10 @@ panel_preferences_dialog_show (PanelWindow *active)
 
 void
 panel_preferences_dialog_show_from_id (gint         panel_id,
-                                       const gchar *socket_id)
+                                       Window       socket_window)
 {
   PanelApplication *application;
   PanelWindow      *window;
-  Window            socket_window = 0;
-
-  /* x11 windows are ulong on 64 bit platforms
-   * or uint32 on other platforms */
-  if (socket_id != NULL)
-    socket_window = (Window) strtoul (socket_id, NULL, 0);
 
   application = panel_application_get ();
   window = panel_application_get_window (application, panel_id);
diff --git a/panel/panel-preferences-dialog.h b/panel/panel-preferences-dialog.h
index 792b445..0091cdd 100644
--- a/panel/panel-preferences-dialog.h
+++ b/panel/panel-preferences-dialog.h
@@ -40,7 +40,7 @@ GType      panel_preferences_dialog_get_type     (void) G_GNUC_CONST;
 void       panel_preferences_dialog_show         (PanelWindow *active);
 
 void       panel_preferences_dialog_show_from_id (gint         panel_id,
-                                                  const gchar *socket_id);
+                                                  Window       socket_window);
 
 gboolean   panel_preferences_dialog_visible      (void);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list