[libwnck] selector: Don't implement scrolling with signal handler



commit 794c801b9262ccabe2fec260c5b400d835ce128b
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Feb 3 16:40:48 2011 +0100

    selector: Don't implement scrolling with signal handler
    
    We can directly implement the virtual method.

 libwnck/selector.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/libwnck/selector.c b/libwnck/selector.c
index 2066a5d..deb1090 100644
--- a/libwnck/selector.c
+++ b/libwnck/selector.c
@@ -81,6 +81,8 @@ static void wnck_selector_dispose           (GObject           *object);
 static void wnck_selector_finalize          (GObject           *object);
 static void wnck_selector_realize           (GtkWidget *widget);
 static void wnck_selector_unrealize         (GtkWidget *widget);
+static gboolean wnck_selector_scroll_event  (GtkWidget        *widget,
+                                             GdkEventScroll   *event);
 static void wnck_selector_connect_to_window (WnckSelector      *selector,
                                              WnckWindow        *window);
 
@@ -1022,10 +1024,10 @@ wnck_selector_destroy_menu (GtkWidget *widget, WnckSelector *selector)
 }
 
 static gboolean
-wnck_selector_scroll_cb (WnckSelector *selector,
-                         GdkEventScroll *event,
-                         gpointer user_data)
+wnck_selector_scroll_event (GtkWidget      *widget,
+                            GdkEventScroll *event)
 {
+  WnckSelector *selector;
   WnckScreen *screen;
   WnckWorkspace *workspace;
   GList *windows_list;
@@ -1034,6 +1036,8 @@ wnck_selector_scroll_cb (WnckSelector *selector,
   WnckWindow *previous_window;
   gboolean should_activate_next_window;
 
+  selector = WNCK_SELECTOR (widget);
+
   screen = wnck_selector_get_screen (selector);
   workspace = wnck_screen_get_active_workspace (screen);
   windows_list = wnck_screen_get_windows (screen);
@@ -1192,9 +1196,6 @@ wnck_selector_fill (WnckSelector *selector)
   GtkWidget      *menu_item;
   GtkCssProvider *provider;
 
-  g_signal_connect (selector, "scroll-event",
-                    G_CALLBACK (wnck_selector_scroll_cb), selector);
-
   menu_item = gtk_menu_item_new ();
   gtk_widget_show (menu_item);
   gtk_menu_shell_append (GTK_MENU_SHELL (selector), menu_item);
@@ -1265,6 +1266,7 @@ wnck_selector_class_init (WnckSelectorClass *klass)
 
   widget_class->realize   = wnck_selector_realize;
   widget_class->unrealize = wnck_selector_unrealize;
+  widget_class->scroll_event = wnck_selector_scroll_event;
 }
 
 static GObject *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]