[Xfce4-commits] <xfce4-clipman-plugin:master> Readd "Inhibit" option (bug 6522)
Mike Massonnet
noreply at xfce.org
Sat May 7 19:56:02 CEST 2011
Updating branch refs/heads/master
to f10d6d586aaa62a53297d339e80b18f7d77d4e66 (commit)
from 040cfee8bfcbec50c2cf74d9fc8930b98a098647 (commit)
commit f10d6d586aaa62a53297d339e80b18f7d77d4e66
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Sat May 7 19:58:19 2011 +0200
Readd "Inhibit" option (bug 6522)
panel-plugin/collector.c | 24 ++++++++++++++++++++++++
panel-plugin/menu.c | 32 +++++++++++++++++++++++++++++++-
panel-plugin/plugin.c | 4 ++++
3 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/panel-plugin/collector.c b/panel-plugin/collector.c
index 935c4b4..203fc15 100644
--- a/panel-plugin/collector.c
+++ b/panel-plugin/collector.c
@@ -49,6 +49,7 @@ struct _ClipmanCollectorPrivate
gboolean add_primary_clipboard;
gboolean history_ignore_primary_clipboard;
gboolean enable_actions;
+ gboolean inhibit;
};
enum
@@ -56,6 +57,7 @@ enum
ADD_PRIMARY_CLIPBOARD = 1,
HISTORY_IGNORE_PRIMARY_CLIPBOARD,
ENABLE_ACTIONS,
+ INHIBIT,
};
static void clipman_collector_constructed (GObject *object);
@@ -92,6 +94,12 @@ cb_clipboard_owner_change (ClipmanCollector *collector,
gchar *text;
GdkPixbuf *image;
+ /* Jump over if collector is inhibited */
+ if (collector->priv->inhibit)
+ {
+ return;
+ }
+
/* Jump over if the content is set from within clipman */
if (collector->priv->internal_change)
{
@@ -252,6 +260,13 @@ clipman_collector_class_init (ClipmanCollectorClass *klass)
"Set to TRUE to enable actions (match the clipboard texts against regex's)",
DEFAULT_ENABLE_ACTIONS,
G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, INHIBIT,
+ g_param_spec_boolean ("inhibit",
+ "Inhibit",
+ "Set to TRUE to disable the collector",
+ FALSE,
+ G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
}
static void
@@ -314,6 +329,10 @@ clipman_collector_set_property (GObject *object,
priv->enable_actions = g_value_get_boolean (value);
break;
+ case INHIBIT:
+ priv->inhibit = g_value_get_boolean (value);
+ break;
+
default:
break;
}
@@ -341,7 +360,12 @@ clipman_collector_get_property (GObject *object,
g_value_set_boolean (value, priv->enable_actions);
break;
+ case INHIBIT:
+ g_value_set_boolean (value, priv->inhibit);
+ break;
+
default:
break;
}
}
+
diff --git a/panel-plugin/menu.c b/panel-plugin/menu.c
index 279752b..ab937f9 100644
--- a/panel-plugin/menu.c
+++ b/panel-plugin/menu.c
@@ -20,7 +20,6 @@
#include <config.h>
#endif
-#include <exo/exo.h>
#include <gtk/gtk.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
@@ -40,6 +39,7 @@ G_DEFINE_TYPE (ClipmanMenu, clipman_menu, GTK_TYPE_MENU)
struct _ClipmanMenuPrivate
{
+ GtkWidget *mi_inhibit;
GtkWidget *mi_clear_history;
ClipmanHistory *history;
GSList *list;
@@ -49,6 +49,7 @@ struct _ClipmanMenuPrivate
enum
{
REVERSE_ORDER = 1,
+ INHIBIT_MENU_ITEM,
};
static void clipman_menu_finalize (GObject *object);
@@ -73,6 +74,7 @@ static void _clipman_menu_free_list (ClipmanMenu *menu);
static void cb_set_clipboard (const ClipmanHistoryItem *item);
static void cb_clear_history (ClipmanMenu *menu);
+static void cb_toggle_inhibit_mi (ClipmanMenu *menu);
@@ -134,6 +136,13 @@ 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
*/
@@ -252,6 +261,13 @@ clipman_menu_class_init (ClipmanMenuClass *klass)
"Set to TRUE to display the menu in the reverse order",
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));
}
static void
@@ -271,6 +287,10 @@ 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);
@@ -300,6 +320,11 @@ 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;
+
default:
break;
}
@@ -319,7 +344,12 @@ 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;
+
default:
break;
}
}
+
diff --git a/panel-plugin/plugin.c b/panel-plugin/plugin.c
index e49fb2c..4b78ba8 100644
--- a/panel-plugin/plugin.c
+++ b/panel-plugin/plugin.c
@@ -104,11 +104,15 @@ plugin_register (void)
G_TYPE_BOOLEAN, plugin->collector, "history-ignore-primary-clipboard");
xfconf_g_property_bind (plugin->channel, "/settings/enable-actions",
G_TYPE_BOOLEAN, plugin->collector, "enable-actions");
+ xfconf_g_property_bind (plugin->channel, "/tweaks/inhibit",
+ G_TYPE_BOOLEAN, plugin->collector, "inhibit");
/* ClipmanMenu */
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");
/* Load the data */
plugin_load (plugin);
More information about the Xfce4-commits
mailing list