[Xfce4-commits] <xfce4-xkb-plugin:master> Use garcon to launch xfce4-keyboard-settings

Igor Slepchin noreply at xfce.org
Thu Apr 18 23:08:01 CEST 2013


Updating branch refs/heads/master
         to b98b82d8522842e38a6355f9144f8348a6ab2aeb (commit)
       from 08d0031eba52c88d653ea96aa245eaf286ef81d2 (commit)

commit b98b82d8522842e38a6355f9144f8348a6ab2aeb
Author: Igor Slepchin <igor.slepchin at gmail.com>
Date:   Wed Apr 3 18:08:31 2013 -0400

    Use garcon to launch xfce4-keyboard-settings
    
    Some users reported that selecting "Keyboard settings" from
    plugin menu adds a launcher for xfce-keyboard-settings to the panel
    instead of launching the keyboard-settings dialog. This commit is
    supposed to fix that.

 configure.in.in                 |    1 +
 panel-plugin/Makefile.am        |    4 +++-
 panel-plugin/xfce4-xkb-plugin.c |   26 +++++++++++++++++++++-----
 3 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index f57a901..9ea867e 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -79,6 +79,7 @@ XDT_CHECK_PACKAGE([LIBRSVG], [librsvg-2.0], [2.18])
 dnl check librsvg version to see if including headers other than rsvg.h is deprecated
 XDT_CHECK_OPTIONAL_PACKAGE([LIBRSVG_2_36_2], [librsvg-2.0], [2.36.2], [librsvg_2.36.2], [deprecated includes of librsvg header files (always leave enabled)], yes)
 XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-1.0], [2.12])
+XDT_CHECK_PACKAGE([GARCON], [garcon-1], [0.1.5])
 
 dnl ***********************************
 dnl *** Check for debugging support ***
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 4a4bccd..a4bb4c3 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -28,10 +28,11 @@ xfce4_xkb_plugin_CFLAGS =								\
 	@LIBXKLAVIER_CFLAGS@								\
 	@LIBRSVG_CFLAGS@								\
 	@LIBWNCK_CFLAGS@								\
+	@GARCON_CFLAGS@								\
 	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"						\
 	-DFLAGSDIR=\"$(datadir)/xfce4/xkb/flags\"					\
 	-DWNCK_I_KNOW_THIS_IS_UNSTABLE
-	
+
 
 xfce4_xkb_plugin_LDADD = 								\
 	@LIBXFCE4PANEL_LIBS@								\
@@ -40,6 +41,7 @@ xfce4_xkb_plugin_LDADD = 								\
 	@LIBXFCE4UTIL_LIBS@								\
 	@LIBXKLAVIER_LIBS@								\
 	@LIBWNCK_LIBS@									\
+	@GARCON_LIBS@									\
 	@LIBRSVG_LIBS@
 
 #
diff --git a/panel-plugin/xfce4-xkb-plugin.c b/panel-plugin/xfce4-xkb-plugin.c
index 87770a9..52a1e96 100644
--- a/panel-plugin/xfce4-xkb-plugin.c
+++ b/panel-plugin/xfce4-xkb-plugin.c
@@ -33,6 +33,7 @@
 #include <libwnck/libwnck.h>
 
 #include <librsvg/rsvg.h>
+#include <garcon/garcon.h>
 
 #include "xfce4-xkb-plugin.h"
 #include "xfce4-xkb-plugin-private.h"
@@ -460,10 +461,25 @@ xfce_xkb_configure_layout (GtkWidget *widget,
 {
     gchar *desktop_file = xfce_resource_lookup (XFCE_RESOURCE_DATA,
                                  "applications/xfce-keyboard-settings.desktop");
-    gchar command[1024];
-    snprintf (command, sizeof (command), "exo-open %s", desktop_file);
-    command[sizeof (command) - 1] = '\0';
-    xfce_spawn_command_line_on_screen (gdk_screen_get_default (),
-                                       command, False, True, NULL);
+
+    GarconMenuItem *item = garcon_menu_item_new_for_path (desktop_file);
+    if (item)
+    {
+          GError  *error = NULL;
+          gchar  **argv;
+          gboolean succeed;
+          g_shell_parse_argv (garcon_menu_item_get_command (item), NULL, &argv, &error);
+          succeed = xfce_spawn_on_screen (gtk_widget_get_screen (GTK_WIDGET (widget)),
+                                garcon_menu_item_get_path (item),
+                                argv, NULL, G_SPAWN_SEARCH_PATH,
+                                garcon_menu_item_supports_startup_notification (item),
+                                gtk_get_current_event_time (),
+                                garcon_menu_item_get_icon_name (item),
+                                &error);
+          g_strfreev (argv);
+          garcon_menu_item_unref (item);
+          g_assert (succeed);
+
+    }
     g_free (desktop_file);
 }


More information about the Xfce4-commits mailing list