[Goodies-commits] r7235 - in xfce4-clipman-plugin/trunk: . panel-plugin
Mike Massonnet
mmassonnet at xfce.org
Sun Apr 19 00:31:05 CEST 2009
Author: mmassonnet
Date: 2009-04-18 22:31:05 +0000 (Sat, 18 Apr 2009)
New Revision: 7235
Modified:
xfce4-clipman-plugin/trunk/ChangeLog
xfce4-clipman-plugin/trunk/panel-plugin/history.c
xfce4-clipman-plugin/trunk/panel-plugin/history.h
xfce4-clipman-plugin/trunk/panel-plugin/main.c
Log:
Add a simple signal for items being added in ClipmanHistory
Modified: xfce4-clipman-plugin/trunk/ChangeLog
===================================================================
--- xfce4-clipman-plugin/trunk/ChangeLog 2009-04-18 14:44:36 UTC (rev 7234)
+++ xfce4-clipman-plugin/trunk/ChangeLog 2009-04-18 22:31:05 UTC (rev 7235)
@@ -1,4 +1,18 @@
2009-04-18 Mike Massonnet
+Add a simple signal for items being added in ClipmanHistory
+
+ - panel-plugin/history.c, panel-plugin/history.h:
+ Install a signal item-added in the class. Emit it when a new
+ item is added into the history.
+ - panel-plugin/main.c(plugin_register):
+ Connect to the signal item-added after loading the data.
+ - panel-plugin/main.c(cb_status_icon_quit),
+ panel-plugin/main.c(cb_status_icon_popup_menu):
+ New callback for the Quit item in the status icon popup menu.
+ Hide the status icon before leaving the main loop as it can
+ take a little moment sometimes.
+
+2009-04-18 Mike Massonnet
Update credits for the translator and previous authors
2009-04-18 Mike Massonnet
Modified: xfce4-clipman-plugin/trunk/panel-plugin/history.c
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/history.c 2009-04-18 14:44:36 UTC (rev 7234)
+++ xfce4-clipman-plugin/trunk/panel-plugin/history.c 2009-04-18 22:31:05 UTC (rev 7235)
@@ -55,6 +55,13 @@
SAVE_ON_QUIT,
};
+enum
+{
+ ITEM_ADDED,
+ LAST_SIGNAL,
+};
+static guint signals[LAST_SIGNAL];
+
static void clipman_history_class_init (ClipmanHistoryClass *klass);
static void clipman_history_init (ClipmanHistory *history);
static void clipman_history_finalize (GObject *object);
@@ -142,6 +149,9 @@
default:
g_assert_not_reached ();
}
+
+ /* Emit signal */
+ g_signal_emit (history, signals[ITEM_ADDED], 0);
}
/*
@@ -387,6 +397,13 @@
object_class->set_property = clipman_history_set_property;
object_class->get_property = clipman_history_get_property;
+ signals[ITEM_ADDED] =
+ g_signal_new ("item-added", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST|G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (ClipmanHistoryClass, item_added),
+ 0, NULL, g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
g_object_class_install_property (object_class,
MAX_TEXTS_IN_HISTORY,
g_param_spec_uint ("max-texts-in-history",
Modified: xfce4-clipman-plugin/trunk/panel-plugin/history.h
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/history.h 2009-04-18 14:44:36 UTC (rev 7234)
+++ xfce4-clipman-plugin/trunk/panel-plugin/history.h 2009-04-18 22:31:05 UTC (rev 7235)
@@ -69,6 +69,9 @@
struct _ClipmanHistoryClass
{
GObjectClass parent_class;
+
+ void
+ (*item_added) (ClipmanHistory *history);
};
struct _ClipmanHistory
Modified: xfce4-clipman-plugin/trunk/panel-plugin/main.c
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/main.c 2009-04-18 14:44:36 UTC (rev 7234)
+++ xfce4-clipman-plugin/trunk/panel-plugin/main.c 2009-04-18 22:31:05 UTC (rev 7235)
@@ -70,6 +70,7 @@
static void cb_status_icon_popup_menu (MyPlugin *plugin,
guint button,
guint activate_time);
+static void cb_status_icon_quit (MyPlugin *plugin);
static gboolean cb_status_icon_set_size (MyPlugin *plugin,
gint size);
static void cb_status_icon_finalize (MyPlugin *plugin);
@@ -255,6 +256,10 @@
/* Load the data */
plugin_load (plugin);
+ /* Connect signal to save content */
+ g_signal_connect_swapped (plugin->history, "item-added",
+ G_CALLBACK (plugin_save), plugin);
+
/* Set the selection for the popup command */
my_plugin_set_selection (plugin);
@@ -332,7 +337,7 @@
mi = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (plugin->popup_menu), mi);
mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_REMOVE, NULL);
- g_signal_connect (mi, "activate", G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect_swapped (mi, "activate", G_CALLBACK (cb_status_icon_quit), plugin);
gtk_menu_shell_append (GTK_MENU_SHELL (plugin->popup_menu), mi);
gtk_widget_show_all (plugin->popup_menu);
}
@@ -343,6 +348,13 @@
0, gtk_get_current_event_time ());
}
+static void
+cb_status_icon_quit (MyPlugin *plugin)
+{
+ gtk_status_icon_set_visible (plugin->status_icon, FALSE);
+ gtk_main_quit ();
+}
+
static gboolean
cb_status_icon_set_size (MyPlugin *plugin, gint size)
{
More information about the Goodies-commits
mailing list