aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-gui.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-12-17 04:52:58 +0800
committerChristian Persch <chpe@src.gnome.org>2004-12-17 04:52:58 +0800
commitfb9a15960ab8001fa51ecb794afda2738e8de4b0 (patch)
tree78943c1122617b7eb641f943e4931859d744e63b /lib/ephy-gui.c
parent7e75b259439311d98f52fbdd5f1f5e8df47f1a7f (diff)
downloadgsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.gz
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.bz2
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.lz
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.xz
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.tar.zst
gsoc2013-epiphany-fb9a15960ab8001fa51ecb794afda2738e8de4b0.zip
Implement context menu on tray icon, as per HIG. Fixes bug #152903.
2004-12-16 Christian Persch <chpe@cvs.gnome.org> * embed/downloader-view.c: (show_downloader_cb), (status_icon_popup_menu_cb), (show_status_icon): * lib/egg/eggstatusicon.c: (egg_status_icon_class_init), (egg_status_icon_init), (egg_status_icon_finalize), (emit_activate_signal), (emit_popup_menu_signal), (egg_status_icon_size_allocate), (egg_status_icon_button_press), (egg_status_icon_set_tooltip): * lib/egg/eggstatusicon.h: * lib/ephy-gui.c: (ephy_gui_menu_position_under_widget), (ephy_gui_menu_position_on_panel): * lib/ephy-gui.h: Implement context menu on tray icon, as per HIG. Fixes bug #152903.
Diffstat (limited to 'lib/ephy-gui.c')
-rw-r--r--lib/ephy-gui.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index ae389b01f..cd8f09e02 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -113,14 +113,11 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu,
{
GtkWidget *w = GTK_WIDGET (user_data);
GtkRequisition requisition;
- gboolean rtl;
-
- rtl = (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL);
gdk_window_get_origin (w->window, x, y);
gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
- if (rtl)
+ if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
{
*x += w->allocation.x + w->allocation.width - requisition.width;
}
@@ -134,6 +131,43 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu,
ephy_gui_sanitise_popup_position (menu, w, x, y);
}
+void
+ephy_gui_menu_position_on_panel (GtkMenu *menu,
+ gint *x,
+ gint *y,
+ gboolean *push_in,
+ gpointer user_data)
+{
+ GtkWidget *widget = GTK_WIDGET (user_data);
+ GtkRequisition requisition;
+ GdkScreen *screen;
+
+ screen = gtk_widget_get_screen (widget);
+
+ gdk_window_get_origin (widget->window, x, y);
+ gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ {g_print ("NOT WINDOW!\n");
+ *x += widget->allocation.x;
+ *y += widget->allocation.y;
+ }
+
+ /* FIXME: Adapt to vertical panels, but egg_tray_icon_get_orientation doesn't seem to work */
+ if (*y > gdk_screen_get_height (screen) / 2)
+ {
+ *y -= requisition.height;
+ }
+ else
+ {
+ *y += widget->allocation.height;
+ }
+
+ *push_in = FALSE;
+
+ ephy_gui_sanitise_popup_position (menu, widget, x, y);
+}
+
gboolean
ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
{