Commit 556c46b1 authored by Sebastian Geiger's avatar Sebastian Geiger Committed by Alberts Muktupāvels

window-picker: use gp_applet_popup_menu_for_widget

parent e9a8251a
Pipeline #167860 passed with stages
in 22 minutes and 50 seconds
......@@ -459,46 +459,6 @@ static void on_size_allocate (
update_hints (item);
}
static void
popup_menu_at_item (TaskItem *item,
GtkMenu *menu,
GdkEvent *event)
{
GdkGravity widget_anchor;
GdkGravity menu_anchor;
switch (gp_applet_get_position (GP_APPLET (item->windowPickerApplet)))
{
case GTK_POS_TOP:
widget_anchor = GDK_GRAVITY_SOUTH_WEST;
menu_anchor = GDK_GRAVITY_NORTH_WEST;
break;
case GTK_POS_LEFT:
widget_anchor = GDK_GRAVITY_NORTH_EAST;
menu_anchor = GDK_GRAVITY_NORTH_WEST;
break;
case GTK_POS_RIGHT:
widget_anchor = GDK_GRAVITY_NORTH_WEST;
menu_anchor = GDK_GRAVITY_NORTH_EAST;
break;
case GTK_POS_BOTTOM:
widget_anchor = GDK_GRAVITY_NORTH_WEST;
menu_anchor = GDK_GRAVITY_SOUTH_WEST;
break;
default:
g_assert_not_reached ();
break;
}
gtk_menu_popup_at_widget (menu, GTK_WIDGET (item),
widget_anchor, menu_anchor,
event);
}
static gboolean on_button_pressed (
GtkWidget *button,
GdkEventButton *event,
......@@ -512,7 +472,9 @@ static gboolean on_button_pressed (
if (event->button == 3) {
GtkWidget *menu = wnck_action_menu_new (window);
popup_menu_at_item (item, GTK_MENU (menu), (GdkEvent *) event);
gp_applet_popup_menu_at_widget (GP_APPLET (item->windowPickerApplet),
GTK_MENU (menu), GTK_WIDGET (item),
(GdkEvent *) event);
return TRUE;
}
......
......@@ -470,46 +470,6 @@ wp_task_title_class_init (WpTaskTitleClass *title_class)
g_object_class_install_properties (object_class, LAST_PROP, properties);
}
static void
popup_menu_at_item (WpTaskTitle *title,
GtkMenu *menu,
GdkEvent *event)
{
GdkGravity widget_anchor;
GdkGravity menu_anchor;
switch (gp_applet_get_position (GP_APPLET (title->applet)))
{
case GTK_POS_TOP:
widget_anchor = GDK_GRAVITY_SOUTH_WEST;
menu_anchor = GDK_GRAVITY_NORTH_WEST;
break;
case GTK_POS_LEFT:
widget_anchor = GDK_GRAVITY_NORTH_EAST;
menu_anchor = GDK_GRAVITY_NORTH_WEST;
break;
case GTK_POS_RIGHT:
widget_anchor = GDK_GRAVITY_NORTH_WEST;
menu_anchor = GDK_GRAVITY_NORTH_EAST;
break;
case GTK_POS_BOTTOM:
widget_anchor = GDK_GRAVITY_NORTH_WEST;
menu_anchor = GDK_GRAVITY_SOUTH_WEST;
break;
default:
g_assert_not_reached ();
break;
}
gtk_menu_popup_at_widget (menu, GTK_WIDGET (title),
widget_anchor, menu_anchor,
event);
}
static gboolean
label_button_press_event_cb (GtkWidget *widget,
GdkEventButton *event,
......@@ -531,7 +491,9 @@ label_button_press_event_cb (GtkWidget *widget,
menu = wnck_action_menu_new (title->active_window);
popup_menu_at_item (title, GTK_MENU (menu), (GdkEvent *) event);
gp_applet_popup_menu_at_widget (GP_APPLET (title->applet),
GTK_MENU (menu), GTK_WIDGET (title),
(GdkEvent *) event);
return TRUE;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment