[Xfce4-commits] <xfce4-clipman-plugin:master> menu: move Disable item inside context/right-cli menu (bug 9896)
Mike Massonnet
noreply at xfce.org
Sun Feb 2 16:04:01 CET 2014
Updating branch refs/heads/master
to 59d1ae6bdd7032b66919ff24a98dd33ad58897f1 (commit)
from 547218e1f5710465d6fdb761c8d7cb96a81c9558 (commit)
commit 59d1ae6bdd7032b66919ff24a98dd33ad58897f1
Author: Mike Massonnet <m8t at gandi.net>
Date: Sun Feb 2 16:02:53 2014 +0100
menu: move Disable item inside context/right-cli menu (bug 9896)
panel-plugin/main-panel-plugin.c | 10 ++++++++--
panel-plugin/main-status-icon.c | 4 ++++
panel-plugin/menu.c | 30 ------------------------------
panel-plugin/plugin.c | 2 --
4 files changed, 12 insertions(+), 34 deletions(-)
diff --git a/panel-plugin/main-panel-plugin.c b/panel-plugin/main-panel-plugin.c
index e2af4d7..d91cbd6 100644
--- a/panel-plugin/main-panel-plugin.c
+++ b/panel-plugin/main-panel-plugin.c
@@ -92,11 +92,17 @@ panel_plugin_register (XfcePanelPlugin *panel_plugin)
g_signal_connect (plugin->button, "button-press-event",
G_CALLBACK (cb_button_pressed), plugin);
- /* Signals */
+ /* Context menu */
xfce_panel_plugin_menu_show_about (panel_plugin);
+ xfce_panel_plugin_menu_show_configure (panel_plugin);
+ mi = gtk_check_menu_item_new_with_mnemonic (_("_Disable"));
+ xfce_panel_plugin_menu_insert_item (panel_plugin, mi);
+ xfconf_g_property_bind (plugin->channel, "/tweaks/inhibit",
+ G_TYPE_BOOLEAN, mi, "active");
+
+ /* Signals */
g_signal_connect_swapped (panel_plugin, "about",
G_CALLBACK (plugin_about), plugin);
- xfce_panel_plugin_menu_show_configure (panel_plugin);
g_signal_connect_swapped (panel_plugin, "configure-plugin",
G_CALLBACK (plugin_configure), plugin);
g_signal_connect_swapped (panel_plugin, "save",
diff --git a/panel-plugin/main-status-icon.c b/panel-plugin/main-status-icon.c
index b3dcee2..c88d7bc 100644
--- a/panel-plugin/main-status-icon.c
+++ b/panel-plugin/main-status-icon.c
@@ -133,6 +133,10 @@ cb_status_icon_popup_menu (MyPlugin *plugin, guint button, guint activate_time)
mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_PROPERTIES, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (plugin->popup_menu), mi);
g_signal_connect_swapped (mi, "activate", G_CALLBACK (plugin_configure), plugin);
+ mi = gtk_check_menu_item_new_with_mnemonic (_("_Disable"));
+ gtk_menu_shell_append (GTK_MENU_SHELL (plugin->popup_menu), mi);
+ xfconf_g_property_bind (plugin->channel, "/tweaks/inhibit",
+ G_TYPE_BOOLEAN, mi, "active");
mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (plugin->popup_menu), mi);
g_signal_connect_swapped (mi, "activate", G_CALLBACK (plugin_about), plugin);
diff --git a/panel-plugin/menu.c b/panel-plugin/menu.c
index 41a4f1a..bf4ae9e 100644
--- a/panel-plugin/menu.c
+++ b/panel-plugin/menu.c
@@ -44,7 +44,6 @@ G_DEFINE_TYPE (ClipmanMenu, clipman_menu, GTK_TYPE_MENU)
struct _ClipmanMenuPrivate
{
- GtkWidget *mi_inhibit;
GtkWidget *mi_clear_history;
ClipmanHistory *history;
GSList *list;
@@ -56,7 +55,6 @@ struct _ClipmanMenuPrivate
enum
{
REVERSE_ORDER = 1,
- INHIBIT_MENU_ITEM,
PASTE_ON_ACTIVATE,
NEVER_CONFIRM_HISTORY_CLEAR,
};
@@ -84,7 +82,6 @@ static void _clipman_menu_free_list (ClipmanMenu *menu);
static void cb_set_clipboard (GtkMenuItem *mi,
const ClipmanHistoryItem *item);
static void cb_clear_history (ClipmanMenu *menu);
-static void cb_toggle_inhibit_mi (ClipmanMenu *menu);
@@ -230,13 +227,6 @@ cb_clear_history (ClipmanMenu *menu)
gtk_clipboard_clear (clipboard);
}
-static void
-cb_toggle_inhibit_mi (ClipmanMenu *menu)
-{
- gboolean toggle_value = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu->priv->mi_inhibit));
- g_object_set (menu, "inhibit-menu-item", toggle_value, NULL);
-}
-
/*
* Private methods
*/
@@ -357,13 +347,6 @@ clipman_menu_class_init (ClipmanMenuClass *klass)
FALSE,
G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
- g_object_class_install_property (object_class, INHIBIT_MENU_ITEM,
- g_param_spec_boolean ("inhibit-menu-item",
- "InhibitMenuItem",
- "Toggle the inhibit menu item to TRUE or FALSE",
- FALSE,
- G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
-
g_object_class_install_property (object_class, PASTE_ON_ACTIVATE,
g_param_spec_uint ("paste-on-activate",
"PasteOnActivate",
@@ -396,10 +379,6 @@ clipman_menu_init (ClipmanMenu *menu)
mi = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
- menu->priv->mi_inhibit = mi = gtk_check_menu_item_new_with_mnemonic (_("_Disable"));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
- g_signal_connect_swapped (mi, "toggled", G_CALLBACK (cb_toggle_inhibit_mi), menu);
-
menu->priv->mi_clear_history = mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLEAR, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
g_signal_connect_swapped (mi, "activate", G_CALLBACK (cb_clear_history), menu);
@@ -429,11 +408,6 @@ clipman_menu_set_property (GObject *object,
priv->reverse_order = g_value_get_boolean (value);
break;
- case INHIBIT_MENU_ITEM:
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (priv->mi_inhibit),
- g_value_get_boolean (value));
- break;
-
case PASTE_ON_ACTIVATE:
priv->paste_on_activate = g_value_get_uint (value);
break;
@@ -461,10 +435,6 @@ clipman_menu_get_property (GObject *object,
g_value_set_boolean (value, priv->reverse_order);
break;
- case INHIBIT_MENU_ITEM:
- g_value_set_boolean (value, gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (priv->mi_inhibit)));
- break;
-
case PASTE_ON_ACTIVATE:
g_value_set_uint (value, priv->paste_on_activate);
break;
diff --git a/panel-plugin/plugin.c b/panel-plugin/plugin.c
index adeb054..5f68fcf 100644
--- a/panel-plugin/plugin.c
+++ b/panel-plugin/plugin.c
@@ -115,8 +115,6 @@ plugin_register (void)
plugin->menu = clipman_menu_new ();
xfconf_g_property_bind (plugin->channel, "/tweaks/reverse-menu-order",
G_TYPE_BOOLEAN, plugin->menu, "reverse-order");
- xfconf_g_property_bind (plugin->channel, "/tweaks/inhibit",
- G_TYPE_BOOLEAN, plugin->menu, "inhibit-menu-item");
xfconf_g_property_bind (plugin->channel, "/tweaks/paste-on-activate",
G_TYPE_UINT, plugin->menu, "paste-on-activate");
xfconf_g_property_bind (plugin->channel, "/tweaks/never-confirm-history-clear",
More information about the Xfce4-commits
mailing list