diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-08-16 01:48:55 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-08-16 01:48:55 +0800 |
commit | c12f6de237a1a8cb54f4fc422edd72424f8142c6 (patch) | |
tree | 78ee7688d9c20c9e28fa634198cf2ce562db81c5 | |
parent | 6515e317b0ecec17b732fd1928ea79cdbfa59820 (diff) | |
download | gsoc2013-epiphany-c12f6de237a1a8cb54f4fc422edd72424f8142c6.tar gsoc2013-epiphany-c12f6de237a1a8cb54f4fc422edd72424f8142c6.tar.gz gsoc2013-epiphany-c12f6de237a1a8cb54f4fc422edd72424f8142c6.tar.bz2 gsoc2013-epiphany-c12f6de237a1a8cb54f4fc422edd72424f8142c6.tar.lz gsoc2013-epiphany-c12f6de237a1a8cb54f4fc422edd72424f8142c6.tar.xz gsoc2013-epiphany-c12f6de237a1a8cb54f4fc422edd72424f8142c6.tar.zst gsoc2013-epiphany-c12f6de237a1a8cb54f4fc422edd72424f8142c6.zip |
Remove "-s" argument which hasn't been supported for ages.
2005-08-15 Christian Persch <chpe@cvs.gnome.org>
* data/GNOME_Epiphany_Automation.server.in:
Remove "-s" argument which hasn't been supported for ages.
* data/mime-types-permissions.xml:
Add more mime types.
* lib/ephy-gui.c: (ephy_gui_menu_position_under_widget),
(ephy_gui_menu_position_on_toolbar):
* lib/ephy-gui.h:
Improve menu positioning on toolbar buttons.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | data/GNOME_Epiphany_Automation.server.in | 2 | ||||
-rwxr-xr-x | data/mime-types-permissions.xml | 1 | ||||
-rw-r--r-- | lib/ephy-gui.c | 133 | ||||
-rw-r--r-- | lib/ephy-gui.h | 6 |
5 files changed, 148 insertions, 10 deletions
@@ -1,3 +1,19 @@ +2005-08-15 Christian Persch <chpe@cvs.gnome.org> + + * data/GNOME_Epiphany_Automation.server.in: + + Remove "-s" argument which hasn't been supported for ages. + + * data/mime-types-permissions.xml: + + Add more mime types. + + * lib/ephy-gui.c: (ephy_gui_menu_position_under_widget), + (ephy_gui_menu_position_on_toolbar): + * lib/ephy-gui.h: + + Improve menu positioning on toolbar buttons. + 2005-08-13 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/ContentHandler.cpp: diff --git a/data/GNOME_Epiphany_Automation.server.in b/data/GNOME_Epiphany_Automation.server.in index ab04cb821..05b831039 100644 --- a/data/GNOME_Epiphany_Automation.server.in +++ b/data/GNOME_Epiphany_Automation.server.in @@ -1,6 +1,6 @@ <oaf_info> -<oaf_server iid="OAFIID:GNOME_Epiphany_Automation_Factory" type="exe" location="epiphany -s"> +<oaf_server iid="OAFIID:GNOME_Epiphany_Automation_Factory" type="exe" location="epiphany"> <oaf_attribute name="repo_ids" type="stringv"> <item value="IDL:GNOME/ObjectFactory:1.0"/> </oaf_attribute> diff --git a/data/mime-types-permissions.xml b/data/mime-types-permissions.xml index 320d3e1fe..76049eee3 100755 --- a/data/mime-types-permissions.xml +++ b/data/mime-types-permissions.xml @@ -151,6 +151,7 @@ <mime-type type="application/x-nautilus-link"/> <mime-type type="application/x-netcdf"/> <mime-type type="application/x-netscape-bookmarks"/> +<mime-type type="application/x-ogg"/> <mime-type type="application/x-oleo"/> <mime-type type="application/x-palm-database"/> <mime-type type="application/x-pdf"/> diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c index 21c3bced2..cb80b89c5 100644 --- a/lib/ephy-gui.c +++ b/lib/ephy-gui.c @@ -37,6 +37,7 @@ #include <gtk/gtkstock.h> #include <gtk/gtkmain.h> #include <gtk/gtktreeselection.h> +#include <gtk/gtktoolbar.h> #include <unistd.h> @@ -107,6 +108,14 @@ ephy_gui_menu_position_tree_selection (GtkMenu *menu, /** * ephy_gui_menu_position_under_widget: + * @menu: + * @x: + * @y: + * @push_in: + * @user_data: a #GtkWidget + * + * Positions @menu under (or over, depending on space available) the widget + * @user_data. */ void ephy_gui_menu_position_under_widget (GtkMenu *menu, @@ -115,24 +124,130 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu, gboolean *push_in, gpointer user_data) { - GtkWidget *w = GTK_WIDGET (user_data); - GtkRequisition requisition; + /* Adapted from gtktoolbar.c */ + GtkWidget *widget = GTK_WIDGET (user_data); + GtkWidget *container; + GtkRequisition req; + GtkRequisition menu_req; + GdkRectangle monitor; + int monitor_num; + GdkScreen *screen; + + g_return_if_fail (GTK_IS_WIDGET (widget)); - gdk_window_get_origin (w->window, x, y); - gtk_widget_size_request (GTK_WIDGET (menu), &requisition); + container = gtk_widget_get_ancestor (widget, GTK_TYPE_CONTAINER); + g_return_if_fail (container != NULL); - if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL) + gtk_widget_size_request (widget, &req); + gtk_widget_size_request (GTK_WIDGET (menu), &menu_req); + + screen = gtk_widget_get_screen (GTK_WIDGET (menu)); + monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window); + if (monitor_num < 0) + monitor_num = 0; + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + + gdk_window_get_origin (widget->window, x, y); + if (GTK_WIDGET_NO_WINDOW (widget)) { - *x += w->allocation.x + w->allocation.width - requisition.width; + *x += widget->allocation.x; + *y += widget->allocation.y; } + + if (gtk_widget_get_direction (container) == GTK_TEXT_DIR_LTR) + *x += widget->allocation.width - req.width; + else + *x += req.width - menu_req.width; + + if ((*y + widget->allocation.height + menu_req.height) <= monitor.y + monitor.height) + *y += widget->allocation.height; + else if ((*y - menu_req.height) >= monitor.y) + *y -= menu_req.height; + else if (monitor.y + monitor.height - (*y + widget->allocation.height) > *y) + *y += widget->allocation.height; else + *y -= menu_req.height; + + *push_in = FALSE; +} + +/** + * ephy_gui_menu_position_under_widget: + * @menu: + * @x: + * @y: + * @push_in: + * @user_data: a #GtkWidget which has to be contained in (a widget on) a #GtkToolbar + * + * Positions @menu under (or over, depending on space available) the + * @user_data. + */ +void +ephy_gui_menu_position_on_toolbar (GtkMenu *menu, + gint *x, + gint *y, + gboolean *push_in, + gpointer user_data) +{ + /* Adapted from gtktoolbar.c */ + GtkWidget *widget = GTK_WIDGET (user_data); + GtkToolbar *toolbar; + GtkRequisition req; + GtkRequisition menu_req; + GdkRectangle monitor; + int monitor_num; + GdkScreen *screen; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + + toolbar = gtk_widget_get_ancestor (widget, GTK_TYPE_TOOLBAR); + g_return_if_fail (toolbar != NULL); + + gtk_widget_size_request (widget, &req); + gtk_widget_size_request (GTK_WIDGET (menu), &menu_req); + + screen = gtk_widget_get_screen (GTK_WIDGET (menu)); + monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window); + if (monitor_num < 0) + monitor_num = 0; + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + + gdk_window_get_origin (widget->window, x, y); + if (GTK_WIDGET_NO_WINDOW (widget)) { - *x += w->allocation.x; + *x += widget->allocation.x; + *y += widget->allocation.y; } - *y += w->allocation.y + w->allocation.height; + if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL) + { + if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_LTR) + *x += widget->allocation.width - req.width; + else + *x += req.width - menu_req.width; + + if ((*y + widget->allocation.height + menu_req.height) <= monitor.y + monitor.height) + *y += widget->allocation.height; + else if ((*y - menu_req.height) >= monitor.y) + *y -= menu_req.height; + else if (monitor.y + monitor.height - (*y + widget->allocation.height) > *y) + *y += widget->allocation.height; + else + *y -= menu_req.height; + } + else + { + if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_LTR) + *x += widget->allocation.width; + else + *x -= menu_req.width; + + if (*y + menu_req.height > monitor.y + monitor.height && + *y + widget->allocation.height - monitor.y > monitor.y + monitor.height - *y) + *y += widget->allocation.height - menu_req.height; + } - ephy_gui_sanitise_popup_position (menu, w, x, y); + *push_in = FALSE; } void diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h index 6668a4598..6a7e6ab30 100644 --- a/lib/ephy-gui.h +++ b/lib/ephy-gui.h @@ -47,6 +47,12 @@ void ephy_gui_menu_position_under_widget (GtkMenu *menu, gboolean *push_in, gpointer user_data); +void ephy_gui_menu_position_on_toolbar (GtkMenu *menu, + gint *x, + gint *y, + gboolean *push_in, + gpointer user_data); + void ephy_gui_menu_position_on_panel (GtkMenu *menu, gint *x, gint *y, |