[gnome-applets/wip/button] windowpicker: use 'clicked' signal in addition to 'button-press-event' signal



commit b1d6bd2041d16ad64c81b1dc0ca0e227f0b67f29
Author: Sebastian Geiger <sbastig gmx net>
Date:   Tue Feb 16 20:34:03 2016 +0100

    windowpicker: use 'clicked' signal in addition to 'button-press-event' signal

 windowpicker/src/wp-task-title.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/windowpicker/src/wp-task-title.c b/windowpicker/src/wp-task-title.c
index c32d8d1..f29ff4d 100644
--- a/windowpicker/src/wp-task-title.c
+++ b/windowpicker/src/wp-task-title.c
@@ -86,17 +86,25 @@ logout_ready_callback (GObject      *source_object,
     }
 }
 
+
 static gboolean
 button_press_event_cb (GtkButton      *button,
                        GdkEventButton *event,
                        gpointer        user_data)
 {
-  WpTaskTitle *title;
-  const gchar *icon;
-
   if (event->button != 1)
     return GDK_EVENT_STOP;
 
+  return GDK_EVENT_PROPAGATE;
+}
+
+static gboolean
+button_clicked_cb (GtkButton      *button,
+                   gpointer        user_data)
+{
+  WpTaskTitle *title;
+  const gchar *icon;
+
   title = WP_TASK_TITLE (user_data);
 
   gtk_image_get_icon_name (GTK_IMAGE (title->image), &icon, NULL);
@@ -105,7 +113,6 @@ button_press_event_cb (GtkButton      *button,
     {
       WnckScreen *screen;
       WnckWindow *active_window;
-      GdkEventButton *event_button;
 
       screen = wnck_screen_get_default ();
       active_window = wnck_screen_get_active_window (screen);
@@ -116,10 +123,8 @@ button_press_event_cb (GtkButton      *button,
       if (title->active_window != active_window)
         return FALSE;
 
-      event_button = (GdkEventButton *) event;
-
       disconnect_active_window (title);
-      wnck_window_close (active_window, event_button->time);
+      wnck_window_close (active_window, gtk_get_current_event_time ());
     }
   else if (g_strcmp0 (icon, LOGOUT_ICON) == 0)
     {
@@ -547,6 +552,9 @@ wp_task_title_setup_button (WpTaskTitle *title)
   gtk_box_pack_start (GTK_BOX (title), title->button, FALSE, FALSE, 0);
   gtk_widget_show (title->button);
 
+  g_signal_connect (title->button, "clicked",
+                    G_CALLBACK (button_clicked_cb), title);
+
   g_signal_connect (title->button, "button-press-event",
                     G_CALLBACK (button_press_event_cb), title);
 }


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