diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-09-13 18:24:56 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-09-13 18:24:56 +0800 |
commit | 2606279995f614634062e0aeb9833c482db5d083 (patch) | |
tree | 625e6ae5d03052e753c3322397b41f4174ca3926 /src | |
parent | 79ec35d68d698710604fd4e9682188ae28ba1ae0 (diff) | |
download | gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.gz gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.bz2 gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.lz gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.xz gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.zst gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.zip |
Merging pre-gnome-2-10 branch to HEAD.
2004-09-13 Christian Persch <chpe@cvs.gnome.org>
Merging pre-gnome-2-10 branch to HEAD.
Splitting ChangeLog.
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 4 | ||||
-rw-r--r-- | src/bookmarks/ephy-topics-selector.c | 11 | ||||
-rw-r--r-- | src/ephy-go-action.c | 9 | ||||
-rw-r--r-- | src/ephy-location-action.c | 21 | ||||
-rw-r--r-- | src/ephy-main.c | 8 | ||||
-rw-r--r-- | src/ephy-navigation-action.c | 259 | ||||
-rw-r--r-- | src/ephy-notebook.c | 17 | ||||
-rw-r--r-- | src/ephy-shell.c | 26 | ||||
-rw-r--r-- | src/ephy-shell.h | 5 | ||||
-rwxr-xr-x | src/ephy-statusbar.c | 12 | ||||
-rw-r--r-- | src/ephy-statusbar.h | 2 | ||||
-rw-r--r-- | src/ephy-tab.c | 15 | ||||
-rw-r--r-- | src/ephy-tabs-menu.c | 27 | ||||
-rw-r--r-- | src/ephy-window.c | 57 | ||||
-rwxr-xr-x | src/pdm-dialog.c | 9 | ||||
-rw-r--r-- | src/popup-commands.c | 4 | ||||
-rw-r--r-- | src/prefs-dialog.c | 7 | ||||
-rwxr-xr-x | src/toolbar.c | 8 | ||||
-rw-r--r-- | src/window-commands.c | 4 |
19 files changed, 250 insertions, 255 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index e61bd17c8..360dc8f37 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -594,7 +594,7 @@ import_dialog_response_cb (GtkDialog *dialog, gint response, ephy_file_chooser_add_mime_filter (dialog, _("Epiphany bookmarks"), - "text/rdf", NULL); + "text/rdf", "application/rdf+xml", NULL); filter = ephy_file_chooser_add_pattern_filter (dialog, _("All files"), @@ -1154,8 +1154,6 @@ ephy_bookmarks_editor_dispose (GObject *object) editor = EPHY_BOOKMARKS_EDITOR (object); - g_return_if_fail (editor->priv != NULL); - if (editor->priv->key_view != NULL) { remove_focus_monitor (editor, editor->priv->key_view); diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c index eabc93985..561fd9799 100644 --- a/src/bookmarks/ephy-topics-selector.c +++ b/src/bookmarks/ephy-topics-selector.c @@ -215,8 +215,7 @@ topic_destroy_cb (EphyNode *node, } static void -node_toggled_cb (EphyTopicsSelector *selector, EphyNode *node, - gboolean checked, gpointer data) +toggle_topic (EphyTopicsSelector *selector, EphyNode *node, gboolean checked) { if (selector->priv->bookmark) { @@ -252,6 +251,13 @@ node_toggled_cb (EphyTopicsSelector *selector, EphyNode *node, } static void +node_toggled_cb (EphyTopicsSelector *selector, EphyNode *node, + gboolean checked, gpointer data) +{ + toggle_topic (selector, node, checked); +} + +static void ephy_topics_selector_init (EphyTopicsSelector *selector) { selector->priv = EPHY_TOPICS_SELECTOR_GET_PRIVATE (selector); @@ -309,6 +315,7 @@ ephy_topics_selector_new_topic (EphyTopicsSelector *selector) node = ephy_bookmarks_add_keyword (selector->priv->bookmarks, _("Type a topic")); + toggle_topic (selector, node, TRUE); ephy_node_view_select_node (EPHY_NODE_VIEW (selector), node); ephy_node_view_edit (EPHY_NODE_VIEW (selector), TRUE); } diff --git a/src/ephy-go-action.c b/src/ephy-go-action.c index bf8ec1d2f..449b85367 100644 --- a/src/ephy-go-action.c +++ b/src/ephy-go-action.c @@ -85,9 +85,12 @@ connect_proxy (GtkAction *action, { GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); - g_signal_connect_object (GTK_BIN (proxy)->child, "clicked", - G_CALLBACK (gtk_action_activate), action, - G_CONNECT_SWAPPED); + if (GTK_IS_TOOL_ITEM (proxy)) + { + g_signal_connect_object (GTK_BIN (proxy)->child, "clicked", + G_CALLBACK (gtk_action_activate), action, + G_CONNECT_SWAPPED); + } } static void diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c index 6e524c9a3..ef7c31eb8 100644 --- a/src/ephy-location-action.c +++ b/src/ephy-location-action.c @@ -226,16 +226,6 @@ add_completion_actions (GtkAction *action, GtkWidget *proxy) G_CALLBACK (action_activated_cb), la); } -static gboolean -create_menu_proxy_cb (GtkToolItem *tool_item, - GtkAction *action) -{ - gtk_tool_item_set_proxy_menu_item - (tool_item, "ephy-location-action-menu-item", NULL); - - return TRUE; -} - static void connect_proxy (GtkAction *action, GtkWidget *proxy) { @@ -271,17 +261,6 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) G_CALLBACK (user_changed_cb), action, 0); } - /* FIXME: when porting to gtk+ 2.6, use "visible-overflown" - * property on GtkAction instead. - * we need to connect to this before chaining up, since gtkaction's - * connect_proxy connects a routine there which uses create_menu_item - * method to generate a menu proxy (and create_menu_item CANNOT return - * NULL. See bug #133446. - */ - g_signal_connect_object (proxy, "create_menu_proxy", - G_CALLBACK (create_menu_proxy_cb), - action, 0); - (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy); } diff --git a/src/ephy-main.c b/src/ephy-main.c index ad5e3cb32..e0fedc816 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -44,7 +44,6 @@ static gboolean open_in_existing = FALSE; static gboolean open_in_new_tab = FALSE; static gboolean open_fullscreen = FALSE; static gboolean open_as_bookmarks_editor = FALSE; -static gboolean server_mode = FALSE; static const char *session_filename = NULL; static const char *bookmark_url = NULL; @@ -70,9 +69,6 @@ static struct poptOption popt_options[] = { "bookmarks-editor", 'b', POPT_ARG_NONE, &open_as_bookmarks_editor, 0, N_("Launch the bookmarks editor"), NULL }, - { "server", 's', POPT_ARG_NONE, &server_mode, 0, - N_("Used internally by the bonobo interface"), - NULL }, { NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -154,10 +150,6 @@ main (int argc, char *argv[]) startup_flags |= EPHY_SHELL_STARTUP_ADD_BOOKMARK; string_arg = bookmark_url; } - else if (server_mode) - { - startup_flags |= EPHY_SHELL_STARTUP_SERVER; - } gnome_vfs_init (); glade_gnome_init (); diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c index 97987cd61..b186d3caa 100644 --- a/src/ephy-navigation-action.c +++ b/src/ephy-navigation-action.c @@ -23,21 +23,22 @@ #endif #include "ephy-navigation-action.h" -#include "ephy-arrow-toolbutton.h" #include "ephy-window.h" #include "ephy-string.h" #include "ephy-favicon-cache.h" #include "ephy-history.h" #include "ephy-embed-shell.h" +#include "eggdropdowntoolbutton.h" #include "ephy-debug.h" #include <gtk/gtkimage.h> +#include <gtk/gtkmenuitem.h> #include <gtk/gtkimagemenuitem.h> +#include <gtk/gtkmenushell.h> +#include <gtk/gtkmenu.h> -static void ephy_navigation_action_init (EphyNavigationAction *action); -static void ephy_navigation_action_class_init (EphyNavigationActionClass *class); - -static GObjectClass *parent_class = NULL; +#define NTH_DATA_KEY "GoNTh" +#define URL_DATA_KEY "GoURL" #define EPHY_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionPrivate)) @@ -54,6 +55,11 @@ enum PROP_WINDOW }; +static void ephy_navigation_action_init (EphyNavigationAction *action); +static void ephy_navigation_action_class_init (EphyNavigationActionClass *class); + +static GObjectClass *parent_class = NULL; + GType ephy_navigation_action_get_type (void) { @@ -88,44 +94,44 @@ static GtkWidget * new_history_menu_item (const char *origtext, const char *address) { + EphyFaviconCache *cache; + EphyHistory *history; GtkWidget *item, *image; GdkPixbuf *icon = NULL; + const char *icon_address; char *short_text; - if (address != NULL) - { - EphyFaviconCache *cache; - EphyHistory *history; - const char *icon_address; - - history = EPHY_HISTORY - (ephy_embed_shell_get_global_history (embed_shell)); - icon_address = ephy_history_get_icon (history, address); - - cache = EPHY_FAVICON_CACHE - (ephy_embed_shell_get_favicon_cache (embed_shell)); - icon = ephy_favicon_cache_get (cache, icon_address); - } + g_return_val_if_fail (address != NULL, NULL); + /* FIXME: use ellipsisation in the menu item instead */ short_text = ephy_string_shorten (origtext, MAX_LENGTH); item = gtk_image_menu_item_new_with_label (short_text); g_free (short_text); - image = gtk_image_new_from_pixbuf (icon); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); - gtk_widget_show (image); - gtk_widget_show (item); + history = EPHY_HISTORY + (ephy_embed_shell_get_global_history (embed_shell)); + icon_address = ephy_history_get_icon (history, address); + + cache = EPHY_FAVICON_CACHE + (ephy_embed_shell_get_favicon_cache (embed_shell)); + icon = ephy_favicon_cache_get (cache, icon_address); if (icon != NULL) { + image = gtk_image_new_from_pixbuf (icon); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); + gtk_widget_show (image); g_object_unref (icon); } + gtk_widget_show (item); + return item; } static void -activate_back_or_forward_menu_item_cb (GtkWidget *menu, EphyWindow *window) +activate_back_or_forward_menu_item_cb (GtkWidget *menuitem, + EphyWindow *window) { EphyEmbed *embed; int go_nth; @@ -133,52 +139,45 @@ activate_back_or_forward_menu_item_cb (GtkWidget *menu, EphyWindow *window) embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); - go_nth = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(menu), "go_nth")); + go_nth = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), NTH_DATA_KEY)); ephy_embed_shistory_go_nth (embed, go_nth); } static void -activate_up_menu_item_cb (GtkWidget *menu, EphyWindow *window) +activate_up_menu_item_cb (GtkWidget *menuitem, + EphyWindow *window) { EphyEmbed *embed; - int go_nth; - GSList *l; - gchar *url; + char *url; embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); - go_nth = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(menu), "go_nth")); - - l = ephy_embed_get_go_up_list (embed); - - url = g_slist_nth_data (l, go_nth); - if (url) - { - ephy_window_load_url (window, url); - } + url = g_object_get_data (G_OBJECT (menuitem), URL_DATA_KEY); + g_return_if_fail (url != NULL); - g_slist_foreach (l, (GFunc) g_free, NULL); - g_slist_free (l); + ephy_window_load_url (window, url); } -static void -setup_back_or_forward_menu (EphyWindow *window, GtkMenuShell *ms, EphyNavigationDirection dir) +static GtkMenuShell * +build_back_or_forward_menu (EphyNavigationAction *action) { - int pos, count; + EphyWindow *window = action->priv->window; + GtkMenuShell *menu; EphyEmbed *embed; + int pos, count; int start, end; embed = ephy_window_get_active_embed (window); - g_return_if_fail (embed != NULL); + g_return_val_if_fail (embed != NULL, NULL); pos = ephy_embed_shistory_get_pos (embed); count = ephy_embed_shistory_n_items (embed); - if (count == 0) return; + if (count == 0) return NULL; - if (dir == EPHY_NAVIGATION_DIRECTION_BACK) + if (action->priv->direction == EPHY_NAVIGATION_DIRECTION_BACK) { start = pos - 1; end = -1; @@ -189,16 +188,26 @@ setup_back_or_forward_menu (EphyWindow *window, GtkMenuShell *ms, EphyNavigation end = count; } + menu = GTK_MENU_SHELL (gtk_menu_new ()); + while (start != end) { - char *title, *url; GtkWidget *item; + char *title = NULL, *url = NULL; + ephy_embed_shistory_get_nth (embed, start, FALSE, &url, &title); + + if (url == NULL) continue; + item = new_history_menu_item (title ? title : url, url); - gtk_menu_shell_append (ms, item); - g_object_set_data (G_OBJECT (item), "go_nth", GINT_TO_POINTER (start)); + + g_object_set_data (G_OBJECT (item), NTH_DATA_KEY, + GINT_TO_POINTER (start)); g_signal_connect (item, "activate", - G_CALLBACK (activate_back_or_forward_menu_item_cb), window); + G_CALLBACK (activate_back_or_forward_menu_item_cb), + window); + + gtk_menu_shell_append (menu, item); gtk_widget_show_all (item); g_free (url); @@ -213,70 +222,73 @@ setup_back_or_forward_menu (EphyWindow *window, GtkMenuShell *ms, EphyNavigation start--; } } + + return menu; } -static void -setup_up_menu (EphyWindow *window, GtkMenuShell *ms) +static GtkMenuShell * +build_up_menu (EphyNavigationAction *action) { + EphyWindow *window = action->priv->window; EphyEmbed *embed; - GSList *l; - GSList *li; - int count = 0; + GtkMenuShell *menu; + GtkWidget *item; + GSList *list, *l; + char *url; embed = ephy_window_get_active_embed (window); - g_return_if_fail (embed != NULL); + g_return_val_if_fail (embed != NULL, NULL); - l = ephy_embed_get_go_up_list (embed); + menu = GTK_MENU_SHELL (gtk_menu_new ()); - for (li = l; li; li = li->next) + list = ephy_embed_get_go_up_list (embed); + + for (l = list; l != NULL; l = l->next) { - char *url = li->data; - GtkWidget *item; + url = l->data; + + if (url == NULL) continue; item = new_history_menu_item (url, url); - gtk_menu_shell_append (ms, item); - g_object_set_data (G_OBJECT(item), "go_nth", GINT_TO_POINTER (count)); + + g_object_set_data_full (G_OBJECT (item), URL_DATA_KEY, url, + (GDestroyNotify) g_free); g_signal_connect (item, "activate", - G_CALLBACK (activate_up_menu_item_cb), window); - gtk_widget_show_all (item); - count ++; + G_CALLBACK (activate_up_menu_item_cb), window); + + gtk_menu_shell_append (menu, item); + gtk_widget_show (item); } - g_slist_foreach (l, (GFunc) g_free, NULL); - g_slist_free (l); + /* the list data has been consumed */ + g_slist_free (list); + + return menu; } static void -menu_activated_cb (EphyArrowToolButton *w, EphyNavigationAction *b) +menu_activated_cb (EggDropdownToolButton *button, + EphyNavigationAction *action) { - EphyNavigationActionPrivate *p = b->priv; - GtkMenuShell *ms = ephy_arrow_toolbutton_get_menu (w); - EphyWindow *win = b->priv->window; - GList *children; - GList *li; + GtkMenuShell *menu = NULL; - LOG ("Show navigation menu") + LOG ("menu_activated_cb dir %d", action->priv->direction) - children = gtk_container_get_children (GTK_CONTAINER (ms)); - for (li = children; li; li = li->next) + switch (action->priv->direction) { - gtk_container_remove (GTK_CONTAINER (ms), li->data); + case EPHY_NAVIGATION_DIRECTION_UP: + menu = build_up_menu (action); + break; + case EPHY_NAVIGATION_DIRECTION_FORWARD: + case EPHY_NAVIGATION_DIRECTION_BACK: + menu = build_back_or_forward_menu (action); + break; + default: + g_assert_not_reached (); + break; } - g_list_free (children); - switch (p->direction) - { - case EPHY_NAVIGATION_DIRECTION_UP: - setup_up_menu (win, ms); - break; - case EPHY_NAVIGATION_DIRECTION_FORWARD: - case EPHY_NAVIGATION_DIRECTION_BACK: - setup_back_or_forward_menu (win, ms, p->direction); - break; - default: - g_assert_not_reached (); - break; - } + egg_dropdown_tool_button_set_menu (button, menu); } static void @@ -284,17 +296,26 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) { LOG ("Connect navigation action proxy") - g_signal_connect (proxy, "menu-activated", - G_CALLBACK (menu_activated_cb), action); + if (EGG_IS_DROPDOWN_TOOL_BUTTON (proxy)) + { + g_signal_connect (proxy, "menu-activated", + G_CALLBACK (menu_activated_cb), action); + } + + GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); +} - (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy); +static void +ephy_navigation_action_init (EphyNavigationAction *action) +{ + action->priv = EPHY_NAVIGATION_ACTION_GET_PRIVATE (action); } static void ephy_navigation_action_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { EphyNavigationAction *nav; @@ -313,9 +334,9 @@ ephy_navigation_action_set_property (GObject *object, static void ephy_navigation_action_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { EphyNavigationAction *nav; @@ -343,33 +364,25 @@ ephy_navigation_action_class_init (EphyNavigationActionClass *class) parent_class = g_type_class_peek_parent (class); - action_class->toolbar_item_type = EPHY_TYPE_ARROW_TOOLBUTTON; + action_class->toolbar_item_type = EGG_TYPE_DROPDOWN_TOOL_BUTTON; action_class->connect_proxy = connect_proxy; g_object_class_install_property (object_class, - PROP_DIRECTION, - g_param_spec_int ("direction", - "Direction", - "Direction", - 0, + PROP_DIRECTION, + g_param_spec_int ("direction", + "Direction", + "Direction", + 0, G_MAXINT, 0, - G_PARAM_READWRITE)); + G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_WINDOW, - g_param_spec_object ("window", - "Window", - "The navigation window", - G_TYPE_OBJECT, - G_PARAM_READWRITE)); - - g_type_class_add_private (object_class, sizeof(EphyNavigationActionPrivate)); + PROP_WINDOW, + g_param_spec_object ("window", + "Window", + "The navigation window", + G_TYPE_OBJECT, + G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof (EphyNavigationActionPrivate)); } - -static void -ephy_navigation_action_init (EphyNavigationAction *action) -{ - action->priv = EPHY_NAVIGATION_ACTION_GET_PRIVATE (action); -} - - diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c index 5651b2e98..0c4919bc4 100644 --- a/src/ephy-notebook.c +++ b/src/ephy-notebook.c @@ -25,6 +25,7 @@ #endif #include "ephy-notebook.h" +#include "ephy-stock-icons.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" #include "ephy-marshal.h" @@ -35,7 +36,6 @@ #include "ephy-shell.h" #include "ephy-debug.h" #include "ephy-favicon-cache.h" -#include "ephy-label.h" #include "ephy-spinner.h" #include "ephy-string.h" @@ -793,7 +793,7 @@ sync_label (EphyTab *tab, GParamSpec *pspec, GtkWidget *proxy) if (title) { - ephy_label_set_text (EPHY_LABEL (label), title); + gtk_label_set_text (GTK_LABEL (label), title); gtk_tooltips_set_tip (tips, ebox, title, NULL); } } @@ -844,12 +844,10 @@ build_tab_label (EphyNotebook *nb, EphyTab *tab) { GtkWidget *window, *hbox, *label_hbox, *label_ebox; GtkWidget *label, *close_button, *image, *spinner, *icon; - int h = -1, w = -1; + GtkIconSize close_icon_size; window = gtk_widget_get_toplevel (GTK_WIDGET (nb)); - gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h); - /* set hbox spacing and label padding (see below) so that there's an * equal amount of space around the label */ hbox = gtk_hbox_new (FALSE, 4); @@ -865,9 +863,8 @@ build_tab_label (EphyNotebook *nb, EphyTab *tab) close_button = gtk_button_new (); gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE); - image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, - GTK_ICON_SIZE_MENU); - gtk_widget_set_size_request (close_button, w, h); + close_icon_size = gtk_icon_size_from_name (EPHY_ICON_SIZE_TAB_BUTTON); + image = gtk_image_new_from_stock (EPHY_STOCK_CLOSE_TAB, close_icon_size); gtk_container_add (GTK_CONTAINER (close_button), image); gtk_box_pack_start (GTK_BOX (hbox), close_button, FALSE, FALSE, 0); @@ -885,8 +882,8 @@ build_tab_label (EphyNotebook *nb, EphyTab *tab) gtk_box_pack_start (GTK_BOX (label_hbox), icon, FALSE, FALSE, 0); /* setup label */ - label = ephy_label_new (""); - ephy_label_set_ellipsize (EPHY_LABEL (label), PANGO_ELLIPSIZE_END); + label = gtk_label_new (""); + gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 0, 0); gtk_box_pack_start (GTK_BOX (label_hbox), label, TRUE, TRUE, 0); diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 2718ea538..792099ddd 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -56,7 +56,6 @@ #include <libgnomeui/gnome-client.h> #define AUTOMATION_IID "OAFIID:GNOME_Epiphany_Automation" -#define SERVER_TIMEOUT 60000 #define EPHY_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHELL, EphyShellPrivate)) @@ -74,7 +73,6 @@ struct EphyShellPrivate GObject *prefs_dialog; GObject *print_setup_dialog; GList *del_on_exit; - guint server_timeout; }; EphyShell *ephy_shell = NULL; @@ -186,7 +184,6 @@ ephy_shell_init (EphyShell *shell) shell->priv->toolbars_model = NULL; shell->priv->fs_toolbars_model = NULL; shell->priv->extensions_manager = NULL; - shell->priv->server_timeout = 0; /* globally accessible singleton */ g_assert (ephy_shell == NULL); @@ -246,14 +243,6 @@ open_urls (GNOME_EphyAutomation automation, } static gboolean -server_timeout (EphyShell *shell) -{ - g_object_unref (shell); - - return FALSE; -} - -static gboolean save_yourself_cb (GnomeClient *client, gint phase, GnomeSaveStyle save_style, @@ -263,7 +252,7 @@ save_yourself_cb (GnomeClient *client, EphyShell *shell) { char *argv[] = { "epiphany", "--load-session", NULL }; - char *discard_argv[] = { "rm", "-r", NULL }; + char *discard_argv[] = { "rm", "-f", NULL }; EphySession *session; char *tmp, *save_to; @@ -359,13 +348,7 @@ ephy_shell_startup (EphyShell *shell, g_assert_not_reached (); } - if (flags & EPHY_SHELL_STARTUP_SERVER) - { - g_object_ref (shell); - shell->priv->server_timeout = g_timeout_add - (SERVER_TIMEOUT, (GSourceFunc)server_timeout, shell); - } - else if (result == Bonobo_ACTIVATION_REG_SUCCESS || + if (result == Bonobo_ACTIVATION_REG_SUCCESS || result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE) { automation = bonobo_activation_activate_from_id (AUTOMATION_IID, @@ -428,11 +411,6 @@ ephy_shell_finalize (GObject *object) g_assert (ephy_shell == NULL); - if (shell->priv->server_timeout > 0) - { - g_source_remove (shell->priv->server_timeout); - } - /* this will unload the extensions */ LOG ("Unref extension manager") g_object_unref (shell->priv->extensions_manager); diff --git a/src/ephy-shell.h b/src/ephy-shell.h index a2dbc338f..cac87a89e 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -62,8 +62,7 @@ typedef enum EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR = 1 << 4, EPHY_SHELL_STARTUP_SESSION = 1 << 5, EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS = 1 << 6, - EPHY_SHELL_STARTUP_ADD_BOOKMARK = 1 << 7, - EPHY_SHELL_STARTUP_SERVER = 1 << 8 + EPHY_SHELL_STARTUP_ADD_BOOKMARK = 1 << 7 } EphyShellStartupFlags; typedef enum @@ -109,8 +108,6 @@ gboolean ephy_shell_startup (EphyShell *shell, const char *string_arg, GError **error); -EphyWindow *ephy_shell_get_active_window (EphyShell *shell); - EphyTab *ephy_shell_new_tab (EphyShell *shell, EphyWindow *parent_window, EphyTab *previous_tab, diff --git a/src/ephy-statusbar.c b/src/ephy-statusbar.c index 8e2e8c475..697af416d 100755 --- a/src/ephy-statusbar.c +++ b/src/ephy-statusbar.c @@ -236,22 +236,18 @@ ephy_statusbar_new (void) /** * ephy_statusbar_set_security_state: * @statusbar: an #EphyStatusbar - * @secure: whether to set the icon to show secure or insecure + * @stock_id: stock-id of the icon showing the security state * @tooltip: a string detailing the security state * * Sets the statusbar's security icon and its tooltip. **/ void ephy_statusbar_set_security_state (EphyStatusbar *statusbar, - gboolean secure, + const char *stock_id, const char *tooltip) { - const char *stock; - - stock = secure ? EPHY_STOCK_SECURE : EPHY_STOCK_UNSECURE; - - gtk_image_set_from_stock (GTK_IMAGE (statusbar->priv->security_icon), stock, - GTK_ICON_SIZE_MENU); + gtk_image_set_from_stock (GTK_IMAGE (statusbar->priv->security_icon), + stock_id, GTK_ICON_SIZE_MENU); gtk_tooltips_set_tip (statusbar->tooltips, statusbar->priv->security_evbox, tooltip, NULL); diff --git a/src/ephy-statusbar.h b/src/ephy-statusbar.h index 8ca1b5af4..f7472ee82 100644 --- a/src/ephy-statusbar.h +++ b/src/ephy-statusbar.h @@ -62,7 +62,7 @@ GType ephy_statusbar_get_type (void); GtkWidget *ephy_statusbar_new (void); void ephy_statusbar_set_security_state (EphyStatusbar *statusbar, - gboolean secure, + const char *stock_id, const char *tooltip); void ephy_statusbar_set_popups_state (EphyStatusbar *statusbar, diff --git a/src/ephy-tab.c b/src/ephy-tab.c index ac498ed7f..1d0e083ca 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -1397,7 +1397,7 @@ save_property_url (EphyEmbed *embed, location = g_value_get_string (value); persist = EPHY_EMBED_PERSIST - (ephy_embed_factory_new_object ("EphyEmbedPersist")); + (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_PERSIST)); ephy_embed_persist_set_embed (persist, embed); ephy_embed_persist_set_flags (persist, 0); @@ -1556,7 +1556,7 @@ ephy_tab_init (EphyTab *tab) tab->priv->setting_zoom = FALSE; tab->priv->address_expire = TAB_ADDRESS_EXPIRE_NOW; - embed = ephy_embed_factory_new_object ("EphyEmbed"); + embed = ephy_embed_factory_new_object (EPHY_TYPE_EMBED); g_assert (embed != NULL); gtk_container_add (GTK_CONTAINER (tab), GTK_WIDGET (embed)); @@ -1744,8 +1744,7 @@ ephy_tab_get_status_message (EphyTab *tab) static void ephy_tab_set_title (EphyTab *tab, EphyEmbed *embed, const char *new_title) { - char *title_short, *title_tmp; - char *title = NULL; + char *title_tmp, *title = NULL; g_return_if_fail (EPHY_IS_TAB (tab)); @@ -1793,18 +1792,12 @@ ephy_tab_set_title (EphyTab *tab, EphyEmbed *embed, const char *new_title) tab->priv->title = title; - title_short = ephy_string_shorten (title, MAX_LABEL_LENGTH); - title_tmp = ephy_string_double_underscores (title_short); + title_tmp = ephy_string_double_underscores (title); - /* - * FIXME: instead of shortening the title here, use an egg action - * which creates menu items with ellipsizing labels - */ g_object_set (G_OBJECT (tab->priv->action), "label", title_tmp, NULL); - g_free (title_short); g_free (title_tmp); g_object_notify (G_OBJECT (tab), "title"); diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c index 1ab5d1c1a..c780144ea 100644 --- a/src/ephy-tabs-menu.c +++ b/src/ephy-tabs-menu.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2003 David Bordoley + * Copyright (C) 2003-2004 Christian Persch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +29,8 @@ #include "ephy-shell.h" #include "ephy-debug.h" +#include <gtk/gtklabel.h> +#include <gtk/gtkmenuitem.h> #include <gtk/gtkaccelmap.h> #include <gtk/gtkaction.h> #include <gtk/gtkradioaction.h> @@ -123,6 +126,19 @@ tabs_reordered_cb (EphyNotebook *notebook, EphyTabsMenu *menu) } static void +connect_proxy_cb (GtkActionGroup *action_group, + GtkAction *action, + GtkWidget *proxy, + gpointer dummy) +{ + if (GTK_IS_MENU_ITEM (proxy)) + { + gtk_label_set_ellipsize (GTK_LABEL (GTK_BIN (proxy)->child), + PANGO_ELLIPSIZE_END); + } +} + +static void ephy_tabs_menu_set_window (EphyTabsMenu *menu, EphyWindow *window) { GtkWidget *notebook; @@ -132,9 +148,12 @@ ephy_tabs_menu_set_window (EphyTabsMenu *menu, EphyWindow *window) merge = GTK_UI_MANAGER (window->ui_merge); menu->priv->action_group = gtk_action_group_new ("TabsActions"); - gtk_ui_manager_insert_action_group (merge, menu->priv->action_group, 0); + gtk_ui_manager_insert_action_group (merge, menu->priv->action_group, -1); g_object_unref (menu->priv->action_group); + g_signal_connect (menu->priv->action_group, "connect-proxy", + G_CALLBACK (connect_proxy_cb), NULL); + notebook = ephy_window_get_notebook (window); g_signal_connect_object (notebook, "tab_added", G_CALLBACK (tab_added_cb), menu, 0); @@ -187,8 +206,8 @@ ephy_tabs_menu_class_init (EphyTabsMenuClass *klass) g_object_class_install_property (object_class, PROP_WINDOW, - g_param_spec_object ("EphyWindow", - "EphyWindow", + g_param_spec_object ("window", + "Window", "Parent window", EPHY_TYPE_WINDOW, G_PARAM_READWRITE | @@ -224,7 +243,7 @@ EphyTabsMenu * ephy_tabs_menu_new (EphyWindow *window) { return EPHY_TABS_MENU (g_object_new (EPHY_TYPE_TABS_MENU, - "EphyWindow", window, + "window", window, NULL)); } diff --git a/src/ephy-window.c b/src/ephy-window.c index 9f5d1c2bb..acc0f8db5 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -302,6 +302,12 @@ static GtkActionEntry ephy_popups_entries [] = { { "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL, NULL, G_CALLBACK (popup_cmd_copy_link_address) }, + /* Email links */ + { "SendEmail", GTK_STOCK_OPEN, N_("_Send Email..."), + NULL, NULL, G_CALLBACK (popup_cmd_open_link) }, + { "CopyEmailAddress", NULL, N_("_Copy Email Address"), NULL, + NULL, G_CALLBACK (popup_cmd_copy_link_address) }, + /* Images */ { "OpenImage", GTK_STOCK_OPEN, N_("Open _Image"), NULL, NULL, G_CALLBACK (popup_cmd_open_image) }, @@ -720,10 +726,24 @@ ephy_window_key_press_event (GtkWidget *widget, { EphyWindow *window = EPHY_WINDOW (widget); GtkWidget *menubar; - guint modifiers = gtk_accelerator_get_default_mod_mask (); + guint keyval = GDK_F10; + guint modifier = 0; + guint mask = gtk_accelerator_get_default_mod_mask (); + char *accel = NULL; + + g_object_get (gtk_widget_get_settings (widget), + "gtk-menu-bar-accel", &accel, + NULL); + + if (accel != NULL) + { + gtk_accelerator_parse (accel, &keyval, &modifier); + + g_free (accel); + } - /* Show and activate the menubar on F10, if it isn't visible */ - if (event->keyval == GDK_F10 && (event->state & modifiers) == 0) + /* Show and activate the menubar, if it isn't visible */ + if (event->keyval == keyval && (event->state & mask) == (modifier & mask)) { menubar = gtk_ui_manager_get_widget (GTK_UI_MANAGER (window->ui_merge), "/menubar"); @@ -1279,8 +1299,8 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) EmbedSecurityLevel level; char *description = NULL; char *state = NULL; - gboolean secure; char *tooltip; + const char *stock_id = STOCK_LOCK_INSECURE; if (window->priv->closing) return; @@ -1288,14 +1308,6 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) ephy_embed_get_security_level (embed, &level, &description); - if (level != ephy_tab_get_security_level (tab)) - { - /* something is VERY wrong here! */ - level = STATE_IS_UNKNOWN; - description = NULL; - } - - secure = FALSE; switch (level) { case STATE_IS_UNKNOWN: @@ -1306,18 +1318,19 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) break; case STATE_IS_BROKEN: state = _("Broken"); + stock_id = STOCK_LOCK_BROKEN; break; case STATE_IS_SECURE_MED: state = _("Medium"); - secure = TRUE; + stock_id = STOCK_LOCK_SECURE; break; case STATE_IS_SECURE_LOW: state = _("Low"); - secure = TRUE; + stock_id = STOCK_LOCK_SECURE; break; case STATE_IS_SECURE_HIGH: state = _("High"); - secure = TRUE; + stock_id = STOCK_LOCK_SECURE; break; default: g_assert_not_reached (); @@ -1337,7 +1350,7 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) } ephy_statusbar_set_security_state (EPHY_STATUSBAR (window->priv->statusbar), - secure, tooltip); + stock_id, tooltip); g_free (tooltip); } @@ -1569,9 +1582,19 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) LOG ("show_embed_popup context %x", context) - if ((context & EMBED_CONTEXT_LINK) && + if ((context & EMBED_CONTEXT_EMAIL_LINK) && (context & EMBED_CONTEXT_IMAGE)) { + popup = "/EphyImageEmailLinkPopup"; + } + else if (context & EMBED_CONTEXT_EMAIL_LINK) + { + popup = "/EphyEmailLinkPopup"; + update_edit_actions_sensitivity (window, TRUE); + } + else if ((context & EMBED_CONTEXT_LINK) && + (context & EMBED_CONTEXT_IMAGE)) + { popup = "/EphyImageLinkPopup"; } else if (context & EMBED_CONTEXT_LINK) diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c index 68f054479..80169e311 100755 --- a/src/pdm-dialog.c +++ b/src/pdm-dialog.c @@ -30,7 +30,6 @@ #include "ephy-file-helpers.h" #include "ephy-password-manager.h" #include "ephy-gui.h" -#include "ephy-label.h" #include "ephy-debug.h" #include "ephy-state.h" @@ -923,16 +922,16 @@ show_cookies_properties (PdmDialog *dialog, gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); - label = ephy_label_new (info->value); - ephy_label_set_selectable (EPHY_LABEL (label), TRUE); + label = gtk_label_new (info->value); + gtk_label_set_selectable (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 0, 1); str = g_strconcat ("<b>", _("Path:"), "</b>", NULL); - label = ephy_label_new (str); + label = gtk_label_new (str); g_free (str); - ephy_label_set_use_markup (EPHY_LABEL (label), TRUE); + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); gtk_widget_show (label); gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, diff --git a/src/popup-commands.c b/src/popup-commands.c index 34dafdfc8..5b6467e83 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -203,7 +203,7 @@ save_property_url (GtkAction *action, location = g_value_get_string (value); persist = EPHY_EMBED_PERSIST - (ephy_embed_factory_new_object ("EphyEmbedPersist")); + (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_PERSIST)); ephy_embed_persist_set_embed (persist, embed); ephy_embed_persist_set_fc_title (persist, title); @@ -303,7 +303,7 @@ popup_cmd_set_image_as_background (GtkAction *action, location = g_value_get_string (value); persist = EPHY_EMBED_PERSIST - (ephy_embed_factory_new_object ("EphyEmbedPersist")); + (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_PERSIST)); base = g_path_get_basename (location); base_converted = g_filename_from_utf8 (base, -1, NULL, NULL, NULL); diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c index 560989675..35155f4e9 100644 --- a/src/prefs-dialog.c +++ b/src/prefs-dialog.c @@ -37,7 +37,6 @@ #include "ephy-langs.h" #include "ephy-encodings.h" #include "ephy-debug.h" -#include "ephy-label.h" #include "ephy-file-chooser.h" #include "ephy-file-helpers.h" #include "ephy-tree-model-node.h" @@ -1134,8 +1133,8 @@ create_download_path_label (EphyDialog *dialog) button = ephy_dialog_get_control (dialog, properties[DOWNLOAD_PATH_BUTTON_PROP].id); dir = get_download_button_label (); - label = ephy_label_new (dir); - ephy_label_set_ellipsize (EPHY_LABEL (label), PANGO_ELLIPSIZE_START); + label = gtk_label_new (dir); + gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_START); gtk_container_add (GTK_CONTAINER (button), label); g_free (dir); gtk_widget_show (label); @@ -1296,7 +1295,7 @@ download_path_response_cb (GtkDialog *fc, gint response, EphyDialog *dialog) button = ephy_dialog_get_control (dialog, properties[DOWNLOAD_PATH_BUTTON_PROP].id); label = get_download_button_label (); - ephy_label_set_text (EPHY_LABEL (GTK_BIN (button)->child), label); + gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), label); g_free (dir); g_free (label); diff --git a/src/toolbar.c b/src/toolbar.c index 55e9b3dfb..142b92806 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -51,9 +51,9 @@ static void toolbar_set_window (Toolbar *t, EphyWindow *window); static GtkTargetEntry drag_targets[] = { - { EGG_TOOLBAR_ITEM_TYPE, 0, 0 }, - { EPHY_DND_TOPIC_TYPE, 0, 1 }, - { EPHY_DND_URL_TYPE, 0, 2 } + { EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0 }, + { EPHY_DND_TOPIC_TYPE, 0, 1 }, + { EPHY_DND_URL_TYPE, 0, 2 } }; static int n_drag_targets = G_N_ELEMENTS (drag_targets); @@ -338,6 +338,7 @@ toolbar_setup_actions (Toolbar *t) "label", _("Address Entry"), "stock_id", EPHY_STOCK_ENTRY, "tooltip", _("Enter a web address to open, or a phrase to search for on the web"), + "visible-overflown", FALSE, NULL); g_signal_connect (action, "go_location", G_CALLBACK (go_location_cb), t->priv->window); @@ -363,6 +364,7 @@ toolbar_setup_actions (Toolbar *t) "name", "Favicon", "label", _("Favicon"), "window", t->priv->window, + "visible-overflown", FALSE, NULL); gtk_action_group_add_action (t->priv->action_group, action); g_object_unref (action); diff --git a/src/window-commands.c b/src/window-commands.c index aac37cfe9..9b87e0a0d 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -417,7 +417,7 @@ window_cmd_file_save_as (GtkAction *action, g_return_if_fail (embed != NULL); persist = EPHY_EMBED_PERSIST - (ephy_embed_factory_new_object ("EphyEmbedPersist")); + (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_PERSIST)); ephy_embed_persist_set_embed (persist, embed); ephy_embed_persist_set_fc_title (persist, _("Save As")); @@ -758,7 +758,7 @@ save_temp_source (EphyEmbed *embed) } persist = EPHY_EMBED_PERSIST - (ephy_embed_factory_new_object ("EphyEmbedPersist")); + (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_PERSIST)); ephy_embed_persist_set_embed (persist, embed); ephy_embed_persist_set_flags (persist, EMBED_PERSIST_COPY_PAGE | |