Your message dated Tue, 21 Sep 2010 12:11:31 +0200 with message-id <20100921101131.GD21708@patate.is-a-geek.org> and subject line Re: Bug#596094: unblock: epiphany-browser/2.30.5-1 has caused the Debian Bug report #596094, regarding unblock: epiphany-browser/2.30.5-1 to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@bugs.debian.org immediately.) -- 596094: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596094 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
--- Begin Message ---
- To: submit@bugs.debian.org
- Subject: unblock: epiphany-browser/2.30.5-1
- From: Josselin Mouette <joss@debian.org>
- Date: Wed, 08 Sep 2010 18:18:09 +0200
- Message-id: <[🔎] 1283962690.22754.30.camel@meh>
Package: release.debian.org Severity: normal User: release.debian.org@packages.debian.org Usertags: freeze-exception Please unblock epiphany-browser for squeeze. epiphany-browser (2.30.5-1) unstable; urgency=low * New upstream bugfix release: + debian/patches/13_accept-languages.patch: - Dropped, merged upstream. + debian/patches/14_download_nautilus.patch, debian/patches/99_autoreconf.patch, debian/patches/99_ltmain_as-needed.patch: - Refreshed. epiphany-browser (2.30.3-1) unstable; urgency=low [ Josselin Mouette ] * 14_download_nautilus.patch: don’t open nautilus every time a file is saved. This is simply annoying. [ Sebastian Dröge ] * New upstream bugfix release: + debian/control.in: - Build depend on WebKit >= 1.2.3. + debian/patches/05_libexecdir.patch, debian/patches/14_download_nautilus.patch, debian/patches/99_autoreconf.patch: - Refreshed. The upstream changes are mostly bug fixes and translation updates. Together with the webkit update (which I hope will be unblocked too) it fixes a lot of crashers. =============== Epiphany 2.30.5 =============== Paperbag release! - Don't depend on GTK 2.21.x =============== Epiphany 2.30.4 =============== This releases tries to sync with master as much as possible. Mostly bug fixes, cleanups and small enhancements have been cherry-picked. Changes: - Prevent a crasher in the download dialog - Highlight matches on "Find again" - Install introspection files in our own prefix, not g-i's - Fix feeds URL for relative URIs - Don't let ephy-favicon-cache store invalid files - Update libegg to latest master - Remove deprecated functions to work with GTK+ 2.22 / master =============== Epiphany 2.30.3 =============== Changes: - Fix middle click on back/forward buttons and its menus - Fix a crasher when loading URIs with no path - Adapt to GtkNotebook signal signature changes The diff for C sources is attached. Cheers, -- .''`. : :' : “You would need to ask a lawyer if you don't know `. `' that a handshake of course makes a valid contract.” `- -- J???rg Schilling--- epiphany-2.30.2/embed/downloader-view.c 2010-03-24 18:14:47.000000000 +0100 +++ epiphany-2.30.5/embed/downloader-view.c 2010-08-30 22:58:42.000000000 +0200 @@ -803,7 +803,8 @@ downloader_view_add_download (Downloader } #endif - dv->priv->source_id = g_timeout_add (100, (GSourceFunc) update_buttons_timeout_cb, dv); + if (dv->priv->source_id == 0) + dv->priv->source_id = g_timeout_add (100, (GSourceFunc) update_buttons_timeout_cb, dv); } static void --- epiphany-2.30.2/embed/ephy-embed.c 2010-03-29 18:08:54.000000000 +0200 +++ epiphany-2.30.5/embed/ephy-embed.c 2010-08-30 22:58:42.000000000 +0200 @@ -49,9 +49,13 @@ #include <string.h> #include <webkit/webkit.h> -static void ephy_embed_class_init (EphyEmbedClass *klass); -static void ephy_embed_init (EphyEmbed *gs); -static void ephy_embed_constructed (GObject *object); +static void ephy_embed_class_init (EphyEmbedClass *klass); +static void ephy_embed_init (EphyEmbed *gs); +static void ephy_embed_constructed (GObject *object); +static gboolean ephy_embed_inspect_show_cb (WebKitWebInspector *inspector, + EphyEmbed *embed); +static gboolean ephy_embed_inspect_close_cb (WebKitWebInspector *inspector, + EphyEmbed *embed); #define EPHY_EMBED_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED, EphyEmbedPrivate)) @@ -59,10 +63,13 @@ struct EphyEmbedPrivate { GtkBox *top_widgets_vbox; GtkScrolledWindow *scrolled_window; + GtkPaned *paned; WebKitWebView *web_view; EphyHistory *history; GtkWidget *inspector_window; char *loading_uri; + GtkWidget *inspector_scrolled_window; + gboolean inspector_attached; guint is_setting_zoom : 1; GSList *destroy_on_transition_list; }; @@ -335,6 +342,13 @@ zoom_changed_cb (WebKitWebView *web_view } static void +ephy_embed_history_cleared_cb (EphyHistory *history, + EphyEmbed *embed) +{ + ephy_web_view_clear_history (EPHY_WEB_VIEW (embed->priv->web_view)); +} + +static void ephy_embed_grab_focus (GtkWidget *widget) { GtkWidget *child; @@ -346,6 +360,32 @@ ephy_embed_grab_focus (GtkWidget *widget } static void +ephy_embed_dispose (GObject *object) +{ + EphyEmbed *embed = EPHY_EMBED (object); + + if (embed->priv->inspector_window) + { + WebKitWebInspector *inspector; + + inspector = webkit_web_view_get_inspector (embed->priv->web_view); + + g_signal_handlers_disconnect_by_func (inspector, + ephy_embed_inspect_show_cb, + embed->priv->inspector_window); + + g_signal_handlers_disconnect_by_func (inspector, + ephy_embed_inspect_close_cb, + embed->priv->inspector_window); + + gtk_widget_destroy (GTK_WIDGET (embed->priv->inspector_window)); + embed->priv->inspector_window = NULL; + } + + G_OBJECT_CLASS (ephy_embed_parent_class)->dispose (object); +} + +static void ephy_embed_finalize (GObject *object) { EphyEmbed *embed = EPHY_EMBED (object); @@ -360,6 +400,10 @@ ephy_embed_finalize (GObject *object) } g_slist_free (embed->priv->destroy_on_transition_list); + g_signal_handlers_disconnect_by_func (embed->priv->history, + ephy_embed_history_cleared_cb, + embed); + G_OBJECT_CLASS (ephy_embed_parent_class)->finalize (object); } @@ -371,6 +415,7 @@ ephy_embed_class_init (EphyEmbedClass *k object_class->constructed = ephy_embed_constructed; object_class->finalize = ephy_embed_finalize; + object_class->dispose = ephy_embed_dispose; widget_class->grab_focus = ephy_embed_grab_focus; g_type_class_add_private (G_OBJECT_CLASS (klass), sizeof(EphyEmbedPrivate)); @@ -393,18 +438,94 @@ ephy_embed_inspect_web_view_cb (WebKitWe } static gboolean +ephy_embed_attach_inspector_cb (WebKitWebInspector *inspector, + EphyEmbed *embed) +{ + GtkAllocation allocation; + gtk_widget_get_allocation (GTK_WIDGET (embed->priv->scrolled_window), &allocation); + + embed->priv->inspector_attached = TRUE; + + if (embed->priv->paned == NULL) + { + embed->priv->paned = GTK_PANED (gtk_vpaned_new ()); + g_object_ref_sink (embed->priv->paned); + } + + /* Main view */ + g_object_ref (embed->priv->scrolled_window); + gtk_container_remove (GTK_CONTAINER (embed), + GTK_WIDGET (embed->priv->scrolled_window)); + gtk_paned_pack1 (embed->priv->paned, + GTK_WIDGET (embed->priv->scrolled_window), + TRUE, FALSE); + g_object_unref (embed->priv->scrolled_window); + + /* Set a sane position for the mover */ + gtk_paned_set_position (embed->priv->paned, allocation.height * 0.5); + + /* The inspector */ + g_object_ref (embed->priv->inspector_scrolled_window); + gtk_container_remove (GTK_CONTAINER (embed->priv->inspector_window), + GTK_WIDGET (embed->priv->inspector_scrolled_window)); + gtk_paned_pack2 (embed->priv->paned, + GTK_WIDGET (embed->priv->inspector_scrolled_window), + FALSE, TRUE); + g_object_unref (embed->priv->inspector_scrolled_window); + + /* Add the paned to the embed, show it, and hide the inspector window */ + gtk_container_add (GTK_CONTAINER (embed), GTK_WIDGET (embed->priv->paned)); + gtk_widget_show_all (GTK_WIDGET (embed->priv->paned)); + + gtk_widget_hide (embed->priv->inspector_window); + + return TRUE; +} + +static gboolean +ephy_embed_detach_inspector_cb (WebKitWebInspector *inspector, + EphyEmbed *embed) +{ + embed->priv->inspector_attached = FALSE; + + gtk_container_remove (GTK_CONTAINER (embed), + GTK_WIDGET (embed->priv->paned)); + + /* Main view */ + gtk_widget_reparent (GTK_WIDGET (embed->priv->scrolled_window), + GTK_WIDGET (embed)); + + /* The inspector */ + gtk_widget_reparent (GTK_WIDGET (embed->priv->inspector_scrolled_window), + GTK_WIDGET (embed->priv->inspector_window)); + + /* Get the view and the inspector back to their places */ + gtk_widget_destroy (GTK_WIDGET (embed->priv->paned)); + embed->priv->paned = NULL; + + gtk_widget_show_all (embed->priv->inspector_window); + gtk_widget_show_all (embed->priv->inspector_scrolled_window); + + return TRUE; +} + +static gboolean ephy_embed_inspect_show_cb (WebKitWebInspector *inspector, - GtkWidget *widget) + EphyEmbed *embed) { - gtk_widget_show (widget); + if (!embed->priv->inspector_attached) + gtk_window_present (GTK_WINDOW (embed->priv->inspector_window)); + return TRUE; } static gboolean ephy_embed_inspect_close_cb (WebKitWebInspector *inspector, - GtkWidget *widget) + EphyEmbed *embed) { - gtk_widget_hide (widget); + if (!embed->priv->inspector_attached) + gtk_widget_hide (embed->priv->inspector_window); + return TRUE; } @@ -485,6 +606,7 @@ static const char* parse_extension (const char *filename) { const char *compression; + const char *last_separator; compression = file_is_compressed (filename); @@ -511,7 +633,8 @@ parse_extension (const char *filename) } /* no compression, just look for the last dot in the filename */ - return g_strrstr (filename, "."); + last_separator = strrchr (filename, G_DIR_SEPARATOR); + return strrchr ((last_separator) ? last_separator : filename, '.'); } static gboolean @@ -670,7 +793,7 @@ confirm_action_from_mime (WebKitWebView DownloadAction action) { GtkWidget *parent_window; - GtkWidget *dialog, *button, *image; + GtkWidget *dialog; const char *action_label; char *mime_description; EphyMimePermission mime_permission; @@ -679,6 +802,9 @@ confirm_action_from_mime (WebKitWebView int default_response; WebKitNetworkResponse *response; SoupMessage *message; + GtkMessageType mtype; + char *title; + char *secondary; parent_window = gtk_widget_get_toplevel (GTK_WIDGET(web_view)); if (!gtk_widget_is_toplevel (parent_window)) @@ -721,58 +847,49 @@ confirm_action_from_mime (WebKitWebView suggested_filename = webkit_download_get_suggested_filename (download); if (mime_permission != EPHY_MIME_PERMISSION_SAFE && helper_app) { - dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, - _("Download this potentially unsafe file?")); - - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - /* translators: First %s is the file type description, - Second %s is the file name */ - _("File Type: “%s”.\n\nIt is unsafe to open “%s” as " - "it could potentially damage your documents or " - "invade your privacy. You can download it instead."), - mime_description, suggested_filename); + title = _("Download this potentially unsafe file?"); + mtype = GTK_MESSAGE_WARNING; + /* translators: First %s is the file type description, second %s is the + * file name */ + secondary = g_strdup_printf (_("File Type: “%s”.\n\nIt is unsafe to open " + "“%s” as it could potentially damage your " + "documents or invade your privacy. " + "You can download it instead."), + mime_description, suggested_filename); + action_label = STOCK_DOWNLOAD; } else if (action == DOWNLOAD_ACTION_OPEN && helper_app) { - dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, - _("Open this file?")); - - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - /* translators: First %s is the file type description, - Second %s is the file name, - Third %s is the application used to open the file */ - _("File Type: “%s”.\n\nYou can open “%s” using “%s” or save it."), - mime_description, suggested_filename, - g_app_info_get_name (helper_app)); + title = _("Open this file?"); + mtype = GTK_MESSAGE_QUESTION; + /* translators: First %s is the file type description, second %s is the + * file name, third %s is the application used to open the file */ + secondary = g_strdup_printf (_("File Type: “%s”.\n\nYou can open “%s” " + "using “%s” or save it."), + mime_description, suggested_filename, + g_app_info_get_name (helper_app)); } else { - dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, - _("Download this file?")); - - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - /* translators: First %s is the file type description, - Second %s is the file name */ - _("File Type: “%s”.\n\nYou have no application able to open “%s”. " - "You can download it instead."), - mime_description, suggested_filename); + title = _("Download this file?"); + mtype = GTK_MESSAGE_QUESTION; + /* translators: First %s is the file type description, second %s is the + * file name */ + secondary = g_strdup_printf (_("File Type: “%s”.\n\nYou have no " + "application able to open “%s”. " + "You can download it instead."), + mime_description, suggested_filename); } - g_free (mime_description); + dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + mtype, GTK_BUTTONS_NONE, + title); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + secondary, NULL); - button = gtk_button_new_with_mnemonic (_("_Save As...")); - image = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_BUTTON); - gtk_button_set_image (GTK_BUTTON (button), image); - gtk_widget_set_can_default (button, TRUE); - /* don't show the image! see bug #307818 */ - gtk_widget_show (button); - gtk_dialog_add_action_widget (GTK_DIALOG (dialog), - button, DOWNLOAD_ACTION_DOWNLOAD); + g_free (mime_description); gtk_dialog_add_button (GTK_DIALOG (dialog), + GTK_STOCK_SAVE_AS, DOWNLOAD_ACTION_DOWNLOAD); + gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); gtk_dialog_add_button (GTK_DIALOG (dialog), action_label, action); @@ -900,7 +1017,6 @@ ephy_embed_constructed (GObject *object) GtkWidget *scrolled_window; WebKitWebView *web_view; WebKitWebInspector *inspector; - GtkWidget *inspector_sw; embed->priv->top_widgets_vbox = GTK_BOX (gtk_vbox_new (FALSE, 0)); gtk_box_pack_start (GTK_BOX (embed), GTK_WIDGET (embed->priv->top_widgets_vbox), @@ -929,16 +1045,16 @@ ephy_embed_constructed (GObject *object) embed->priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); inspector = webkit_web_view_get_inspector (web_view); - inspector_sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (inspector_sw), + embed->priv->inspector_scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (embed->priv->inspector_scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (embed->priv->inspector_window), - inspector_sw); + embed->priv->inspector_scrolled_window); gtk_window_set_title (GTK_WINDOW (embed->priv->inspector_window), _("Web Inspector")); gtk_window_set_default_size (GTK_WINDOW (embed->priv->inspector_window), - 600, 400); + 800, 600); g_signal_connect (embed->priv->inspector_window, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), @@ -946,16 +1062,24 @@ ephy_embed_constructed (GObject *object) g_object_connect (inspector, "signal::inspect-web-view", G_CALLBACK (ephy_embed_inspect_web_view_cb), - inspector_sw, + embed->priv->inspector_scrolled_window, "signal::show-window", G_CALLBACK (ephy_embed_inspect_show_cb), - embed->priv->inspector_window, + embed, "signal::close-window", G_CALLBACK (ephy_embed_inspect_close_cb), - embed->priv->inspector_window, + embed, + "signal::attach-window", G_CALLBACK (ephy_embed_attach_inspector_cb), + embed, + "signal::detach-window", G_CALLBACK (ephy_embed_detach_inspector_cb), + embed, NULL); ephy_embed_prefs_add_embed (embed); embed->priv->history = EPHY_HISTORY (ephy_embed_shell_get_global_history (ephy_embed_shell_get_default ())); + + g_signal_connect (embed->priv->history, + "cleared", G_CALLBACK (ephy_embed_history_cleared_cb), + embed); } static void @@ -964,6 +1088,7 @@ ephy_embed_init (EphyEmbed *embed) embed->priv = EPHY_EMBED_GET_PRIVATE (embed); embed->priv->scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL)); + embed->priv->paned = NULL; gtk_scrolled_window_set_policy (embed->priv->scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); --- epiphany-2.30.2/embed/ephy-embed-persist.c 2010-03-09 22:51:28.000000000 +0100 +++ epiphany-2.30.5/embed/ephy-embed-persist.c 2010-08-30 22:58:42.000000000 +0200 @@ -763,7 +763,36 @@ ephy_embed_persist_save (EphyEmbedPersis */ g_object_ref (persist); - request = webkit_network_request_new (priv->source); + if (priv->embed) + { + EphyWebView *web_view; + SoupMessage *msg; + gchar *referer; + + /* Get the webview associated to the embed */ + web_view = ephy_embed_get_web_view (priv->embed); + + /* Create the request with a SoupMessage to allow + setting the 'Referer' as got from the embed */ + msg = soup_message_new (SOUP_METHOD_GET, priv->source); + request = WEBKIT_NETWORK_REQUEST ( + g_object_new (WEBKIT_TYPE_NETWORK_REQUEST, + "message", msg, + NULL)); + + /* Add the referer to the request headers */ + referer = ephy_web_view_get_location (web_view, FALSE); + soup_message_headers_append (msg->request_headers, + "Referer", referer); + g_free (referer); + g_object_unref (msg); + } + else + { + /* Create a normal network request otherwise */ + request = webkit_network_request_new (priv->source); + } + priv->download = webkit_download_new (request); g_object_unref (request); @@ -795,7 +824,7 @@ ephy_embed_persist_save (EphyEmbedPersis window, GTK_FILE_CHOOSER_ACTION_SAVE, priv->persist_key, - EPHY_FILE_FILTER_ALL_SUPPORTED); + EPHY_FILE_FILTER_ALL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); --- epiphany-2.30.2/embed/ephy-embed-prefs.c 2010-02-20 10:42:51.000000000 +0100 +++ epiphany-2.30.5/embed/ephy-embed-prefs.c 2010-08-30 22:58:42.000000000 +0200 @@ -278,6 +278,49 @@ webkit_pref_callback_font_family (GConfC } } +/* Part of this code taken from libsoup (soup-session.c) */ +static gchar * +build_accept_languages_header (GArray *languages) +{ + gchar **langs = NULL; + gchar *langs_str = NULL; + gint delta; + gint i; + + g_return_val_if_fail (languages != NULL, NULL); + + /* Calculate deltas for the quality values */ + if (languages->len < 10) + delta = 10; + else if (languages->len < 20) + delta = 5; + else + delta = 1; + + /* Set quality values for each language */ + langs = (gchar **) languages->data; + for (i = 0; langs[i] != NULL; i++) { + gchar *lang = (gchar *) langs[i]; + gint quality = 100 - i * delta; + + if (quality > 0 && quality < 100) { + gchar buf[8]; + g_ascii_formatd (buf, 8, "%.2f", quality/100.0); + langs[i] = g_strdup_printf ("%s;q=%s", lang, buf); + } else { + /* Just dup the string in this case */ + langs[i] = g_strdup (lang); + } + g_free (lang); + } + + /* Get the result string */ + if (languages->len > 0) + langs_str = g_strjoinv (", ", langs); + + return langs_str; +} + /* Based on Christian Persch's code from gecko backend of epiphany (old transform_accept_languages_list() function) */ static void @@ -290,7 +333,7 @@ webkit_pref_callback_accept_languages (G GConfValue *gcvalue; GArray *array; GSList *languages, *l; - char **langs; + char **array_data; char *langs_str; char *webkit_pref; @@ -318,14 +361,15 @@ webkit_pref_callback_accept_languages (G ephy_langs_sanitise (array); - langs = (char **) g_array_free (array, FALSE); - langs_str = g_strjoinv (", ", langs); + langs_str = build_accept_languages_header (array); /* Update Soup session */ session = webkit_get_default_session (); g_object_set (G_OBJECT (session), webkit_pref, langs_str, NULL); - g_strfreev (langs); + /* Free memory */ + array_data = (char **) g_array_free (array, FALSE); + g_strfreev (array_data); g_free (langs_str); } --- epiphany-2.30.2/embed/ephy-embed-single.c 2010-02-26 02:25:49.000000000 +0100 +++ epiphany-2.30.5/embed/ephy-embed-single.c 2010-08-30 22:58:42.000000000 +0200 @@ -319,26 +319,6 @@ ephy_embed_single_class_init (EphyEmbedS G_TYPE_STRING); /** - * EphyEmbedSingle::add-sidebar: - * @single: - * @url: The url of the sidebar to be added - * @title: The title of the sidebar to be added - * - * The ::add-sidebar signal is emitted when the user clicks a javascript link that - * requests adding a url to the sidebar. - **/ - g_signal_new ("add-sidebar", - EPHY_TYPE_EMBED_SINGLE, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EphyEmbedSingleClass, add_sidebar), - g_signal_accumulator_true_handled, NULL, - ephy_marshal_BOOLEAN__STRING_STRING, - G_TYPE_BOOLEAN, - 2, - G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE, - G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE); - - /** * EphyEmbedSingle::add-search-engine * @single: * @url: The url of the search engine definition file --- epiphany-2.30.2/embed/ephy-embed-single.h 2010-01-08 19:20:59.000000000 +0100 +++ epiphany-2.30.5/embed/ephy-embed-single.h 2010-08-30 22:58:42.000000000 +0200 @@ -68,10 +68,6 @@ struct _EphyEmbedSingleClass char *mime_type, char *uri); - gboolean (* add_sidebar) (EphyEmbedSingle *single, - const char *url, - const char *title); - gboolean (* add_search_engine) (EphyEmbedSingle *single, const char *url, const char *icon_url, --- epiphany-2.30.2/embed/ephy-favicon-cache.c 2010-01-08 19:20:59.000000000 +0100 +++ epiphany-2.30.5/embed/ephy-favicon-cache.c 2010-08-30 22:58:42.000000000 +0200 @@ -101,7 +101,6 @@ enum EPHY_NODE_FAVICON_PROP_FILENAME = 3, EPHY_NODE_FAVICON_PROP_LAST_USED = 4, EPHY_NODE_FAVICON_PROP_STATE = 5, - EPHY_NODE_FAVICON_PROP_CHECKOLD = 6, EPHY_NODE_FAVICON_PROP_CHECKED = 7, }; @@ -444,13 +443,33 @@ ephy_favicon_cache_finalize (GObject *ob G_OBJECT_CLASS (ephy_favicon_cache_parent_class)->finalize (object); } +static gboolean +is_valid_mime_type (const char *mime_type) +{ + + gboolean valid = FALSE; + + valid = g_strcmp0 (mime_type, "image/x-ico") == 0 || + g_strcmp0 (mime_type, "image/vnd.microsoft.icon") == 0 || + g_strcmp0 (mime_type, "image/png") == 0 || + g_strcmp0 (mime_type, "image/gif") == 0 || + g_strcmp0 (mime_type, "application/octet-stream") == 0; + + return valid; +} + static void favicon_download_status_changed_cb (WebKitDownload *download, GParamSpec *spec, EphyFaviconCache *cache) { WebKitDownloadStatus status = webkit_download_get_status (download); - const char* url = webkit_download_get_uri (download); + const char *url = webkit_download_get_uri (download); + const char *destination = webkit_download_get_destination_uri (download); + const char *mime_type; + GFile *file; + GFileInfo *file_info; + gboolean valid; switch (status) { case WEBKIT_DOWNLOAD_STATUS_FINISHED: @@ -458,12 +477,30 @@ favicon_download_status_changed_cb (WebK g_hash_table_remove (cache->priv->downloads_hash, url); - g_signal_emit (G_OBJECT (cache), signals[CHANGED], 0, url); + file = g_file_new_for_uri (destination); + file_info = g_file_query_info (file, + G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, + 0, NULL, NULL); + + mime_type = g_file_info_get_content_type (file_info); + valid = is_valid_mime_type (mime_type); + + if (!valid) + { + LOG ("Deleting invalid %s type", mime_type); + g_file_delete (file, NULL, NULL); + } + else + { + g_signal_emit (G_OBJECT (cache), signals[CHANGED], 0, url); + } + + g_object_unref (file); + g_object_unref (file_info); g_object_unref (download); cache->priv->dirty = TRUE; - break; case WEBKIT_DOWNLOAD_STATUS_ERROR: case WEBKIT_DOWNLOAD_STATUS_CANCELLED: @@ -471,9 +508,15 @@ favicon_download_status_changed_cb (WebK g_hash_table_remove (cache->priv->downloads_hash, url); - /* TODO: remove a partially downloaded file */ /* FIXME: re-schedule to try again after n days? */ + file = g_file_new_for_uri (destination); + if (g_file_query_exists (file, NULL)) + { + LOG ("Deleting incomplete favicon download"); + g_file_delete (file, NULL, NULL); + } + g_object_unref (file); g_object_unref (download); cache->priv->dirty = TRUE; @@ -522,7 +565,7 @@ ephy_favicon_cache_download (EphyFavicon /** * ephy_favicons_cache_get: - * @cache: + * @cache: an #EphyFaviconCache * @url: the URL of the icon to retrieve * * Note: This will always return %NULL for non-http URLs. @@ -682,18 +725,16 @@ ephy_favicon_cache_get (EphyFaviconCache { return NULL; } - valid = strcmp (mime_type, "image/x-ico") == 0 || - strcmp (mime_type, "image/vnd.microsoft.icon") == 0 || - strcmp (mime_type, "image/png") == 0 || - strcmp (mime_type, "image/gif") == 0; - is_ao = strcmp (mime_type, "application/octet-stream") == 0; + + valid = is_valid_mime_type (mime_type); + is_ao = g_strcmp0 (mime_type, "application/octet-stream") == 0; g_object_unref (file_info); - g_object_unref (file); - /* As a special measure, we try to load an application/octet-stream file - * as an ICO file, since we cannot detect a ICO file without .ico extension - * (the mime system has no magic for it). + /* As a special measure, we try to load an + * application/octet-stream file as an ICO file, since we + * cannot detect a ICO file without .ico extension (the mime + * system has no magic for it). */ if (is_ao) { @@ -731,16 +772,13 @@ ephy_favicon_cache_get (EphyFaviconCache else { /* remove invalid file from cache */ - /* gnome_vfs_unlink (pix_file); */ + g_file_delete (file, NULL, NULL); } + g_object_unref (file); ephy_node_set_property_int (icon, EPHY_NODE_FAVICON_PROP_CHECKED, (int) checklevel); - - /* epiphany 1.6 compat */ - ephy_node_set_property_boolean - (icon, EPHY_NODE_FAVICON_PROP_CHECKOLD, valid); } /* if it still needs the check, mime type couldn't be checked. Deny! */ @@ -795,7 +833,7 @@ ephy_favicon_cache_get (EphyFaviconCache /** * ephy_favicons_cache_clear: - * @cache: + * @cache: the #EphyFaviconCache to clear * * Clears the favicon cache and removes any stored icon files from disk. */ --- epiphany-2.30.2/embed/ephy-web-view.c 2010-04-07 10:37:25.000000000 +0200 +++ epiphany-2.30.5/embed/ephy-web-view.c 2010-08-30 22:58:42.000000000 +0200 @@ -1247,8 +1247,21 @@ do_hook_into_links (JSContextRef js_cont char *type = js_get_element_attribute (js_context, obj, "type"); char *title = js_get_element_attribute (js_context, obj, "title"); char *address = js_get_element_attribute (js_context, obj, "href"); + SoupURI *feed_uri, *current_uri; - g_signal_emit_by_name (web_view, "ge-feed-link", type, title, address); + feed_uri = soup_uri_new (address); + if (!feed_uri) { + current_uri = soup_uri_new (ephy_web_view_get_address (web_view)); + feed_uri = soup_uri_new_with_base (current_uri, address); + soup_uri_free (current_uri); + } + + if (feed_uri) { + g_free (address); + address = soup_uri_to_string (feed_uri, FALSE); + g_signal_emit_by_name (web_view, "ge-feed-link", type, title, address); + soup_uri_free (feed_uri); + } g_free (type); g_free (title); @@ -1623,24 +1636,6 @@ ephy_web_view_class_init (EphyWebViewCla 0); /** - * EphyWebView::dom-content-loaded: - * @view: the #EphyWebView that received the signal - * - * The ::dom-content-loaded signal is emitted when - * the document has been loaded (excluding images and other loads initiated by this document). - * That's true also for frameset and all the frames within it. - **/ - g_signal_new ("dom_content_loaded", - EPHY_TYPE_WEB_VIEW, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EphyWebViewClass, dom_content_loaded), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, - 1, - G_TYPE_POINTER); - -/** * EphyWebView::search-key-press: * @view: the #EphyWebView that received the signal * @event: the #GdkEventKey which triggered this signal @@ -2045,6 +2040,32 @@ normalize_or_autosearch_url (EphyWebView return effective_url; } +static void +update_navigation_flags (EphyWebView *view) +{ + EphyWebViewPrivate *priv = view->priv; + guint flags = 0; + WebKitWebView *web_view = WEBKIT_WEB_VIEW (view); + + if (ephy_web_view_can_go_up (view)) { + flags |= EPHY_WEB_VIEW_NAV_UP; + } + + if (webkit_web_view_can_go_back (web_view)) { + flags |= EPHY_WEB_VIEW_NAV_BACK; + } + + if (webkit_web_view_can_go_forward (web_view)) { + flags |= EPHY_WEB_VIEW_NAV_FORWARD; + } + + if (priv->nav_flags != (EphyWebViewNavigationFlags)flags) { + priv->nav_flags = (EphyWebViewNavigationFlags)flags; + + g_object_notify (G_OBJECT (view), "navigation"); + } +} + /** * ephy_web_view_load_request: * @view: the #EphyWebView in which to load the request @@ -2150,6 +2171,36 @@ ephy_web_view_copy_back_history (EphyWeb } /** + * ephy_web_view_clear_history: + * @view: the #EphyWebView to clear the history from + * + * Clears history of @view. + **/ +void +ephy_web_view_clear_history (EphyWebView *view) +{ + WebKitWebBackForwardList *history_list; + + g_return_if_fail (EPHY_IS_WEB_VIEW (view)); + + history_list = webkit_web_view_get_back_forward_list (WEBKIT_WEB_VIEW (view)); + if (history_list != NULL) { + WebKitWebHistoryItem *current_item; + + /* Save a ref to the first element to add it later */ + current_item = webkit_web_back_forward_list_get_current_item (history_list); + g_object_ref (current_item); + + /* Clear the history and add the first element once again */ + webkit_web_back_forward_list_clear (history_list); + webkit_web_back_forward_list_add_item (history_list, current_item); + g_object_unref (current_item); + + update_navigation_flags (view); + } +} + +/** * ephy_web_view_set_address: * @view: an #EphyWebView * @address: address to set @view to @@ -2330,32 +2381,6 @@ update_net_state_message (EphyWebView *v g_free (host); } -static void -update_navigation_flags (EphyWebView *view) -{ - EphyWebViewPrivate *priv = view->priv; - guint flags = 0; - WebKitWebView *web_view = WEBKIT_WEB_VIEW (view); - - if (ephy_web_view_can_go_up (view)) { - flags |= EPHY_WEB_VIEW_NAV_UP; - } - - if (webkit_web_view_can_go_back (web_view)) { - flags |= EPHY_WEB_VIEW_NAV_BACK; - } - - if (webkit_web_view_can_go_forward (web_view)) { - flags |= EPHY_WEB_VIEW_NAV_FORWARD; - } - - if (priv->nav_flags != (EphyWebViewNavigationFlags)flags) { - priv->nav_flags = (EphyWebViewNavigationFlags)flags; - - g_object_notify (G_OBJECT (view), "navigation"); - } -} - /** * ephy_web_view_update_from_net_state: * @view: an #EphyWebView @@ -2658,7 +2683,7 @@ ephy_web_view_can_go_up (EphyWebView *vi return FALSE; } - result = (uri->fragment || uri->query || strlen (uri->path) > 1); + result = uri->fragment || uri->query || (uri->path && (strlen (uri->path) > 1)); soup_uri_free (uri); return result; --- epiphany-2.30.2/embed/ephy-web-view.h 2010-04-07 10:37:25.000000000 +0200 +++ epiphany-2.30.5/embed/ephy-web-view.h 2010-08-30 22:58:42.000000000 +0200 @@ -124,8 +124,6 @@ struct _EphyWebViewClass EphyEmbedEvent *event); gboolean (* dom_mouse_down) (EphyWebView *view, EphyEmbedEvent *event); - void (* dom_content_loaded) (EphyWebView *view, - gpointer event); void (* popup_blocked) (EphyWebView *view, const char *address, const char *target, @@ -155,6 +153,7 @@ void ephy_web_view const char *url); void ephy_web_view_copy_back_history (EphyWebView *source, EphyWebView *dest); +void ephy_web_view_clear_history (EphyWebView *view); gboolean ephy_web_view_is_loading (EphyWebView *view); const char * ephy_web_view_get_loading_title (EphyWebView *view); GdkPixbuf * ephy_web_view_get_icon (EphyWebView *view); --- epiphany-2.30.2/lib/egg/eggmarshalers.h 2010-01-11 21:38:12.000000000 +0100 +++ epiphany-2.30.5/lib/egg/eggmarshalers.h 2010-08-31 00:55:51.000000000 +0200 @@ -6,7 +6,7 @@ G_BEGIN_DECLS -/* VOID:INT,INT (../../../lib/egg/eggmarshalers.list:1) */ +/* VOID:INT,INT (./eggmarshalers.list:1) */ extern void _egg_marshal_VOID__INT_INT (GClosure *closure, GValue *return_value, guint n_param_values, --- epiphany-2.30.2/lib/ephy-file-helpers.c 2010-02-27 11:26:59.000000000 +0100 +++ epiphany-2.30.5/lib/ephy-file-helpers.c 2010-08-30 22:58:42.000000000 +0200 @@ -229,7 +229,7 @@ ephy_file_tmp_filename (const char *base int fd; char *name = g_strdup (base); - fd = mkstemp (name); + fd = g_mkstemp (name); if (fd != -1) { --- epiphany-2.30.2/lib/ephy-gui.c 2010-01-08 19:21:00.000000000 +0100 +++ epiphany-2.30.5/lib/ephy-gui.c 2010-08-30 22:58:42.000000000 +0200 @@ -20,7 +20,6 @@ #include "config.h" #include "ephy-gui.h" -#include "eel-gconf-extensions.h" #include "ephy-stock-icons.h" #include "ephy-debug.h" @@ -506,45 +505,3 @@ ephy_gui_message_dialog_get_content_box return container; } - -/* Until bug #345349 is fixed */ -void -ephy_gui_message_dialog_set_wrap_mode (GtkMessageDialog *dialog, - PangoWrapMode wrap_mode) -{ - GtkContainer *container; - GList *children, *l; - - container = GTK_CONTAINER (dialog->label->parent); - g_return_if_fail (GTK_IS_CONTAINER (container)); - - children = gtk_container_get_children (container); - for (l = children; l != NULL; l = l->next) - { - GtkWidget *child = l->data; - - if (GTK_IS_LABEL (child)) - { - g_print ("Setting wrap mode on label %p\n", child); - gtk_label_set_line_wrap_mode (GTK_LABEL (child), - wrap_mode); - } - } -} - -static void -checkbutton_toggled_cb (GtkToggleButton *button, - const char *pref) -{ - eel_gconf_set_boolean (pref, gtk_toggle_button_get_active (button)); -} - -void -ephy_gui_connect_checkbutton_to_gconf (GtkWidget *widget, - const char *pref) -{ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), - eel_gconf_get_boolean (pref)); - g_signal_connect (widget, "toggled", - G_CALLBACK (checkbutton_toggled_cb), (gpointer) pref); -} --- epiphany-2.30.2/lib/ephy-gui.h 2010-01-08 19:21:00.000000000 +0100 +++ epiphany-2.30.5/lib/ephy-gui.h 2010-08-30 22:58:42.000000000 +0200 @@ -72,9 +72,6 @@ void ephy_gui_window_update_user_time GtkWidget *ephy_gui_message_dialog_get_content_box (GtkWidget *dialog); -void ephy_gui_message_dialog_set_wrap_mode (GtkMessageDialog *dialog, - PangoWrapMode wrap_mode); - void ephy_gui_connect_checkbutton_to_gconf (GtkWidget *widget, const char *pref); --- epiphany-2.30.2/lib/widgets/ephy-location-entry.c 2010-02-11 15:51:53.000000000 +0100 +++ epiphany-2.30.5/lib/widgets/ephy-location-entry.c 2010-08-30 22:58:42.000000000 +0200 @@ -466,8 +466,6 @@ editable_changed_cb (GtkEditable *editab g_regex_unref (quote_regex); } - update_favicon (entry); - g_signal_emit (entry, signals[USER_CHANGED], 0); } @@ -736,8 +734,8 @@ each_url_get_data_binder (EphyDragEachSe g_free (title); } -#define DRAG_ICON_LAYOUT_BORDER 2 -#define DRAG_ICON_ICON_SPACING DRAG_ICON_LAYOUT_BORDER * 2 +#define DRAG_ICON_LAYOUT_PADDING 2 +#define DRAG_ICON_ICON_PADDING 4 #define DRAG_ICON_MAX_WIDTH_CHARS 32 static GdkPixmap * @@ -754,8 +752,12 @@ favicon_create_drag_pixmap (EphyLocation PangoFontMetrics *metrics; int pixmap_height, pixmap_width; int layout_width, layout_height; - int icon_width = 0, icon_height = 0, offset_x = 0; + int icon_width = 0, icon_height = 0, favicon_offset_x = 0; int char_width; + cairo_t *cr; + GtkStateType state; + + state = gtk_widget_get_state (widget); g_signal_emit (entry, signals[GET_LOCATION], 0, &address); g_signal_emit (entry, signals[GET_TITLE], 0, &title); @@ -776,8 +778,6 @@ favicon_create_drag_pixmap (EphyLocation g_string_append (text, address); } - /* Now build the pixmap */ - if (priv->favicon != NULL) { icon_width = gdk_pixbuf_get_width (priv->favicon); @@ -787,7 +787,6 @@ favicon_create_drag_pixmap (EphyLocation context = gtk_widget_get_pango_context (widget); layout = pango_layout_new (context); - context = gtk_widget_get_pango_context (widget); style = gtk_widget_get_style (widget); metrics = pango_context_get_metrics (context, style->font_desc, @@ -800,64 +799,57 @@ favicon_create_drag_pixmap (EphyLocation pango_layout_set_width (layout, char_width * DRAG_ICON_MAX_WIDTH_CHARS); pango_layout_set_text (layout, text->str, text->len); - pango_layout_get_size (layout, &layout_width, &layout_height); - - pixmap_width = layout_width / PANGO_SCALE + DRAG_ICON_LAYOUT_BORDER * 2; + pango_layout_get_pixel_size (layout, &layout_width, &layout_height); if (priv->favicon != NULL) { - offset_x = icon_width + 2 * DRAG_ICON_ICON_SPACING; - pixmap_width += offset_x; - pixmap_height = MAX (layout_height / PANGO_SCALE, icon_height) + DRAG_ICON_LAYOUT_BORDER * 2; - } - else - { - pixmap_height = layout_height / PANGO_SCALE + DRAG_ICON_LAYOUT_BORDER * 2; + favicon_offset_x = icon_width + (2 * DRAG_ICON_ICON_PADDING); } + pixmap_width = layout_width + favicon_offset_x + + (DRAG_ICON_LAYOUT_PADDING * 2); + pixmap_height = MAX (layout_height, icon_height) + + (DRAG_ICON_LAYOUT_PADDING * 2); + drawable = gdk_pixmap_new (gtk_widget_get_window (widget), - pixmap_width + 2, + pixmap_width + 2, pixmap_height + 2, -1); + cr = gdk_cairo_create (drawable); + + cairo_rectangle (cr, 1, 1, pixmap_width, pixmap_height); + cairo_set_line_width (cr, 1.0); - gdk_draw_rectangle (drawable, - style->base_gc [gtk_widget_get_state (widget)], - TRUE, - 0, 0, - pixmap_width + 1, - pixmap_height + 1); + cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); + cairo_stroke_preserve (cr); + gdk_cairo_set_source_color (cr, &style->bg[state]); + cairo_fill (cr); if (priv->favicon != NULL) { - gdk_draw_pixbuf (drawable, - style->fg_gc[gtk_widget_get_state (widget)], - priv->favicon, - 0, 0, - 1 + DRAG_ICON_LAYOUT_BORDER + DRAG_ICON_ICON_SPACING, - 1 + DRAG_ICON_LAYOUT_BORDER + (pixmap_height - icon_height) / 2, - -1, -1, - GDK_RGB_DITHER_NONE, 0, 0); - } - - gdk_draw_layout (drawable, - style->text_gc [gtk_widget_get_state (widget)], - 1 + DRAG_ICON_LAYOUT_BORDER + offset_x, - 1 + DRAG_ICON_LAYOUT_BORDER, - layout); - - gdk_draw_rectangle (drawable, - style->black_gc, - FALSE, - 0, 0, - pixmap_width + 1, - pixmap_height + 1); + double x; + double y; + + x = 1 + DRAG_ICON_LAYOUT_PADDING + DRAG_ICON_ICON_PADDING; + y = 1 + DRAG_ICON_LAYOUT_PADDING + (pixmap_height - icon_height) / 2; + gdk_cairo_set_source_pixbuf (cr, priv->favicon, x, y); + cairo_rectangle (cr, x, y, icon_width, icon_height); + cairo_fill (cr); + } + + cairo_move_to (cr, + 1 + DRAG_ICON_LAYOUT_PADDING + favicon_offset_x, + 1 + DRAG_ICON_LAYOUT_PADDING); + gdk_cairo_set_source_color (cr, &style->text[state]); + pango_cairo_show_layout (cr, layout); + cairo_destroy (cr); g_object_unref (layout); g_free (address); g_free (title); - g_string_free (text,TRUE); + g_string_free (text, TRUE); return drawable; } @@ -1253,16 +1245,11 @@ ephy_location_entry_set_completion (Ephy g_signal_connect_after (completion, "action-activated", G_CALLBACK (action_activated_after_cb), entry); - /* FIXME: this works fine, but the favicons seem to be - * added-removed the view constantly, and the visual effect is - * very ugly */ -#if 0 cell = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (completion), cell, FALSE); gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion), cell, "pixbuf", favicon_col); -#endif cell = gtk_cell_renderer_text_new (); g_object_set (cell, --- epiphany-2.30.2/lib/widgets/ephy-spinner.c 2010-02-11 15:51:53.000000000 +0100 +++ epiphany-2.30.5/lib/widgets/ephy-spinner.c 2010-08-30 22:58:42.000000000 +0200 @@ -625,8 +625,7 @@ ephy_spinner_expose (GtkWidget *widget, EphySpinnerImages *images; GtkAllocation allocation; GdkPixbuf *pixbuf; - GdkWindow *window; - GdkGC *gc; + cairo_t *cr; int x_offset, y_offset, width, height; GdkRectangle pix_area, dest; @@ -675,15 +674,12 @@ ephy_spinner_expose (GtkWidget *widget, return FALSE; } - window = gtk_widget_get_window (widget); - gc = gdk_gc_new (window); - gdk_draw_pixbuf (window, gc, pixbuf, - dest.x - x_offset - allocation.x, - dest.y - y_offset - allocation.y, - dest.x, dest.y, - dest.width, dest.height, - GDK_RGB_DITHER_MAX, 0, 0); - g_object_unref (gc); + cr = gdk_cairo_create (gtk_widget_get_window (widget)); + + gdk_cairo_set_source_pixbuf (cr, pixbuf, dest.x, dest.y); + cairo_paint (cr); + + cairo_destroy (cr); return FALSE; } --- epiphany-2.30.2/src/ephy-action-helper.h 2010-01-08 19:21:01.000000000 +0100 +++ epiphany-2.30.5/src/ephy-action-helper.h 2010-08-19 04:44:26.000000000 +0200 @@ -28,6 +28,11 @@ G_BEGIN_DECLS +enum +{ + SENS_FLAG = 1 << 0 +}; + void ephy_action_change_sensitivity_flags (GtkAction *action, guint flags, gboolean set); --- epiphany-2.30.2/src/ephy-find-toolbar.c 2010-02-08 20:18:47.000000000 +0100 +++ epiphany-2.30.5/src/ephy-find-toolbar.c 2010-08-30 22:58:42.000000000 +0200 @@ -73,10 +73,16 @@ enum typedef enum { - EPHY_FIND_FOUND = 0, - EPHY_FIND_NOTFOUND = 1, - EPHY_FIND_FOUNDWRAPPED = 2 -} EphyEmbedFindResult; + EPHY_FIND_RESULT_FOUND = 0, + EPHY_FIND_RESULT_NOTFOUND = 1, + EPHY_FIND_RESULT_FOUNDWRAPPED = 2 +} EphyFindResult; + +typedef enum +{ + EPHY_FIND_DIRECTION_NEXT, + EPHY_FIND_DIRECTION_PREV +} EphyFindDirection; static guint signals[LAST_SIGNAL]; @@ -131,7 +137,7 @@ set_status_notfound_cb (EphyFindToolbar static void set_status (EphyFindToolbar *toolbar, - EphyEmbedFindResult result) + EphyFindResult result) { EphyFindToolbarPrivate *priv = toolbar->priv; char *text = NULL; @@ -139,10 +145,10 @@ set_status (EphyFindToolbar *toolbar, switch (result) { - case EPHY_FIND_FOUND: + case EPHY_FIND_RESULT_FOUND: text = NULL; break; - case EPHY_FIND_NOTFOUND: + case EPHY_FIND_RESULT_NOTFOUND: { text = _("Not found"); @@ -155,7 +161,7 @@ set_status (EphyFindToolbar *toolbar, priv->source_id = g_timeout_add (500, (GSourceFunc) set_status_notfound_cb, toolbar); } break; - case EPHY_FIND_FOUNDWRAPPED: + case EPHY_FIND_RESULT_FOUNDWRAPPED: text = _("Wrapped"); break; } @@ -239,15 +245,16 @@ ephy_find_toolbar_mark_matches (EphyFind webkit_web_view_set_highlight_text_matches (web_view, TRUE); } -static EphyEmbedFindResult +static EphyFindResult real_find (EphyFindToolbarPrivate *priv, - gboolean forward) + EphyFindDirection direction) { WebKitWebView *web_view = priv->web_view; gboolean case_sensitive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->case_sensitive)); + gboolean forward = (direction == EPHY_FIND_DIRECTION_NEXT); if (!priv->find_string || !g_strcmp0 (priv->find_string, "")) - return EPHY_FIND_NOTFOUND; + return EPHY_FIND_RESULT_NOTFOUND; if (!webkit_web_view_search_text (web_view, priv->find_string, case_sensitive, forward, FALSE)) { @@ -255,27 +262,27 @@ real_find (EphyFindToolbarPrivate *priv, if (!webkit_web_view_search_text (web_view, priv->find_string, case_sensitive, forward, TRUE)) { /* there's no result */ - return EPHY_FIND_NOTFOUND; + return EPHY_FIND_RESULT_NOTFOUND; } else { /* found wrapped */ - return EPHY_FIND_FOUNDWRAPPED; + return EPHY_FIND_RESULT_FOUNDWRAPPED; } } - return EPHY_FIND_FOUND; + return EPHY_FIND_RESULT_FOUND; } static gboolean do_search (EphyFindToolbar *toolbar) { EphyFindToolbarPrivate *priv = toolbar->priv; - EphyEmbedFindResult result; + EphyFindResult result; priv->find_source_id = 0; ephy_find_toolbar_mark_matches (toolbar); - result = real_find (priv, TRUE); + result = real_find (priv, EPHY_FIND_DIRECTION_NEXT); set_status (toolbar, result); return FALSE; @@ -429,11 +436,12 @@ case_sensitive_toggled_cb (GtkWidget *ch */ if (case_sensitive) { - EphyEmbedFindResult result; + EphyFindResult result; - result = real_find (toolbar->priv, FALSE); - if (result != EPHY_FIND_NOTFOUND) - result = real_find (toolbar->priv, TRUE); + result = real_find (toolbar->priv, EPHY_FIND_DIRECTION_PREV); + if (result != EPHY_FIND_RESULT_NOTFOUND) + result = real_find (toolbar->priv, + EPHY_FIND_DIRECTION_NEXT); set_status (toolbar, result); } @@ -778,7 +786,8 @@ ephy_find_toolbar_set_embed (EphyFindToo typedef struct { EphyFindToolbar *toolbar; - gboolean next; + gboolean direction; + gboolean highlight; } FindAgainCBStruct; static void @@ -787,24 +796,19 @@ find_again_data_destroy_cb (FindAgainCBS g_slice_free (FindAgainCBStruct, data); } -static EphyEmbedFindResult -ephy_find_toolbar_find_again (EphyFindToolbar *toolbar, - gboolean forward, - gboolean links_only) -{ - EphyFindToolbarPrivate *priv = toolbar->priv; - - return real_find (priv, forward); -} - static gboolean find_again_cb (FindAgainCBStruct *data) { - EphyEmbedFindResult result; + EphyFindResult result; EphyFindToolbarPrivate *priv = data->toolbar->priv; - result = ephy_find_toolbar_find_again (data->toolbar, data->next, - priv->links_only); + result = real_find (priv, data->direction); + + /* Highlight matches again if the toolbar was hidden when the user + * requested find-again. */ + if (result != EPHY_FIND_RESULT_NOTFOUND && data->highlight) + ephy_find_toolbar_mark_matches (data->toolbar); + set_status (data->toolbar, result); priv->find_again_source_id = 0; @@ -812,28 +816,30 @@ find_again_cb (FindAgainCBStruct *data) return FALSE; } -void -ephy_find_toolbar_find_next (EphyFindToolbar *toolbar) +static void +find_again (EphyFindToolbar *toolbar, EphyFindDirection direction) { GtkWidget *widget = GTK_WIDGET (toolbar); EphyFindToolbarPrivate *priv = toolbar->priv; FindAgainCBStruct *data; + gboolean visible; - if (!gtk_widget_get_visible (widget)) { + visible = gtk_widget_get_visible (widget); + if (!visible) { gtk_widget_show (widget); gtk_widget_grab_focus (widget); } - /* We need to do this here (and in find_previous) to give time to the embed - * to sync with the size change due to the toolbar being shown, otherwise - * the toolbar can obscure the result. See GNOME bug #415074. + /* We need to do this to give time to the embed to sync with the size + * change due to the toolbar being shown, otherwise the toolbar can + * obscure the result. See GNOME bug #415074. */ - if (priv->find_again_source_id != 0) return; data = g_slice_new0 (FindAgainCBStruct); data->toolbar = toolbar; - data->next = TRUE; + data->direction = direction; + data->highlight = !visible; priv->find_again_source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc) find_again_cb, @@ -842,27 +848,15 @@ ephy_find_toolbar_find_next (EphyFindToo } void -ephy_find_toolbar_find_previous (EphyFindToolbar *toolbar) +ephy_find_toolbar_find_next (EphyFindToolbar *toolbar) { - GtkWidget *widget = GTK_WIDGET (toolbar); - EphyFindToolbarPrivate *priv = toolbar->priv; - FindAgainCBStruct *data; - - if (!gtk_widget_get_visible (widget)) { - gtk_widget_show (widget); - gtk_widget_grab_focus (widget); - } - - if (priv->find_again_source_id != 0) return; - - data = g_slice_new0 (FindAgainCBStruct); - data->toolbar = toolbar; - data->next = FALSE; + find_again (toolbar, EPHY_FIND_DIRECTION_NEXT); +} - priv->find_again_source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, - (GSourceFunc) find_again_cb, - data, - (GDestroyNotify) find_again_data_destroy_cb); +void +ephy_find_toolbar_find_previous (EphyFindToolbar *toolbar) +{ + find_again (toolbar, EPHY_FIND_DIRECTION_PREV); } void @@ -885,15 +879,6 @@ ephy_find_toolbar_open (EphyFindToolbar gtk_widget_grab_focus (GTK_WIDGET (toolbar)); } -static void -ephy_find_toolbar_set_selection (EphyFindToolbar *toolbar, - gboolean attention) -{ - WebKitWebView *web_view = toolbar->priv->web_view; - - webkit_web_view_set_highlight_text_matches (web_view, attention); -} - void ephy_find_toolbar_close (EphyFindToolbar *toolbar) { @@ -902,7 +887,8 @@ ephy_find_toolbar_close (EphyFindToolbar gtk_widget_hide (GTK_WIDGET (toolbar)); if (priv->web_view == NULL) return; - ephy_find_toolbar_set_selection (toolbar, FALSE); + + webkit_web_view_set_highlight_text_matches (priv->web_view, FALSE); } void --- epiphany-2.30.2/src/ephy-location-action.c 2010-02-15 20:05:56.000000000 +0100 +++ epiphany-2.30.5/src/ephy-location-action.c 2010-08-30 22:58:42.000000000 +0200 @@ -101,7 +101,6 @@ match_func (GtkEntryCompletion *completi char *item = NULL; char *url = NULL; char *keywords = NULL; - char *extra = NULL; gboolean ret = FALSE; GtkTreeModel *model; @@ -113,7 +112,6 @@ match_func (GtkEntryCompletion *completi EPHY_COMPLETION_TEXT_COL, &item, EPHY_COMPLETION_URL_COL, &url, EPHY_COMPLETION_KEYWORDS_COL, &keywords, - EPHY_COMPLETION_EXTRA_COL, &extra, -1); if (!key) @@ -441,7 +439,7 @@ focus_out_event_cb (GtkWidget *entry, static void switch_page_cb (GtkNotebook *notebook, - GtkNotebookPage *page, + GtkWidget *page, guint page_num, GtkAction *action) { --- epiphany-2.30.2/src/ephy-navigation-action.c 2010-04-07 11:47:52.000000000 +0200 +++ epiphany-2.30.5/src/ephy-navigation-action.c 2010-08-30 22:55:16.000000000 +0200 @@ -25,11 +25,8 @@ #include "ephy-navigation-action.h" #include "ephy-debug.h" -#include "ephy-embed-container.h" #include "ephy-embed-shell.h" -#include "ephy-embed-utils.h" #include "ephy-favicon-cache.h" -#include "ephy-gui.h" #include "ephy-history.h" #include "ephy-link.h" #include "ephy-shell.h" @@ -39,21 +36,11 @@ #include <gtk/gtk.h> #include <webkit/webkit.h> -#define HISTORY_ITEM_DATA_KEY "HistoryItem" -#define URL_DATA_KEY "GoURL" - #define EPHY_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_NAVIGATION_ACTION, EphyNavigationActionPrivate)) -typedef enum -{ - WEBKIT_HISTORY_BACKWARD, - WEBKIT_HISTORY_FORWARD -} WebKitHistoryType; - struct _EphyNavigationActionPrivate { EphyWindow *window; - EphyNavigationDirection direction; char *arrow_tooltip; guint statusbar_cid; }; @@ -62,7 +49,6 @@ enum { PROP_0, PROP_ARROW_TOOLTIP, - PROP_DIRECTION, PROP_WINDOW }; @@ -71,264 +57,15 @@ static void ephy_navigation_action_class G_DEFINE_TYPE (EphyNavigationAction, ephy_navigation_action, EPHY_TYPE_LINK_ACTION) -#define MAX_LABEL_LENGTH 48 - -static GtkWidget * -new_history_menu_item (const char *origtext, - const char *address) -{ - EphyFaviconCache *cache; - EphyHistory *history; - GtkWidget *item, *image; - GdkPixbuf *icon = NULL; - GtkLabel *label; - const char *icon_address; - - g_return_val_if_fail (address != NULL && origtext != NULL, NULL); - - item = gtk_image_menu_item_new_with_label (origtext); - - label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))); - gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); - gtk_label_set_max_width_chars (label, MAX_LABEL_LENGTH); - - 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 *menuitem, - EphyNavigationAction *action) -{ - WebKitWebHistoryItem *item; - EphyEmbed *embed; - - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (action->priv->window)); - g_return_if_fail (embed != NULL); - - if (ephy_gui_is_middle_click ()) - { - embed = ephy_link_open (EPHY_LINK (action), "about:blank", NULL, - EPHY_LINK_NEW_TAB); - g_return_if_fail (embed != NULL); - } - - item = (WebKitWebHistoryItem*)g_object_get_data (G_OBJECT (menuitem), HISTORY_ITEM_DATA_KEY); - g_return_if_fail (item != NULL); - - webkit_web_view_go_to_back_forward_item (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed), item); -} - -static void -select_menu_item_cb (GtkWidget *menuitem, - EphyNavigationAction *action) -{ - const char *url; - GtkWidget *statusbar; - WebKitWebHistoryItem *item; - - item = (WebKitWebHistoryItem*)g_object_get_data (G_OBJECT (menuitem), HISTORY_ITEM_DATA_KEY); - if (item) - { - url = webkit_web_history_item_get_uri (item); - } - else - { - url = g_object_get_data (G_OBJECT (menuitem), URL_DATA_KEY); - g_return_if_fail (url != NULL); - } - - statusbar = ephy_window_get_statusbar (action->priv->window); - - gtk_statusbar_push (GTK_STATUSBAR (statusbar), action->priv->statusbar_cid, url); -} - -static void -deselect_menu_item_cb (GtkWidget *menuitem, - EphyNavigationAction *action) -{ - GtkWidget *statusbar; - - statusbar = ephy_window_get_statusbar (action->priv->window); - - gtk_statusbar_pop (GTK_STATUSBAR (statusbar), action->priv->statusbar_cid); -} - -static void -activate_up_menu_item_cb (GtkWidget *menuitem, - EphyNavigationAction *action) -{ - EphyEmbed *embed; - char *url; - - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (action->priv->window)); - g_return_if_fail (embed != NULL); - - url = g_object_get_data (G_OBJECT (menuitem), URL_DATA_KEY); - g_return_if_fail (url != NULL); - - ephy_link_open (EPHY_LINK (action), url, NULL, - ephy_gui_is_middle_click () ? EPHY_LINK_NEW_TAB : 0); -} - -static GList* -webkit_construct_history_list (WebKitWebView *web_view, WebKitHistoryType hist_type) -{ - WebKitWebBackForwardList *web_back_forward_list; - GList *webkit_items; - - web_back_forward_list = webkit_web_view_get_back_forward_list (web_view); - - if (hist_type == WEBKIT_HISTORY_FORWARD) - webkit_items = g_list_reverse (webkit_web_back_forward_list_get_forward_list_with_limit (web_back_forward_list, - EPHY_WEBKIT_BACK_FORWARD_LIMIT)); - else - webkit_items = webkit_web_back_forward_list_get_back_list_with_limit (web_back_forward_list, - EPHY_WEBKIT_BACK_FORWARD_LIMIT); - - return webkit_items; -} - -static GtkWidget * -build_back_or_forward_menu (EphyNavigationAction *action) -{ - EphyWindow *window = action->priv->window; - GtkMenuShell *menu; - EphyEmbed *embed; - GList *list, *l; - WebKitWebView *web_view; - - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); - g_return_val_if_fail (embed != NULL, NULL); - - web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); - g_return_val_if_fail (web_view != NULL, NULL); - - if (action->priv->direction == EPHY_NAVIGATION_DIRECTION_BACK) - list = webkit_construct_history_list (web_view, - WEBKIT_HISTORY_BACKWARD); - else - list = webkit_construct_history_list (web_view, - WEBKIT_HISTORY_FORWARD); - - menu = GTK_MENU_SHELL (gtk_menu_new ()); - l = list; - - for (l = list; l != NULL; l = l->next) - { - GtkWidget *item; - WebKitWebHistoryItem *hitem; - const char *url; - char *title; - - hitem = (WebKitWebHistoryItem*)l->data; - url = webkit_web_history_item_get_uri (hitem); - - title = g_strdup (webkit_web_history_item_get_title (hitem)); - - if ((title == NULL || g_strstrip (title)[0] == '\0')) - item = new_history_menu_item (url, url); - else - item = new_history_menu_item (title, url); - - g_free (title); - - g_object_set_data_full (G_OBJECT (item), HISTORY_ITEM_DATA_KEY, - g_object_ref (hitem), g_object_unref); - - g_signal_connect (item, "activate", - G_CALLBACK (activate_back_or_forward_menu_item_cb), - action); - g_signal_connect (item, "select", - G_CALLBACK (select_menu_item_cb), - action); - g_signal_connect (item, "deselect", - G_CALLBACK (deselect_menu_item_cb), - action); - - gtk_menu_shell_append (menu, item); - gtk_widget_show_all (item); - } - - g_list_free (list); - - return GTK_WIDGET (menu); -} +#define MAX_LABEL_LENGTH 48 static GtkWidget * -build_up_menu (EphyNavigationAction *action) +build_dropdown_menu (EphyNavigationAction *action) { - EphyWindow *window = action->priv->window; - EphyEmbed *embed; - EphyHistory *history; - GtkMenuShell *menu; - GtkWidget *item; - GSList *list, *l; - char *url; - - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); - g_return_val_if_fail (embed != NULL, NULL); - - menu = GTK_MENU_SHELL (gtk_menu_new ()); - - history = EPHY_HISTORY - (ephy_embed_shell_get_global_history (embed_shell)); + EphyNavigationActionClass *class = EPHY_NAVIGATION_ACTION_GET_CLASS (action); - list = ephy_web_view_get_go_up_list (ephy_embed_get_web_view (embed)); - - for (l = list; l != NULL; l = l->next) - { - EphyNode *node; - const char *title = NULL; - - url = g_strdup (l->data); - - if (url == NULL) continue; - - node = ephy_history_get_page (history, url); - if (node != NULL) - { - title = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_TITLE); - } - - item = new_history_menu_item (title ? title : url, url); - - 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), action); - g_signal_connect (item, "select", - G_CALLBACK (select_menu_item_cb), action); - g_signal_connect (item, "deselect", - G_CALLBACK (deselect_menu_item_cb), action); - - gtk_menu_shell_append (menu, item); - gtk_widget_show (item); - } - - /* the list data has been consumed */ - g_slist_foreach (list, (GFunc) g_free, NULL); - g_slist_free (list); - - return GTK_WIDGET (menu); + return class->build_dropdown_menu (action); } static void @@ -337,22 +74,9 @@ menu_activated_cb (GtkMenuToolButton *bu { GtkWidget *menu = NULL; - LOG ("menu_activated_cb dir %d", action->priv->direction); - - switch (action->priv->direction) - { - 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; - } + LOG ("menu_activated_cb"); + menu = build_dropdown_menu (action); gtk_menu_tool_button_set_menu (button, menu); } @@ -382,75 +106,6 @@ connect_proxy (GtkAction *gaction, } static void -ephy_navigation_action_activate (GtkAction *gtk_action) -{ - EphyNavigationAction *action = EPHY_NAVIGATION_ACTION (gtk_action); - EphyWindow *window = action->priv->window; - EphyEmbed *embed; - WebKitWebView *web_view; - - embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); - g_return_if_fail (embed != NULL); - - web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); - - if (action->priv->direction == EPHY_NAVIGATION_DIRECTION_BACK) - { - if (ephy_gui_is_middle_click ()) - { - embed = ephy_shell_new_tab (ephy_shell_get_default (), - EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))), - embed, - NULL, - EPHY_NEW_TAB_IN_EXISTING_WINDOW); - web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); - } - webkit_web_view_go_back (web_view); - } - else if (action->priv->direction == EPHY_NAVIGATION_DIRECTION_FORWARD) - { - if (ephy_gui_is_middle_click ()) - { - const char *forward_uri; - WebKitWebHistoryItem *forward_item; - WebKitWebBackForwardList *history; - - /* Forward history is not copied when opening - a new tab, so get the forward URI manually - and load it */ - history = webkit_web_view_get_back_forward_list (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)); - forward_item = webkit_web_back_forward_list_get_forward_item (history); - forward_uri = webkit_web_history_item_get_original_uri (forward_item); - - embed = ephy_shell_new_tab (ephy_shell_get_default (), - EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))), - embed, - NULL, - EPHY_NEW_TAB_IN_EXISTING_WINDOW); - - web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); - webkit_web_view_load_uri (web_view, forward_uri); - } - else - { - webkit_web_view_go_forward (web_view); - } - } - else if (action->priv->direction == EPHY_NAVIGATION_DIRECTION_UP) - { - GSList *up_list; - - up_list = ephy_web_view_get_go_up_list (ephy_embed_get_web_view (embed)); - ephy_link_open (EPHY_LINK (action), - up_list->data, - NULL, - ephy_gui_is_middle_click () ? EPHY_LINK_NEW_TAB : 0); - g_slist_foreach (up_list, (GFunc) g_free, NULL); - g_slist_free (up_list); - } -} - -static void ephy_navigation_action_init (EphyNavigationAction *action) { action->priv = EPHY_NAVIGATION_ACTION_GET_PRIVATE (action); @@ -480,9 +135,6 @@ ephy_navigation_action_set_property (GOb nav->priv->arrow_tooltip = g_value_dup_string (value); g_object_notify (object, "tooltip"); break; - case PROP_DIRECTION: - nav->priv->direction = g_value_get_int (value); - break; case PROP_WINDOW: { GtkWidget *statusbar; @@ -513,9 +165,6 @@ ephy_navigation_action_get_property (GOb case PROP_ARROW_TOOLTIP: g_value_set_string (value, nav->priv->arrow_tooltip); break; - case PROP_DIRECTION: - g_value_set_int (value, nav->priv->direction); - break; case PROP_WINDOW: g_value_set_object (value, nav->priv->window); break; @@ -534,7 +183,8 @@ ephy_navigation_action_class_init (EphyN action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON; action_class->connect_proxy = connect_proxy; - action_class->activate = ephy_navigation_action_activate; + + class->build_dropdown_menu = NULL; g_object_class_install_property (object_class, PROP_ARROW_TOOLTIP, @@ -543,13 +193,6 @@ ephy_navigation_action_class_init (EphyN G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); g_object_class_install_property (object_class, - PROP_DIRECTION, - g_param_spec_int ("direction", NULL, NULL, - 0, - G_MAXINT, - 0, - G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - g_object_class_install_property (object_class, PROP_WINDOW, g_param_spec_object ("window", NULL, NULL, G_TYPE_OBJECT, @@ -557,3 +200,59 @@ ephy_navigation_action_class_init (EphyN g_type_class_add_private (object_class, sizeof (EphyNavigationActionPrivate)); } + +EphyWindow * +_ephy_navigation_action_get_window (EphyNavigationAction *action) +{ + g_return_val_if_fail (EPHY_IS_NAVIGATION_ACTION (action), NULL); + + return action->priv->window; +} + +guint +_ephy_navigation_action_get_statusbar_context_id (EphyNavigationAction *action) +{ + g_return_val_if_fail (EPHY_IS_NAVIGATION_ACTION (action), 0); + + return action->priv->statusbar_cid; +} + +GtkWidget * +_ephy_navigation_action_new_history_menu_item (const char *origtext, + const char *address) +{ + EphyFaviconCache *cache; + EphyHistory *history; + GtkWidget *item, *image; + GdkPixbuf *icon = NULL; + GtkLabel *label; + const char *icon_address; + + g_return_val_if_fail (address != NULL && origtext != NULL, NULL); + + item = gtk_image_menu_item_new_with_label (origtext); + + label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))); + gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); + gtk_label_set_max_width_chars (label, MAX_LABEL_LENGTH); + + 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; +} --- epiphany-2.30.2/src/ephy-navigation-action.h 2010-01-08 19:21:01.000000000 +0100 +++ epiphany-2.30.5/src/ephy-navigation-action.h 2010-08-19 04:44:26.000000000 +0200 @@ -26,6 +26,7 @@ #define EPHY_NAVIGATION_ACTION_H #include "ephy-link-action.h" +#include "ephy-window.h" G_BEGIN_DECLS @@ -40,17 +41,10 @@ typedef struct _EphyNavigationAction Ep typedef struct _EphyNavigationActionPrivate EphyNavigationActionPrivate; typedef struct _EphyNavigationActionClass EphyNavigationActionClass; -typedef enum -{ - EPHY_NAVIGATION_DIRECTION_UP, - EPHY_NAVIGATION_DIRECTION_BACK, - EPHY_NAVIGATION_DIRECTION_FORWARD -} EphyNavigationDirection; - struct _EphyNavigationAction { EphyLinkAction parent; - + /*< private >*/ EphyNavigationActionPrivate *priv; }; @@ -58,10 +52,21 @@ struct _EphyNavigationAction struct _EphyNavigationActionClass { EphyLinkActionClass parent_class; + + /*< virtual >*/ + GtkWidget *(*build_dropdown_menu) (EphyNavigationAction *action); }; GType ephy_navigation_action_get_type (void); +/*< Protected >*/ + +EphyWindow *_ephy_navigation_action_get_window (EphyNavigationAction *action); + +guint _ephy_navigation_action_get_statusbar_context_id (EphyNavigationAction *action); + +GtkWidget *_ephy_navigation_action_new_history_menu_item (const char *origtext, + const char *address); G_END_DECLS #endif --- epiphany-2.30.2/src/ephy-navigation-history-action.c 1970-01-01 01:00:00.000000000 +0100 +++ epiphany-2.30.5/src/ephy-navigation-history-action.c 2010-08-30 22:55:16.000000000 +0200 @@ -0,0 +1,465 @@ +/* + * Copyright © 2003, 2004 Marco Pesenti Gritti + * Copyright © 2003, 2004 Christian Persch + * Copyright © 2008 Jan Alonzo + * Copyright © 2009 Igalia S.L. + * + * 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "ephy-navigation-history-action.h" + +#include "ephy-action-helper.h" +#include "ephy-debug.h" +#include "ephy-embed-container.h" +#include "ephy-embed-shell.h" +#include "ephy-embed-utils.h" +#include "ephy-gui.h" +#include "ephy-history.h" +#include "ephy-link.h" +#include "ephy-shell.h" +#include "ephy-type-builtins.h" +#include "ephy-window.h" + +#include <gtk/gtk.h> +#include <webkit/webkit.h> + +#define HISTORY_ITEM_DATA_KEY "HistoryItem" + +#define EPHY_NAVIGATION_HISTORY_ACTION_GET_PRIVATE(object) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((object), \ + EPHY_TYPE_NAVIGATION_HISTORY_ACTION, \ + EphyNavigationHistoryActionPrivate)) + +typedef enum { + WEBKIT_HISTORY_BACKWARD, + WEBKIT_HISTORY_FORWARD +} WebKitHistoryType; + +struct _EphyNavigationHistoryActionPrivate { + EphyNavigationHistoryDirection direction; + EphyHistory *history; +}; + +enum { + PROP_0, + PROP_DIRECTION +}; + +static void ephy_navigation_history_action_init (EphyNavigationHistoryAction *action); +static void ephy_navigation_history_action_class_init (EphyNavigationHistoryActionClass *klass); + +G_DEFINE_TYPE (EphyNavigationHistoryAction, ephy_navigation_history_action, EPHY_TYPE_NAVIGATION_ACTION) + +static void +set_new_back_history (EphyEmbed *source, EphyEmbed *dest, gint offset) +{ + WebKitWebView *source_view, *dest_view; + WebKitWebBackForwardList* source_list, *dest_list; + WebKitWebHistoryItem *item; + GList *items; + guint limit; + guint i; + + g_return_if_fail (EPHY_IS_EMBED (source)); + g_return_if_fail (EPHY_IS_EMBED (dest)); + + source_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (source); + dest_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (dest); + + source_list = webkit_web_view_get_back_forward_list (source_view); + dest_list = webkit_web_view_get_back_forward_list (dest_view); + + if (offset >= 0) { + /* Copy the whole back history in this case (positive offset) */ + ephy_web_view_copy_back_history (ephy_embed_get_web_view (source), + ephy_embed_get_web_view (dest)); + + items = webkit_web_back_forward_list_get_forward_list_with_limit (source_list, + EPHY_WEBKIT_BACK_FORWARD_LIMIT); + limit = offset - 1; + } else { + items = webkit_web_back_forward_list_get_back_list_with_limit (source_list, + EPHY_WEBKIT_BACK_FORWARD_LIMIT); + limit = g_list_length (items) + offset; + } + + /* Add the remaining items to the BackForward list */ + items = g_list_reverse (items); + for (i = 0; i < limit; i++) { + item = webkit_web_history_item_copy ((WebKitWebHistoryItem*)items->data); + webkit_web_back_forward_list_add_item (dest_list, item); + g_object_unref (item); + + items = items->next; + } + g_list_free (items); +} + +static void +middle_click_handle_on_history_menu_item (EphyNavigationHistoryAction *action, + EphyEmbed *embed, + WebKitWebHistoryItem *item) +{ + EphyEmbed *new_embed = NULL; + WebKitWebView *web_view; + WebKitWebBackForwardList *history; + GList *list; + const gchar *url; + guint current; + gint offset; + + web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); + + /* Save old history and item's offset from current */ + history = webkit_web_view_get_back_forward_list (web_view); + if (action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) { + list = webkit_web_back_forward_list_get_back_list_with_limit (history, + EPHY_WEBKIT_BACK_FORWARD_LIMIT); + current = -1; + } else { + list = webkit_web_back_forward_list_get_forward_list_with_limit (history, + EPHY_WEBKIT_BACK_FORWARD_LIMIT); + current = g_list_length (list); + } + offset = current - g_list_index (list, item); + + new_embed = ephy_shell_new_tab (ephy_shell_get_default (), + EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))), + embed, + NULL, + EPHY_NEW_TAB_IN_EXISTING_WINDOW | + EPHY_NEW_TAB_DONT_COPY_HISTORY); + g_return_if_fail (new_embed != NULL); + + /* We manually set the back history instead of trusting + ephy_shell_new_tab because the logic is more complex than + usual, due to handling also the forward history */ + set_new_back_history (embed, new_embed, offset); + + /* Load the new URL */ + url = webkit_web_history_item_get_original_uri (item); + ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), url); +} + +static void +activate_back_or_forward_menu_item_cb (GtkWidget *menuitem, + EphyNavigationHistoryAction *action) +{ + WebKitWebHistoryItem *item; + EphyWindow *window; + EphyEmbed *embed; + + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); + g_return_if_fail (embed != NULL); + + item = (WebKitWebHistoryItem*)g_object_get_data (G_OBJECT (menuitem), HISTORY_ITEM_DATA_KEY); + g_return_if_fail (item != NULL); + + if (ephy_gui_is_middle_click ()) { + middle_click_handle_on_history_menu_item (action, embed, item); + } else { + WebKitWebView *web_view; + + web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); + webkit_web_view_go_to_back_forward_item (web_view, item); + } +} + +static void +select_menu_item_cb (GtkWidget *menuitem, + EphyNavigationHistoryAction *action) +{ + WebKitWebHistoryItem *item; + + item = (WebKitWebHistoryItem*)g_object_get_data (G_OBJECT (menuitem), + HISTORY_ITEM_DATA_KEY); + if (item) { + const char *url; + EphyWindow *window; + EphyNavigationAction *nav_action; + GtkWidget *statusbar; + guint statusbar_cid; + + url = webkit_web_history_item_get_uri (item); + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + statusbar = ephy_window_get_statusbar (window); + + /* Update status bar */ + nav_action = EPHY_NAVIGATION_ACTION (action); + statusbar_cid = _ephy_navigation_action_get_statusbar_context_id (nav_action); + gtk_statusbar_push (GTK_STATUSBAR (statusbar), statusbar_cid, url); + } +} + +static void +deselect_menu_item_cb (GtkWidget *menuitem, + EphyNavigationAction *action) +{ + GtkWidget *statusbar; + EphyWindow *window; + EphyNavigationAction *nav_action; + guint statusbar_cid; + + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + statusbar = ephy_window_get_statusbar (window); + + /* Update status bar */ + nav_action = EPHY_NAVIGATION_ACTION (action); + statusbar_cid = _ephy_navigation_action_get_statusbar_context_id (nav_action); + gtk_statusbar_pop (GTK_STATUSBAR (statusbar), statusbar_cid); +} + +static void +ephy_history_cleared_cb (EphyHistory *history, + EphyNavigationHistoryAction *action) +{ + ephy_action_change_sensitivity_flags (GTK_ACTION (action), SENS_FLAG, TRUE); +} + +static GList* +webkit_construct_history_list (WebKitWebView *web_view, WebKitHistoryType hist_type) +{ + WebKitWebBackForwardList *web_back_forward_list; + GList *webkit_items; + + web_back_forward_list = webkit_web_view_get_back_forward_list (web_view); + + if (hist_type == WEBKIT_HISTORY_FORWARD) { + webkit_items = + g_list_reverse (webkit_web_back_forward_list_get_forward_list_with_limit (web_back_forward_list, + EPHY_WEBKIT_BACK_FORWARD_LIMIT)); + } else { + webkit_items = + webkit_web_back_forward_list_get_back_list_with_limit (web_back_forward_list, + EPHY_WEBKIT_BACK_FORWARD_LIMIT); + } + + return webkit_items; +} + +static GtkWidget * +build_dropdown_menu (EphyNavigationAction *nav_action) +{ + EphyNavigationHistoryAction *action; + EphyWindow *window; + GtkMenuShell *menu; + EphyEmbed *embed; + GList *list, *l; + WebKitWebView *web_view; + + action = EPHY_NAVIGATION_HISTORY_ACTION (nav_action); + window = _ephy_navigation_action_get_window (nav_action); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); + g_return_val_if_fail (embed != NULL, NULL); + + menu = GTK_MENU_SHELL (gtk_menu_new ()); + + web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); + g_return_val_if_fail (web_view != NULL, NULL); + + if (action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) { + list = webkit_construct_history_list (web_view, + WEBKIT_HISTORY_BACKWARD); + } else { + list = webkit_construct_history_list (web_view, + WEBKIT_HISTORY_FORWARD); + } + + for (l = list; l != NULL; l = l->next) { + GtkWidget *item; + WebKitWebHistoryItem *hitem; + const char *url; + char *title; + + hitem = (WebKitWebHistoryItem*)l->data; + url = webkit_web_history_item_get_uri (hitem); + + title = g_strdup (webkit_web_history_item_get_title (hitem)); + + if ((title == NULL || g_strstrip (title)[0] == '\0')) + item = _ephy_navigation_action_new_history_menu_item (url, url); + else + item = _ephy_navigation_action_new_history_menu_item (title, url); + + g_free (title); + + g_object_set_data_full (G_OBJECT (item), HISTORY_ITEM_DATA_KEY, + g_object_ref (hitem), g_object_unref); + + g_signal_connect (item, "activate", + G_CALLBACK (activate_back_or_forward_menu_item_cb), + action); + g_signal_connect (item, "select", + G_CALLBACK (select_menu_item_cb), + action); + g_signal_connect (item, "deselect", + G_CALLBACK (deselect_menu_item_cb), + action); + + gtk_menu_shell_append (menu, item); + gtk_widget_show_all (item); + } + + g_list_free (list); + + return GTK_WIDGET (menu); +} + +static void +action_activate (GtkAction *action) +{ + EphyNavigationHistoryAction *history_action; + EphyWindow *window; + EphyEmbed *embed; + WebKitWebView *web_view; + + history_action = EPHY_NAVIGATION_HISTORY_ACTION (action); + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); + g_return_if_fail (embed != NULL); + + web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); + + if (history_action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_BACK) { + if (ephy_gui_is_middle_click ()) { + embed = ephy_shell_new_tab (ephy_shell_get_default (), + EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))), + embed, + NULL, + EPHY_NEW_TAB_IN_EXISTING_WINDOW); + web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); + } + webkit_web_view_go_back (web_view); + } else if (history_action->priv->direction == EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD) { + if (ephy_gui_is_middle_click ()) { + const char *forward_uri; + WebKitWebHistoryItem *forward_item; + WebKitWebBackForwardList *history; + + /* Forward history is not copied when opening + a new tab, so get the forward URI manually + and load it */ + history = webkit_web_view_get_back_forward_list (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)); + forward_item = webkit_web_back_forward_list_get_forward_item (history); + forward_uri = webkit_web_history_item_get_original_uri (forward_item); + + embed = ephy_shell_new_tab (ephy_shell_get_default (), + EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))), + embed, + NULL, + EPHY_NEW_TAB_IN_EXISTING_WINDOW); + + web_view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed); + webkit_web_view_load_uri (web_view, forward_uri); + } else { + webkit_web_view_go_forward (web_view); + } + } +} + +static void +ephy_navigation_history_action_init (EphyNavigationHistoryAction *action) +{ + EphyHistory *history; + + action->priv = EPHY_NAVIGATION_HISTORY_ACTION_GET_PRIVATE (action); + + history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); + action->priv->history = EPHY_HISTORY (g_object_ref (history)); + + g_signal_connect (action->priv->history, + "cleared", G_CALLBACK (ephy_history_cleared_cb), + action); +} + +static void +ephy_navigation_history_action_finalize (GObject *object) +{ + EphyNavigationHistoryAction *action = EPHY_NAVIGATION_HISTORY_ACTION (object); + + g_signal_handlers_disconnect_by_func (action->priv->history, + ephy_history_cleared_cb, + action); + g_object_unref (action->priv->history); + action->priv->history = NULL; + + G_OBJECT_CLASS (ephy_navigation_history_action_parent_class)->finalize (object); +} + +static void +ephy_navigation_history_action_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + EphyNavigationHistoryAction *nav = EPHY_NAVIGATION_HISTORY_ACTION (object); + + switch (prop_id) { + case PROP_DIRECTION: + nav->priv->direction = g_value_get_int (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +ephy_navigation_history_action_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + EphyNavigationHistoryAction *nav = EPHY_NAVIGATION_HISTORY_ACTION (object); + + switch (prop_id) { + case PROP_DIRECTION: + g_value_set_int (value, nav->priv->direction); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +ephy_navigation_history_action_class_init (EphyNavigationHistoryActionClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkActionClass *action_class = GTK_ACTION_CLASS (klass); + EphyNavigationActionClass *nav_action_class = EPHY_NAVIGATION_ACTION_CLASS (klass); + + object_class->finalize = ephy_navigation_history_action_finalize; + object_class->set_property = ephy_navigation_history_action_set_property; + object_class->get_property = ephy_navigation_history_action_get_property; + + action_class->activate = action_activate; + + nav_action_class->build_dropdown_menu = build_dropdown_menu; + + g_object_class_install_property (object_class, + PROP_DIRECTION, + g_param_spec_int ("direction", NULL, NULL, + 0, + G_MAXINT, + 0, + G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); + + g_type_class_add_private (object_class, sizeof (EphyNavigationHistoryActionPrivate)); +} --- epiphany-2.30.2/src/ephy-navigation-history-action.h 1970-01-01 01:00:00.000000000 +0100 +++ epiphany-2.30.5/src/ephy-navigation-history-action.h 2010-08-19 04:44:26.000000000 +0200 @@ -0,0 +1,67 @@ +/* + * Copyright © 2003, 2004 Marco Pesenti Gritti + * Copyright © 2003, 2004 Christian Persch + * Copyright © 2010, Igalia S.L. + * + * 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) +#error "Only <epiphany/epiphany.h> can be included directly." +#endif + +#ifndef EPHY_NAVIGATION_HISTORY_ACTION_H +#define EPHY_NAVIGATION_HISTORY_ACTION_H + +#include "ephy-navigation-action.h" + +G_BEGIN_DECLS + +#define EPHY_TYPE_NAVIGATION_HISTORY_ACTION (ephy_navigation_history_action_get_type ()) +#define EPHY_NAVIGATION_HISTORY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_NAVIGATION_HISTORY_ACTION, EphyNavigationHistoryAction)) +#define EPHY_NAVIGATION_HISTORY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_NAVIGATION_HISTORY_ACTION, EphyNavigationHistoryActionClass)) +#define EPHY_IS_NAVIGATION_HISTORY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_NAVIGATION_HISTORY_ACTION)) +#define EPHY_IS_NAVIGATION_HISTORY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_NAVIGATION_HISTORY_ACTION)) +#define EPHY_NAVIGATION_HISTORY_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_NAVIGATION_HISTORY_ACTION, EphyNavigationHistoryActionClass)) + +typedef enum +{ + EPHY_NAVIGATION_HISTORY_DIRECTION_BACK, + EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD +} EphyNavigationHistoryDirection; + +typedef struct _EphyNavigationHistoryAction EphyNavigationHistoryAction; +typedef struct _EphyNavigationHistoryActionPrivate EphyNavigationHistoryActionPrivate; +typedef struct _EphyNavigationHistoryActionClass EphyNavigationHistoryActionClass; + +struct _EphyNavigationHistoryAction +{ + EphyNavigationAction parent; + + /*< private >*/ + EphyNavigationHistoryActionPrivate *priv; +}; + +struct _EphyNavigationHistoryActionClass +{ + EphyNavigationActionClass parent_class; +}; + +GType ephy_navigation_history_action_get_type (void); + +G_END_DECLS + +#endif --- epiphany-2.30.2/src/ephy-navigation-up-action.c 1970-01-01 01:00:00.000000000 +0100 +++ epiphany-2.30.5/src/ephy-navigation-up-action.c 2010-08-30 22:55:16.000000000 +0200 @@ -0,0 +1,196 @@ +/* + * Copyright © 2003, 2004 Marco Pesenti Gritti + * Copyright © 2003, 2004 Christian Persch + * Copyright © 2008 Jan Alonzo + * Copyright © 2009 Igalia S.L. + * + * 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "ephy-navigation-up-action.h" + +#include "ephy-debug.h" +#include "ephy-embed-container.h" +#include "ephy-embed-shell.h" +#include "ephy-embed-utils.h" +#include "ephy-gui.h" +#include "ephy-history.h" +#include "ephy-link.h" +#include "ephy-shell.h" +#include "ephy-type-builtins.h" +#include "ephy-window.h" + +#include <gtk/gtk.h> +#include <webkit/webkit.h> + +#define URL_DATA_KEY "GoURL" + +static void ephy_navigation_up_action_init (EphyNavigationUpAction *action); +static void ephy_navigation_up_action_class_init (EphyNavigationUpActionClass *klass); + +G_DEFINE_TYPE (EphyNavigationUpAction, ephy_navigation_up_action, EPHY_TYPE_NAVIGATION_ACTION) + +static void +activate_up_menu_item_cb (GtkWidget *menuitem, + EphyNavigationUpAction *action) +{ + EphyWindow *window; + EphyEmbed *embed; + char *url; + + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); + g_return_if_fail (embed != NULL); + + url = g_object_get_data (G_OBJECT (menuitem), URL_DATA_KEY); + g_return_if_fail (url != NULL); + + ephy_link_open (EPHY_LINK (action), url, NULL, + ephy_gui_is_middle_click () ? EPHY_LINK_NEW_TAB : 0); +} + +static void +select_menu_item_cb (GtkWidget *menuitem, + EphyNavigationUpAction *action) +{ + const char *url; + EphyWindow *window; + EphyNavigationAction *nav_action; + GtkWidget *statusbar; + guint statusbar_cid; + + url = g_object_get_data (G_OBJECT (menuitem), URL_DATA_KEY); + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + statusbar = ephy_window_get_statusbar (window); + g_return_if_fail (url != NULL); + + /* Update status bar */ + nav_action = EPHY_NAVIGATION_ACTION (action); + statusbar_cid = _ephy_navigation_action_get_statusbar_context_id (nav_action); + gtk_statusbar_push (GTK_STATUSBAR (statusbar), statusbar_cid, url); +} + +static void +deselect_menu_item_cb (GtkWidget *menuitem, + EphyNavigationAction *action) +{ + GtkWidget *statusbar; + EphyWindow *window; + EphyNavigationAction *nav_action; + guint statusbar_cid; + + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + statusbar = ephy_window_get_statusbar (window); + + /* Update status bar */ + nav_action = EPHY_NAVIGATION_ACTION (action); + statusbar_cid = _ephy_navigation_action_get_statusbar_context_id (nav_action); + gtk_statusbar_pop (GTK_STATUSBAR (statusbar), statusbar_cid); +} + +static GtkWidget * +build_dropdown_menu (EphyNavigationAction *nav_action) +{ + EphyNavigationUpAction *action; + EphyWindow *window; + EphyEmbed *embed; + EphyHistory *history; + GtkMenuShell *menu; + GtkWidget *item; + GSList *list, *l; + char *url; + + action = EPHY_NAVIGATION_UP_ACTION (nav_action); + window = _ephy_navigation_action_get_window (nav_action); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); + g_return_val_if_fail (embed != NULL, NULL); + + menu = GTK_MENU_SHELL (gtk_menu_new ()); + history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell)); + + list = ephy_web_view_get_go_up_list (ephy_embed_get_web_view (embed)); + for (l = list; l != NULL; l = l->next) { + EphyNode *node; + const char *title = NULL; + + url = g_strdup (l->data); + + if (url == NULL) continue; + + node = ephy_history_get_page (history, url); + if (node != NULL) { + title = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_TITLE); + } + + item = _ephy_navigation_action_new_history_menu_item (title ? title : url, url); + + 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), action); + g_signal_connect (item, "select", + G_CALLBACK (select_menu_item_cb), + action); + g_signal_connect (item, "deselect", + G_CALLBACK (deselect_menu_item_cb), + action); + + gtk_menu_shell_append (menu, item); + gtk_widget_show (item); + } + + /* the list data has been consumed */ + g_slist_foreach (list, (GFunc) g_free, NULL); + g_slist_free (list); + + return GTK_WIDGET (menu); +} + +static void +action_activate (GtkAction *action) +{ + EphyWindow *window; + EphyEmbed *embed; + GSList *up_list; + + window = _ephy_navigation_action_get_window (EPHY_NAVIGATION_ACTION (action)); + embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window)); + g_return_if_fail (embed != NULL); + + up_list = ephy_web_view_get_go_up_list (ephy_embed_get_web_view (embed)); + ephy_link_open (EPHY_LINK (action), + up_list->data, + NULL, + ephy_gui_is_middle_click () ? EPHY_LINK_NEW_TAB : 0); + g_slist_foreach (up_list, (GFunc) g_free, NULL); + g_slist_free (up_list); +} + +static void +ephy_navigation_up_action_init (EphyNavigationUpAction *action) +{ +} + +static void +ephy_navigation_up_action_class_init (EphyNavigationUpActionClass *klass) +{ + GtkActionClass *action_class = GTK_ACTION_CLASS (klass); + EphyNavigationActionClass *nav_action_class = EPHY_NAVIGATION_ACTION_CLASS (klass); + + action_class->activate = action_activate; + nav_action_class->build_dropdown_menu = build_dropdown_menu; +} --- epiphany-2.30.2/src/ephy-navigation-up-action.h 1970-01-01 01:00:00.000000000 +0100 +++ epiphany-2.30.5/src/ephy-navigation-up-action.h 2010-08-19 04:44:26.000000000 +0200 @@ -0,0 +1,57 @@ +/* + * Copyright © 2003, 2004 Marco Pesenti Gritti + * Copyright © 2003, 2004 Christian Persch + * Copyright © 2010, Igalia S.L. + * + * 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 + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION) +#error "Only <epiphany/epiphany.h> can be included directly." +#endif + +#ifndef EPHY_NAVIGATION_UP_ACTION_H +#define EPHY_NAVIGATION_UP_ACTION_H + +#include "ephy-navigation-action.h" + +G_BEGIN_DECLS + +#define EPHY_TYPE_NAVIGATION_UP_ACTION (ephy_navigation_up_action_get_type ()) +#define EPHY_NAVIGATION_UP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_NAVIGATION_UP_ACTION, EphyNavigationUpAction)) +#define EPHY_NAVIGATION_UP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_NAVIGATION_UP_ACTION, EphyNavigationUpActionClass)) +#define EPHY_IS_NAVIGATION_UP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_NAVIGATION_UP_ACTION)) +#define EPHY_IS_NAVIGATION_UP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_NAVIGATION_UP_ACTION)) +#define EPHY_NAVIGATION_UP_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_NAVIGATION_UP_ACTION, EphyNavigationUpActionClass)) + +typedef struct _EphyNavigationUpAction EphyNavigationUpAction; +typedef struct _EphyNavigationUpActionClass EphyNavigationUpActionClass; + +struct _EphyNavigationUpAction +{ + EphyNavigationAction parent; +}; + +struct _EphyNavigationUpActionClass +{ + EphyNavigationActionClass parent_class; +}; + +GType ephy_navigation_up_action_get_type (void); + +G_END_DECLS + +#endif --- epiphany-2.30.2/src/ephy-notebook.c 2010-02-17 09:13:15.000000000 +0100 +++ epiphany-2.30.5/src/ephy-notebook.c 2010-08-19 04:44:26.000000000 +0200 @@ -329,7 +329,7 @@ button_press_cb (EphyNotebook *notebook, static void ephy_notebook_switch_page_cb (GtkNotebook *notebook, - GtkNotebookPage *page, + GtkWidget *page, guint page_num, gpointer data) { --- epiphany-2.30.2/src/ephy-shell.c 2010-02-04 22:07:36.000000000 +0100 +++ epiphany-2.30.5/src/ephy-shell.c 2010-08-30 22:58:42.000000000 +0200 @@ -149,43 +149,6 @@ ephy_shell_new_window_cb (EphyEmbedSingl NULL, NULL, flags, chromemask, is_popup, 0); } - -static gboolean -ephy_shell_add_sidebar_cb (EphyEmbedSingle *embed_single, - const char *url, - const char *title, - EphyShell *shell) -{ - EphySession *session; - EphyWindow *window; - GtkWidget *dialog; - - session = EPHY_SESSION (ephy_shell_get_session (shell)); - g_return_val_if_fail (EPHY_IS_SESSION (session), FALSE); - - window = ephy_session_get_active_window (session); - - dialog = gtk_message_dialog_new (GTK_WINDOW (window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Sidebar extension required")); - - gtk_window_set_title (GTK_WINDOW (dialog), _("Sidebar Extension Required")); - gtk_window_set_icon_name (GTK_WINDOW (dialog), EPHY_STOCK_EPHY); - - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - _("The link you clicked needs the sidebar extension to be " - "installed.")); - - g_signal_connect_swapped (dialog, "response", - G_CALLBACK (gtk_widget_destroy), dialog); - - gtk_widget_show (dialog); - - return TRUE; -} - #ifdef ENABLE_NETWORK_MANAGER static void @@ -223,10 +186,6 @@ impl_get_embed_single (EphyEmbedShell *e G_CALLBACK (ephy_shell_new_window_cb), shell, G_CONNECT_AFTER); - g_signal_connect_object (embed_single, "add-sidebar", - G_CALLBACK (ephy_shell_add_sidebar_cb), - shell, G_CONNECT_AFTER); - priv->embed_single_connected = TRUE; #ifdef ENABLE_NETWORK_MANAGER @@ -435,6 +394,7 @@ ephy_shell_new_tab_full (EphyShell *shel gboolean open_page = FALSE; gboolean jump_to; gboolean active_is_blank = FALSE; + gboolean copy_history = TRUE; GtkWidget *nb; int position = -1; gboolean is_empty = FALSE; @@ -443,6 +403,7 @@ ephy_shell_new_tab_full (EphyShell *shel if (flags & EPHY_NEW_TAB_OPEN_PAGE) open_page = TRUE; if (flags & EPHY_NEW_TAB_IN_NEW_WINDOW) in_new_window = TRUE; if (flags & EPHY_NEW_TAB_IN_EXISTING_WINDOW) in_new_window = FALSE; + if (flags & EPHY_NEW_TAB_DONT_COPY_HISTORY) copy_history = FALSE; in_new_window = in_new_window && !eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN); g_return_val_if_fail (open_page == (gboolean)(request != NULL), NULL); @@ -493,11 +454,11 @@ ephy_shell_new_tab_full (EphyShell *shel ephy_embed_container_add_child (EPHY_EMBED_CONTAINER (window), embed, position, jump_to); } - if (previous_embed != NULL) - { + if (copy_history && previous_embed != NULL) + { ephy_web_view_copy_back_history (ephy_embed_get_web_view (previous_embed), ephy_embed_get_web_view (embed)); - } + } ephy_gui_window_update_user_time (GTK_WIDGET (window), user_time); --- epiphany-2.30.2/src/ephy-shell.h 2010-02-15 20:05:56.000000000 +0100 +++ epiphany-2.30.5/src/ephy-shell.h 2010-08-19 04:44:26.000000000 +0200 @@ -69,6 +69,7 @@ typedef enum /* The way to load */ EPHY_NEW_TAB_FROM_EXTERNAL = 1 << 12, + EPHY_NEW_TAB_DONT_COPY_HISTORY = 1 << 13, } EphyNewTabFlags; --- epiphany-2.30.2/src/ephy-toolbar.c 2010-01-08 19:21:01.000000000 +0100 +++ epiphany-2.30.5/src/ephy-toolbar.c 2010-08-19 04:44:26.000000000 +0200 @@ -30,6 +30,8 @@ #include "ephy-location-entry.h" #include "ephy-location-action.h" #include "ephy-navigation-action.h" +#include "ephy-navigation-history-action.h" +#include "ephy-navigation-up-action.h" #include "ephy-topic-action.h" #include "ephy-zoom-action.h" #include "ephy-spinner-tool-item.h" @@ -61,11 +63,6 @@ enum LAST_ACTION }; -enum -{ - SENS_FLAG = 1 << 0 -}; - #define EPHY_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_TOOLBAR, EphyToolbarPrivate)) struct _EphyToolbarPrivate @@ -135,6 +132,7 @@ ephy_toolbar_update_fixed_visibility (Ep show = priv->leave_fullscreen_visible; g_object_set (priv->sep_item, "visible", show, NULL); + g_object_set (priv->exit_button, "visible", show, NULL); g_object_set (priv->fixed_toolbar, "visible", show, NULL); } @@ -225,7 +223,7 @@ ephy_toolbar_set_window (EphyToolbar *to g_object_unref (priv->action_group); action = priv->actions[BACK_ACTION] = - g_object_new (EPHY_TYPE_NAVIGATION_ACTION, + g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION, "name", "NavigationBack", "label", _("_Back"), "stock_id", GTK_STOCK_GO_BACK, @@ -235,7 +233,7 @@ ephy_toolbar_set_window (EphyToolbar *to */ "arrow-tooltip", _("Back history"), "window", priv->window, - "direction", EPHY_NAVIGATION_DIRECTION_BACK, + "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_BACK, "is_important", TRUE, NULL); g_signal_connect_swapped (action, "open-link", @@ -245,7 +243,7 @@ ephy_toolbar_set_window (EphyToolbar *to g_object_unref (action); action = priv->actions[FORWARD_ACTION] = - g_object_new (EPHY_TYPE_NAVIGATION_ACTION, + g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION, "name", "NavigationForward", "label", _("_Forward"), "stock_id", GTK_STOCK_GO_FORWARD, @@ -255,7 +253,7 @@ ephy_toolbar_set_window (EphyToolbar *to */ "arrow-tooltip", _("Forward history"), "window", priv->window, - "direction", EPHY_NAVIGATION_DIRECTION_FORWARD, + "direction", EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD, NULL); g_signal_connect_swapped (action, "open-link", G_CALLBACK (ephy_link_open), toolbar); @@ -264,7 +262,7 @@ ephy_toolbar_set_window (EphyToolbar *to g_object_unref (action); action = priv->actions[UP_ACTION] = - g_object_new (EPHY_TYPE_NAVIGATION_ACTION, + g_object_new (EPHY_TYPE_NAVIGATION_UP_ACTION, "name", "NavigationUp", "label", _("_Up"), "stock_id", GTK_STOCK_GO_UP, @@ -274,7 +272,6 @@ ephy_toolbar_set_window (EphyToolbar *to */ "arrow-tooltip", _("List of upper levels"), "window", priv->window, - "direction", EPHY_NAVIGATION_DIRECTION_UP, NULL); g_signal_connect_swapped (action, "open-link", G_CALLBACK (ephy_link_open), toolbar); --- epiphany-2.30.2/src/ephy-window.c 2010-02-27 11:26:59.000000000 +0100 +++ epiphany-2.30.5/src/ephy-window.c 2010-08-30 22:55:16.000000000 +0200 @@ -87,7 +87,7 @@ static EphyEmbed *ephy_window_open_link EphyEmbed *embed, EphyLinkFlags flags); static void notebook_switch_page_cb (GtkNotebook *notebook, - GtkNotebookPage *page, + GtkWidget *page, guint page_num, EphyWindow *window); static void ephy_window_view_statusbar_cb (GtkAction *action, @@ -3981,7 +3981,7 @@ ephy_window_show (GtkWidget *widget) static void notebook_switch_page_cb (GtkNotebook *notebook, - GtkNotebookPage *page, + GtkWidget *page, guint page_num, EphyWindow *window) { --- epiphany-2.30.2/src/epiphany.h 2010-04-08 16:57:23.000000000 +0200 +++ epiphany-2.30.5/src/epiphany.h 2010-08-31 00:55:35.000000000 +0200 @@ -25,7 +25,7 @@ /* From GTK_CHECK_VERSION */ #define EPHY_MAJOR_VERSION (2) #define EPHY_MINOR_VERSION (30) -#define EPHY_MICRO_VERSION (2) +#define EPHY_MICRO_VERSION (5) #define EPHY_CHECK_VERSION(major, minor, micro)\ (EPHY_MAJOR_VERSION > (major) || \ --- epiphany-2.30.2/src/pdm-dialog.c 2010-01-08 19:21:01.000000000 +0100 +++ epiphany-2.30.5/src/pdm-dialog.c 2010-08-31 00:30:35.000000000 +0200 @@ -1488,7 +1488,7 @@ pdm_dialog_password_remove (PdmActionInf static void sync_notebook_tab (GtkWidget *notebook, - GtkNotebookPage *page, + GtkWidget *page, int page_num, PdmDialog *dialog) { --- epiphany-2.30.2/src/popup-commands.c 2010-02-04 22:07:36.000000000 +0100 +++ epiphany-2.30.5/src/popup-commands.c 2010-08-30 22:58:42.000000000 +0200 @@ -26,7 +26,6 @@ #include "ephy-embed-persist.h" #include "ephy-embed-utils.h" #include "ephy-prefs.h" -#include "eel-gconf-extensions.h" #include "ephy-file-helpers.h" #include "ephy-bookmarks-ui.h" #include "ephy-web-view.h" @@ -237,6 +236,7 @@ save_property_url (GtkAction *action, ephy_embed_persist_set_persist_key (persist, CONF_STATE_SAVE_DIR); ephy_embed_persist_set_source (persist, location); + ephy_embed_persist_set_embed (persist, embed); g_signal_connect (persist, "completed", G_CALLBACK (save_property_url_completed_cb), NULL); --- epiphany-2.30.2/src/window-commands.c 2010-04-07 10:37:25.000000000 +0200 +++ epiphany-2.30.5/src/window-commands.c 2010-08-30 22:58:42.000000000 +0200 @@ -344,7 +344,7 @@ window_cmd_file_save_as (GtkAction *acti GTK_WIDGET (window), GTK_FILE_CHOOSER_ACTION_SAVE, CONF_STATE_SAVE_DIR, - EPHY_FILE_FILTER_ALL_SUPPORTED); + EPHY_FILE_FILTER_ALL); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE); @@ -1040,7 +1040,7 @@ window_cmd_help_about (GtkAction *action "name", _("GNOME Web Browser"), "version", VERSION, "copyright", "Copyright © 2002–2004 Marco Pesenti Gritti\n" - "Copyright © 2003–2009 The GNOME Web Browser Developers", + "Copyright © 2003–2010 The GNOME Web Browser Developers", "artists", artists, "authors", authors, "comments", comments,
--- End Message ---
--- Begin Message ---
- To: Josselin Mouette <joss@debian.org>, 596094-done@bugs.debian.org
- Subject: Re: Bug#596094: unblock: epiphany-browser/2.30.5-1
- From: Julien Cristau <jcristau@debian.org>
- Date: Tue, 21 Sep 2010 12:11:31 +0200
- Message-id: <20100921101131.GD21708@patate.is-a-geek.org>
- In-reply-to: <[🔎] 1284704914.7623.5.camel@tomoyo>
- References: <[🔎] 1283962690.22754.30.camel@meh> <[🔎] 20100911172559.GE3984@radis.liafa.jussieu.fr> <[🔎] 1284280519.23075.22.camel@tomoyo> <[🔎] 20100912103643.GV3984@radis.liafa.jussieu.fr> <[🔎] 1284295958.23075.29.camel@tomoyo> <[🔎] 1284704914.7623.5.camel@tomoyo>
On Fri, Sep 17, 2010 at 08:28:34 +0200, Josselin Mouette wrote: > epiphany-browser (2.30.6-1) unstable; urgency=low > Unblocked. Cheers, JulienAttachment: signature.asc
Description: Digital signature
--- End Message ---