[Xfce4-commits] <xfce4-indicator-plugin:master> relay the 'scroll-event' signals to the indicators (used e.g. by indicator-sound to change the volume).

Mark Trompell noreply at xfce.org
Thu Feb 24 22:16:02 CET 2011


Updating branch refs/heads/master
         to ff9f26a33fc662129fa61078e10573098e81e634 (commit)
       from 7307f54ea39f376d6938f81ea1712e8ce49f7af9 (commit)

commit ff9f26a33fc662129fa61078e10573098e81e634
Author: Lionel Le Folgoc <lionel at lefolgoc.net>
Date:   Thu Feb 24 22:15:39 2011 +0100

    relay the 'scroll-event' signals to the indicators (used e.g. by indicator-sound to change the volume).

 panel-plugin/indicator.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/indicator.c b/panel-plugin/indicator.c
index 52b8ece..7c2ed6f 100644
--- a/panel-plugin/indicator.c
+++ b/panel-plugin/indicator.c
@@ -308,12 +308,29 @@ indicator_construct (XfcePanelPlugin *plugin)
 }
 
 
+static gboolean
+entry_scrolled (GtkWidget *menuitem, GdkEventScroll *event, gpointer data)
+{
+  IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), "indicator-custom-object-data");
+  IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), "indicator-custom-entry-data");
+
+  g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
+
+  g_signal_emit_by_name (io, "scroll", 1, event->direction);
+  g_signal_emit_by_name (io, "scroll-entry", entry, 1, event->direction);
+
+  return FALSE;
+}
+
+
 static void
 entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data)
 {
   GtkWidget * menuitem = gtk_menu_item_new();
   GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
 
+  g_signal_connect(G_OBJECT(menuitem), "scroll-event", G_CALLBACK(entry_scrolled), entry);
+
   if (entry->image != NULL)
     gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry->image), FALSE, FALSE, 0);
 
@@ -329,6 +346,7 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_d
   gtk_menu_shell_append(GTK_MENU_SHELL(user_data), menuitem);
   gtk_widget_show(menuitem);
 
+  g_object_set_data(G_OBJECT(menuitem), "indicator-custom-object-data", io);
   g_object_set_data(G_OBJECT(menuitem), "indicator-custom-entry-data", entry);
 }
 



More information about the Xfce4-commits mailing list