From d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 29 Nov 2012 13:12:41 -0500 Subject: Avoid using GdkEventButton directly in certain places. Prefer dealing with GdkEvent pointers and using accessor functions like gdk_event_get_button(). This is complicated by the fact that some GtkWidget method declarations still use GdkEventButton pointers, and synthesizing button events pretty much requires direct GdkEventButton access. But GDK seems to be nudging itself toward sealing the GdkEvent union. Likely to happen in GDK4. Mainly clean up signal handlers and leave method overrides alone for now. --- shell/e-shell-switcher.c | 9 +++++++-- shell/e-shell-view.c | 25 +++++++++++++++---------- shell/e-shell-view.h | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) (limited to 'shell') diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c index 195dc7c896..9e8f9a3a44 100644 --- a/shell/e-shell-switcher.c +++ b/shell/e-shell-switcher.c @@ -609,15 +609,20 @@ tool_item_get_button (GtkWidget *widget) static gboolean tool_item_button_cb (GtkWidget *internal_widget, - GdkEventButton *event, + GdkEvent *button_event, GtkAction *action) { + guint event_button = 0; + g_return_val_if_fail (GTK_IS_ACTION (action), FALSE); - if (event->button == 2) { + gdk_event_get_button (button_event, &event_button); + + if (event_button == 2) { gtk_action_activate (action); return TRUE; } + return FALSE; } diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 90fdbc852e..16d09fcb2d 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1786,7 +1786,7 @@ e_shell_view_unblock_update_actions (EShellView *shell_view) * e_shell_view_show_popup_menu: * @shell_view: an #EShellView * @widget_path: path in the UI definition - * @event: a #GdkEventButton + * @button_event: a #GdkEvent, or %NULL * * Displays a context-sensitive (or "popup") menu that is described in * the UI definition loaded into @shell_view's user interface @@ -1801,10 +1801,12 @@ e_shell_view_unblock_update_actions (EShellView *shell_view) GtkWidget * e_shell_view_show_popup_menu (EShellView *shell_view, const gchar *widget_path, - GdkEventButton *event) + GdkEvent *button_event) { EShellWindow *shell_window; GtkWidget *menu; + guint event_button = 0; + guint32 event_time; g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); @@ -1814,14 +1816,17 @@ e_shell_view_show_popup_menu (EShellView *shell_view, menu = e_shell_window_get_managed_widget (shell_window, widget_path); g_return_val_if_fail (GTK_IS_MENU (menu), NULL); - if (event != NULL) - gtk_menu_popup ( - GTK_MENU (menu), NULL, NULL, NULL, NULL, - event->button, event->time); - else - gtk_menu_popup ( - GTK_MENU (menu), NULL, NULL, NULL, NULL, - 0, gtk_get_current_event_time ()); + if (button_event != NULL) { + gdk_event_get_button (button_event, &event_button); + event_time = gdk_event_get_time (button_event); + } else { + event_time = gtk_get_current_event_time (); + } + + gtk_menu_popup ( + GTK_MENU (menu), + NULL, NULL, NULL, NULL, + event_button, event_time); return menu; } diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index 736af40b6a..fe2b63c5b2 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -225,7 +225,7 @@ void e_shell_view_unblock_update_actions (EShellView *shell_view); GtkWidget * e_shell_view_show_popup_menu (EShellView *shell_view, const gchar *widget_path, - GdkEventButton *event); + GdkEvent *button_event); GalViewInstance * e_shell_view_new_view_instance (EShellView *shell_view, const gchar *instance_id); -- cgit v1.2.3