[Xfce4-commits] [xfce/xfce4-panel] 01/01: appmenu: Add support for other menu editors (Bug #11684)
noreply at xfce.org
noreply at xfce.org
Tue Dec 4 20:34:42 CET 2018
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 1d981213f29558246b31134b23c3e4df037be276
Author: Tony Paulic <tony.paulic at gmail.com>
Date: Tue Dec 4 20:31:24 2018 +0100
appmenu: Add support for other menu editors (Bug #11684)
MenuLibre, which is currently probably the best menu editor around, is
now set as the default/fallback editor.
Distributions can set their own menu editor in the 'menu-editor' xfconf
property.
---
plugins/applicationsmenu/applicationsmenu.c | 32 +++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index d2a0920..b05128b 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -39,7 +39,7 @@
#define DEFAULT_TITLE _("Applications")
#define DEFAULT_ICON_NAME "xfce4-panel-menu"
#define DEFAULT_ICON_SIZE (16)
-
+#define DEFAULT_EDITOR "menulibre"
struct _ApplicationsMenuPluginClass
@@ -64,6 +64,7 @@ struct _ApplicationsMenuPlugin
gchar *button_icon;
gboolean custom_menu;
gchar *custom_menu_file;
+ gchar *menu_editor;
/* temp item we store here when the
* properties dialog is opened */
@@ -83,7 +84,8 @@ enum
PROP_BUTTON_TITLE,
PROP_BUTTON_ICON,
PROP_CUSTOM_MENU,
- PROP_CUSTOM_MENU_FILE
+ PROP_CUSTOM_MENU_FILE,
+ PROP_MENU_EDITOR
};
@@ -193,6 +195,13 @@ applications_menu_plugin_class_init (ApplicationsMenuPluginClass *klass)
NULL, NULL,
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
+ PROP_MENU_EDITOR,
+ g_param_spec_string ("menu-editor",
+ NULL, NULL,
+ DEFAULT_EDITOR,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
@@ -286,6 +295,10 @@ applications_menu_plugin_get_property (GObject *object,
g_value_set_string (value, plugin->custom_menu_file);
break;
+ case PROP_MENU_EDITOR:
+ g_value_set_string (value, plugin->menu_editor);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -371,6 +384,10 @@ applications_menu_plugin_set_property (GObject *object,
applications_menu_plugin_set_garcon_menu (plugin);
break;
+ case PROP_MENU_EDITOR:
+ plugin->menu_editor = g_value_dup_string (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -399,6 +416,7 @@ applications_menu_plugin_construct (XfcePanelPlugin *panel_plugin)
{ "button-icon", G_TYPE_STRING },
{ "custom-menu", G_TYPE_BOOLEAN },
{ "custom-menu-file", G_TYPE_STRING },
+ { "menu-editor", G_TYPE_STRING },
{ NULL }
};
@@ -412,6 +430,9 @@ applications_menu_plugin_construct (XfcePanelPlugin *panel_plugin)
/* make sure the menu is set */
applications_menu_plugin_set_garcon_menu (plugin);
+ if (!plugin->menu_editor)
+ plugin->menu_editor = DEFAULT_EDITOR;
+
gtk_widget_show (plugin->button);
applications_menu_plugin_size_changed (panel_plugin,
@@ -565,15 +586,14 @@ applications_menu_plugin_configure_plugin_edit (GtkWidget *button,
ApplicationsMenuPlugin *plugin)
{
GError *error = NULL;
- const gchar command[] = "alacarte";
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), plugin->menu_editor,
FALSE, FALSE, &error))
{
- xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."), command);
+ xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."), plugin->menu_editor);
g_error_free (error);
}
}
@@ -628,7 +648,7 @@ applications_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
/* whether we show the edit menu button */
object = gtk_builder_get_object (builder, "edit-menu-button");
panel_return_if_fail (GTK_IS_BUTTON (object));
- path = g_find_program_in_path ("alacarte");
+ path = g_find_program_in_path (plugin->menu_editor);
if (path != NULL)
{
object2 = gtk_builder_get_object (builder, "use-default-menu");
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list