aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-11-30 02:12:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-11-30 02:24:24 +0800
commitd2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a (patch)
tree0a0da6f348d8c41ac3e7712a5c18abe78e23d891 /shell
parent67024e23ee07266a7b9854648454739e1824f91c (diff)
downloadgsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.gz
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.bz2
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.lz
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.xz
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.zst
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.zip
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.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-switcher.c9
-rw-r--r--shell/e-shell-view.c25
-rw-r--r--shell/e-shell-view.h2
3 files changed, 23 insertions, 13 deletions
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);