diff options
author | raveit65 <[email protected]> | 2018-09-13 17:24:43 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-09-23 16:32:48 +0200 |
commit | 3a9e1186d8b8bc8f45f860cb9f623fd63ea9a8a8 (patch) | |
tree | 26b2eb43a1e86874f57113c03fe8fa29c000b553 /mate-dictionary | |
parent | c0800eff5739c3891375d5c4d1db62720fd877cd (diff) | |
download | mate-utils-3a9e1186d8b8bc8f45f860cb9f623fd63ea9a8a8.tar.bz2 mate-utils-3a9e1186d8b8bc8f45f860cb9f623fd63ea9a8a8.tar.xz |
dictionary: replace deprecated gtk_menu_popup
Diffstat (limited to 'mate-dictionary')
-rw-r--r-- | mate-dictionary/src/gdict-sidebar.c | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/mate-dictionary/src/gdict-sidebar.c b/mate-dictionary/src/gdict-sidebar.c index 4290bd6b..f2b46d5c 100644 --- a/mate-dictionary/src/gdict-sidebar.c +++ b/mate-dictionary/src/gdict-sidebar.c @@ -137,29 +137,6 @@ gdict_sidebar_dispose (GObject *object) G_OBJECT_CLASS (gdict_sidebar_parent_class)->dispose (object); } -static void -gdict_sidebar_menu_position_function (GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer user_data) -{ - GtkWidget *widget; - GtkAllocation allocation; - - g_assert (GTK_IS_BUTTON (user_data)); - - widget = GTK_WIDGET (user_data); - - gdk_window_get_origin (gtk_widget_get_window (widget), x, y); - - gtk_widget_get_allocation (widget, &allocation); - *x += allocation.x; - *y += allocation.y + allocation.height; - - *push_in = FALSE; -} - static gboolean gdict_sidebar_select_button_press_cb (GtkWidget *widget, GdkEventButton *event, @@ -182,10 +159,11 @@ gdict_sidebar_select_button_press_cb (GtkWidget *widget, gtk_widget_grab_focus (widget); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - gtk_menu_popup (GTK_MENU (sidebar->priv->menu), - NULL, NULL, - gdict_sidebar_menu_position_function, widget, - event->button, event->time); + gtk_menu_popup_at_widget (GTK_MENU (sidebar->priv->menu), + widget, + GDK_GRAVITY_SOUTH_WEST, + GDK_GRAVITY_NORTH_WEST, + (const GdkEvent*) event); return TRUE; } @@ -206,10 +184,11 @@ gdict_sidebar_select_key_press_cb (GtkWidget *widget, event->keyval == GDK_KEY_KP_Enter) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - gtk_menu_popup (GTK_MENU (sidebar->priv->menu), - NULL, NULL, - gdict_sidebar_menu_position_function, widget, - 1, event->time); + gtk_menu_popup_at_widget (GTK_MENU (sidebar->priv->menu), + widget, + GDK_GRAVITY_SOUTH_WEST, + GDK_GRAVITY_NORTH_WEST, + (const GdkEvent*) event); return TRUE; } |