[Xfce4-commits] <xfce4-panel:master> Applicationmenu: Support XDG_CURRENT_DESKTOP (bug #7444).
Nick Schermer
noreply at xfce.org
Fri Apr 22 11:30:01 CEST 2011
Updating branch refs/heads/master
to 85268551b1358c3d4412f4699c2e35f494d8b222 (commit)
from a8a298adf45940a3f1c1da081be4264f799fb3c1 (commit)
commit 85268551b1358c3d4412f4699c2e35f494d8b222
Author: Nick Schermer <nick at xfce.org>
Date: Fri Apr 22 10:34:52 2011 +0200
Applicationmenu: Support XDG_CURRENT_DESKTOP (bug #7444).
Not really a spec, but a nice addition for people to use
the Xfce Panel in other desktop's. You can show all menu
applications with XDG_CURRENT_DESKTOP="" or for example
every Gnome app with XDG_CURRENT_DESKTOP="GNOME". If the
value is unset, it defaults to XFCE.
plugins/applicationsmenu/applicationsmenu.c | 18 ++++++++++++++----
plugins/pager/pager.c | 2 +-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index ea20a38..13c195c 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -207,15 +207,25 @@ applications_menu_plugin_class_init (ApplicationsMenuPluginClass *klass)
static void
applications_menu_plugin_init (ApplicationsMenuPlugin *plugin)
{
+ const gchar *desktop;
+
plugin->show_menu_icons = TRUE;
plugin->show_button_title = TRUE;
plugin->custom_menu = FALSE;
+ /* if the value is unset, fallback to XFCE, if the
+ * value is empty, allow all applications in the menu */
+ desktop = g_getenv ("XDG_CURRENT_DESKTOP");
+ if (G_LIKELY (desktop == NULL))
+ desktop = "XFCE";
+ else if (*desktop == '\0')
+ desktop = NULL;
+
panel_debug (PANEL_DEBUG_APPLICATIONSMENU,
- "XDG_MENU_PREFIX is set to \"%s\"",
- g_getenv ("XDG_MENU_PREFIX"));
+ "XDG_MENU_PREFIX is set to \"%s\", menu environment is \"%s\"",
+ g_getenv ("XDG_MENU_PREFIX"), desktop);
- garcon_set_environment ("XFCE");
+ garcon_set_environment (desktop);
plugin->button = xfce_panel_create_toggle_button ();
xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (plugin), plugin->button);
@@ -508,7 +518,7 @@ applications_menu_plugin_configure_plugin_edit (GtkWidget *button,
panel_return_if_fail (XFCE_IS_APPLICATIONS_MENU_PLUGIN (plugin));
panel_return_if_fail (GTK_IS_WIDGET (button));
- if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (button), command,
+ if (!xfce_spawn_command_line_on_screen (gtk_widget_get_screen (button), command,
FALSE, FALSE, &error))
{
xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."), command);
diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c
index 7659979..c1b151e 100644
--- a/plugins/pager/pager.c
+++ b/plugins/pager/pager.c
@@ -421,7 +421,7 @@ pager_plugin_configure_workspace_settings (GtkWidget *button)
screen = gdk_screen_get_default ();
/* try to start the settings dialog */
- if (!xfce_spawn_command_line_on_screen (screen, WORKSPACE_SETTINGS_COMMAND,
+ if (!xfce_spawn_command_line_on_screen (screen, WORKSPACE_SETTINGS_COMMAND,
FALSE, FALSE, &error))
{
/* show an error dialog */
More information about the Xfce4-commits
mailing list