Skip to content
Permalink
Browse files

dictionary: replace deprecated gtk_menu_popup

  • Loading branch information...
raveit65 committed Sep 13, 2018
1 parent c0800ef commit 3a9e1186d8b8bc8f45f860cb9f623fd63ea9a8a8
Showing with 10 additions and 31 deletions.
  1. +10 −31 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;
}

0 comments on commit 3a9e118

Please sign in to comment.
You can’t perform that action at this time.