diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-01-08 22:02:20 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-01-08 22:02:20 +0800 |
commit | d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd (patch) | |
tree | 82c8626eeb2eeab2182ed1d8cf98ed0409dc67b8 /src | |
parent | 1db0996634c234cfde4330ebaa7697d041a5d0ee (diff) | |
download | gsoc2013-epiphany-d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd.tar gsoc2013-epiphany-d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd.tar.gz gsoc2013-epiphany-d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd.tar.bz2 gsoc2013-epiphany-d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd.tar.lz gsoc2013-epiphany-d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd.tar.xz gsoc2013-epiphany-d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd.tar.zst gsoc2013-epiphany-d9ec1f482b6b8926cbb10f1fb6b55b6b6685a1fd.zip |
Unify the location and favicon actions.
2005-01-08 Christian Persch <chpe@cvs.gnome.org>
* data/ui/epiphany-toolbar.xml:
* lib/ephy-marshal.list:
* lib/ephy-signal-accumulator.c: (ephy_signal_accumulator_string):
* lib/ephy-signal-accumulator.h:
* lib/widgets/ephy-location-entry.c:
(ephy_location_entry_set_tooltip),
(ephy_location_entry_class_init), (editable_changed_cb),
(each_url_get_data_binder), (favicon_drag_data_get_cb),
(ephy_location_entry_construct_contents),
(ephy_location_entry_activate), (ephy_location_entry_get_entry),
(ephy_location_entry_get_image):
* lib/widgets/ephy-location-entry.h:
* src/Makefile.am:
* src/ephy-favicon-action.c:
* src/ephy-favicon-action.h:
* src/ephy-location-action.c: (sync_address), (sync_editable),
(sync_icon), (get_location_cb), (get_title_cb),
(remove_completion_actions), (add_completion_actions),
(connect_proxy), (disconnect_proxy),
(ephy_location_action_set_property),
(ephy_location_action_get_property),
(ephy_location_action_class_init), (ephy_location_action_init),
(ephy_location_action_finalize):
* src/ephy-window.c: (sync_tab_icon):
* src/toolbar.c: (toolbar_setup_actions), (toolbar_update_favicon):
* src/toolbar.h:
Unify the location and favicon actions.
* src/window-commands.c: (window_cmd_help_about):
Add translator comment to the translation-credits string.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/ephy-favicon-action.c | 323 | ||||
-rw-r--r-- | src/ephy-favicon-action.h | 52 | ||||
-rw-r--r-- | src/ephy-location-action.c | 181 | ||||
-rw-r--r-- | src/ephy-window.c | 2 | ||||
-rwxr-xr-x | src/toolbar.c | 23 | ||||
-rw-r--r-- | src/toolbar.h | 3 | ||||
-rw-r--r-- | src/window-commands.c | 8 |
8 files changed, 158 insertions, 436 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index b44c223ae..1ec9905ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,6 @@ NOINST_H_FILES = \ ephy-automation.h \ ephy-encoding-dialog.h \ ephy-encoding-menu.h \ - ephy-favicon-action.h \ ephy-go-action.h \ ephy-history-window.h \ ephy-home-action.h \ @@ -65,7 +64,6 @@ libephymain_la_SOURCES = \ ephy-encoding-menu.c \ ephy-extension.c \ ephy-extensions-manager.c \ - ephy-favicon-action.c \ ephy-go-action.c \ ephy-home-action.c \ ephy-history-window.c \ diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c deleted file mode 100644 index b8fdab189..000000000 --- a/src/ephy-favicon-action.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (C) 2003 Marco Pesenti Gritti - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -#include "config.h" - -#include "ephy-favicon-action.h" -#include "ephy-window.h" -#include "ephy-tab.h" -#include "ephy-dnd.h" -#include "ephy-favicon-cache.h" -#include "ephy-shell.h" -#include "ephy-debug.h" - -#include <gtk/gtktoolitem.h> -#include <gtk/gtkimage.h> -#include <gtk/gtkstock.h> -#include <gtk/gtkeventbox.h> -#include <gtk/gtktooltips.h> - -static GtkTargetEntry url_drag_types [] = -{ - { EPHY_DND_URI_LIST_TYPE, 0, 0 }, - { EPHY_DND_TEXT_TYPE, 0, 1 }, - { EPHY_DND_URL_TYPE, 0, 2 } -}; -static int n_url_drag_types = G_N_ELEMENTS (url_drag_types); - -#define EPHY_FAVICON_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_FAVICON_ACTION, EphyFaviconActionPrivate)) - -struct _EphyFaviconActionPrivate -{ - EphyWindow *window; - char *icon; - EphyFaviconCache *cache; -}; - -enum -{ - PROP_0, - PROP_WINDOW, - PROP_ICON -}; - -static void ephy_favicon_action_init (EphyFaviconAction *action); -static void ephy_favicon_action_class_init (EphyFaviconActionClass *class); -static void ephy_favicon_action_finalize (GObject *object); - -static GObjectClass *parent_class = NULL; - -GType -ephy_favicon_action_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - static const GTypeInfo type_info = - { - sizeof (EphyFaviconActionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) ephy_favicon_action_class_init, - (GClassFinalizeFunc) NULL, - NULL, - sizeof (EphyFaviconAction), - 0, /* n_preallocs */ - (GInstanceInitFunc) ephy_favicon_action_init, - }; - - type = g_type_register_static (GTK_TYPE_ACTION, - "EphyFaviconAction", - &type_info, 0); - } - return type; -} - -static void -each_url_get_data_binder (EphyDragEachSelectedItemDataGet iteratee, - gpointer iterator_context, gpointer data) -{ - const char *title; - char *location; - EphyTab *tab; - EphyEmbed *embed; - EphyWindow *window = EPHY_WINDOW(iterator_context); - - tab = ephy_window_get_active_tab (window); - embed = ephy_tab_get_embed (tab); - location = ephy_embed_get_location (embed, TRUE); - title = ephy_tab_get_title (tab); - - iteratee (location, title, data); - - g_free (location); -} - -static void -favicon_drag_data_get_cb (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint32 time, - EphyWindow *window) -{ - g_assert (widget != NULL); - g_return_if_fail (context != NULL); - - ephy_dnd_drag_data_get (widget, context, selection_data, - time, window, each_url_get_data_binder); -} - -static GtkWidget * -create_tool_item (GtkAction *action) -{ - GtkWidget *image; - GtkWidget *ebox; - GtkWidget *item; - - item = GTK_WIDGET (gtk_tool_item_new ()); - - ebox = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE); - image = gtk_image_new (); - gtk_container_add (GTK_CONTAINER (ebox), image); - gtk_container_set_border_width (GTK_CONTAINER (ebox), 2); - gtk_container_add (GTK_CONTAINER (item), ebox); - gtk_widget_show (image); - gtk_widget_show (ebox); - - g_object_set_data (G_OBJECT (item), "ebox", ebox); - g_object_set_data (G_OBJECT (item), "image", image); - - gtk_drag_source_set (ebox, - GDK_BUTTON1_MASK, - url_drag_types, - n_url_drag_types, - GDK_ACTION_COPY); - g_signal_connect (ebox, - "drag_data_get", - G_CALLBACK (favicon_drag_data_get_cb), - EPHY_FAVICON_ACTION (action)->priv->window); - - return item; -} - -static void -ephy_favicon_action_sync_icon (GtkAction *action, GParamSpec *pspec, - GtkWidget *proxy) -{ - EphyFaviconAction *fav_action = EPHY_FAVICON_ACTION (action); - char *url; - GtkWidget *image; - GdkPixbuf *pixbuf = NULL; - - url = fav_action->priv->icon; - image = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "image")); - - if (url) - { - pixbuf = ephy_favicon_cache_get (fav_action->priv->cache, url); - } - - if (pixbuf) - { - gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf); - g_object_unref (pixbuf); - } - else - { - gtk_image_set_from_stock (GTK_IMAGE (image), - GTK_STOCK_NEW, - GTK_ICON_SIZE_MENU); - } -} - -static gboolean -set_tooltip_cb (GtkToolItem *item, - GtkTooltips *tooltips, - const char *tip, - const char *tip_private, - EphyFaviconAction *action) -{ - GtkWidget *ebox; - - ebox = g_object_get_data (G_OBJECT (item), "ebox"); - g_return_val_if_fail (ebox != NULL, FALSE); - - gtk_tooltips_set_tip (tooltips, ebox, tip, tip_private); - - return TRUE; -} - -static void -connect_proxy (GtkAction *action, GtkWidget *proxy) -{ - if (GTK_IS_TOOL_ITEM (proxy)) - { - ephy_favicon_action_sync_icon (action, NULL, proxy); - g_signal_connect_object (action, "notify::icon", - G_CALLBACK (ephy_favicon_action_sync_icon), - proxy, 0); - - g_signal_connect (proxy, "set-tooltip", - G_CALLBACK (set_tooltip_cb), action); - - } - - GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); -} - -static void -ephy_favicon_action_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - EphyFaviconAction *fav = EPHY_FAVICON_ACTION (object); - - switch (prop_id) - { - case PROP_WINDOW: - fav->priv->window = EPHY_WINDOW (g_value_get_object (value)); - break; - case PROP_ICON: - g_free (fav->priv->icon); - fav->priv->icon = g_value_dup_string (value); - break; - } -} - -static void -ephy_favicon_action_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - EphyFaviconAction *fav = EPHY_FAVICON_ACTION (object); - - switch (prop_id) - { - case PROP_WINDOW: - g_value_set_object (value, fav->priv->window); - break; - case PROP_ICON: - g_value_set_string (value, fav->priv->icon); - break; - } -} - -static void -ephy_favicon_action_class_init (EphyFaviconActionClass *class) -{ - GtkActionClass *action_class; - GObjectClass *object_class = G_OBJECT_CLASS (class); - - object_class->set_property = ephy_favicon_action_set_property; - object_class->get_property = ephy_favicon_action_get_property; - object_class->finalize = ephy_favicon_action_finalize; - - parent_class = g_type_class_peek_parent (class); - action_class = GTK_ACTION_CLASS (class); - - action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM; - action_class->create_tool_item = create_tool_item; - action_class->connect_proxy = connect_proxy; - - g_object_class_install_property (object_class, - PROP_WINDOW, - g_param_spec_object ("window", - "Window", - "The window", - G_TYPE_OBJECT, - G_PARAM_READWRITE)); - g_object_class_install_property (object_class, - PROP_ICON, - g_param_spec_string ("icon", - "Icon", - "The icon", - NULL, - G_PARAM_READWRITE)); - - g_type_class_add_private (object_class, sizeof(EphyFaviconActionPrivate)); -} - -static void -ephy_favicon_action_init (EphyFaviconAction *action) -{ - action->priv = EPHY_FAVICON_ACTION_GET_PRIVATE (action); - - action->priv->cache = EPHY_FAVICON_CACHE - (ephy_embed_shell_get_favicon_cache - (EPHY_EMBED_SHELL (ephy_shell))); - g_object_ref (action->priv->cache); -} - -static void -ephy_favicon_action_finalize (GObject *object) -{ - EphyFaviconAction *action = EPHY_FAVICON_ACTION (object); - - g_free (action->priv->icon); - - g_object_unref (action->priv->cache); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} diff --git a/src/ephy-favicon-action.h b/src/ephy-favicon-action.h deleted file mode 100644 index cefef7320..000000000 --- a/src/ephy-favicon-action.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2003 Marco Pesenti Gritti - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - */ - -#ifndef EPHY_FAVICON_ACTION_H -#define EPHY_FAVICON_ACTION_H - -#include <gtk/gtkaction.h> - -#define EPHY_TYPE_FAVICON_ACTION (ephy_favicon_action_get_type ()) -#define EPHY_FAVICON_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_FAVICON_ACTION, EphyFaviconAction)) -#define EPHY_FAVICON_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EPHY_TYPE_FAVICON_ACTION, EphyFaviconActionClass)) -#define EPHY_IS_FAVICON_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EPHY_TYPE_FAVICON_ACTION)) -#define EPHY_IS_FAVICON_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EPHY_TYPE_FAVICON_ACTION)) -#define EPHY_FAVICON_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EPHY_TYPE_FAVICON_ACTION, EphyFaviconActionClass)) - -typedef struct _EphyFaviconAction EphyFaviconAction; -typedef struct _EphyFaviconActionClass EphyFaviconActionClass; -typedef struct _EphyFaviconActionPrivate EphyFaviconActionPrivate; - -struct _EphyFaviconAction -{ - GtkAction parent; - - /*< private >*/ - EphyFaviconActionPrivate *priv; -}; - -struct _EphyFaviconActionClass -{ - GtkActionClass parent_class; -}; - -GType ephy_favicon_action_get_type (void); - -#endif diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c index 4194b48f8..5cfa8714c 100644 --- a/src/ephy-location-action.c +++ b/src/ephy-location-action.c @@ -24,22 +24,28 @@ #include "ephy-location-action.h" #include "ephy-location-entry.h" #include "ephy-shell.h" +#include "ephy-favicon-cache.h" #include "ephy-completion-model.h" #include "ephy-link.h" #include "ephy-debug.h" #include <gtk/gtkentry.h> +#include <gtk/gtkstock.h> +#include <gtk/gtkimage.h> #include <gtk/gtkentrycompletion.h> #define EPHY_LOCATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LOCATION_ACTION, EphyLocationActionPrivate)) struct _EphyLocationActionPrivate { + EphyWindow *window; GList *actions; char *address; gboolean editable; EphyNode *smart_bmks; EphyBookmarks *bookmarks; + char *icon; + EphyFaviconCache *cache; }; static void ephy_location_action_init (EphyLocationAction *action); @@ -55,7 +61,9 @@ enum { PROP_0, PROP_ADDRESS, - PROP_EDITABLE + PROP_EDITABLE, + PROP_ICON, + PROP_WINDOW }; static GObjectClass *parent_class = NULL; @@ -148,83 +156,139 @@ user_changed_cb (GtkWidget *proxy, EphyLocationAction *action) } static void -sync_address (GtkAction *act, GParamSpec *pspec, GtkWidget *proxy) +sync_address (GtkAction *gaction, + GParamSpec *pspec, + GtkWidget *proxy) { - EphyLocationAction *action = EPHY_LOCATION_ACTION (act); + EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction); + EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); - LOG ("sync_address") + LOG ("sync_address %s", action->priv->address) - g_return_if_fail (EPHY_IS_LOCATION_ENTRY (proxy)); g_signal_handlers_block_by_func (proxy, G_CALLBACK (user_changed_cb), action); - ephy_location_entry_set_location (EPHY_LOCATION_ENTRY (proxy), - action->priv->address); + ephy_location_entry_set_location (lentry, action->priv->address); g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (user_changed_cb), action); } static void -sync_editable (GtkAction *act, GParamSpec *pspec, GtkWidget *proxy) +sync_editable (GtkAction *gaction, + GParamSpec *pspec, + GtkWidget *proxy) { - EphyLocationAction *action = EPHY_LOCATION_ACTION (act); + EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction); + EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); GtkWidget *entry; - entry = GTK_BIN (proxy)->child; + entry = ephy_location_entry_get_entry (lentry); gtk_editable_set_editable (GTK_EDITABLE (entry), action->priv->editable); } static void -remove_completion_actions (GtkAction *action, GtkWidget *proxy) +sync_icon (GtkAction *gaction, + GParamSpec *pspec, + GtkWidget *proxy) { + EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction); + EphyLocationActionPrivate *priv = action->priv; + EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (proxy); + GtkWidget *image; + GdkPixbuf *pixbuf; + + image = ephy_location_entry_get_image (entry); + pixbuf = ephy_favicon_cache_get (priv->cache, priv->icon); + + if (pixbuf != NULL) + { + gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf); + g_object_unref (pixbuf); + } + else + { + gtk_image_set_from_stock (GTK_IMAGE (image), + GTK_STOCK_NEW, + GTK_ICON_SIZE_MENU); + } +} + +static char * +get_location_cb (EphyLocationEntry *entry, + EphyLocationAction *action) +{ + EphyEmbed *embed; + + embed = ephy_window_get_active_embed (action->priv->window); + + return ephy_embed_get_location (embed, TRUE); +} + +static char * +get_title_cb (EphyLocationEntry *entry, + EphyLocationAction *action) +{ + EphyTab *tab; + + tab = ephy_window_get_active_tab (action->priv->window); + + return g_strdup (ephy_tab_get_title (tab)); +} + +static void +remove_completion_actions (GtkAction *gaction, + GtkWidget *proxy) +{ + EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction); + EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); GtkWidget *entry; GtkEntryCompletion *completion; - EphyLocationAction *la = EPHY_LOCATION_ACTION (action); GList *l; - entry = GTK_BIN (proxy)->child; + entry = ephy_location_entry_get_entry (lentry); completion = gtk_entry_get_completion (GTK_ENTRY (entry)); - for (l = la->priv->actions; l != NULL; l = l->next) + for (l = action->priv->actions; l != NULL; l = l->next) { gtk_entry_completion_delete_action (completion, 0); } g_signal_handlers_disconnect_by_func - (completion, G_CALLBACK (action_activated_cb), la); + (completion, G_CALLBACK (action_activated_cb), action); } static void -add_completion_actions (GtkAction *action, GtkWidget *proxy) +add_completion_actions (GtkAction *gaction, + GtkWidget *proxy) { + EphyLocationAction *action = EPHY_LOCATION_ACTION (gaction); + EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); GtkWidget *entry; GtkEntryCompletion *completion; - EphyLocationAction *la = EPHY_LOCATION_ACTION (action); GList *l; - entry = GTK_BIN (proxy)->child; + entry = ephy_location_entry_get_entry (lentry); completion = gtk_entry_get_completion (GTK_ENTRY (entry)); - for (l = la->priv->actions; l != NULL; l = l->next) + for (l = action->priv->actions; l != NULL; l = l->next) { EphyNode *bmk = l->data; const char *title; int index; - index = g_list_position (la->priv->actions, l); + index = g_list_position (action->priv->actions, l); title = ephy_node_get_property_string (bmk, EPHY_NODE_BMK_PROP_TITLE); gtk_entry_completion_insert_action_text (completion, index, (char*)title); } g_signal_connect (completion, "action_activated", - G_CALLBACK (action_activated_cb), la); + G_CALLBACK (action_activated_cb), action); } static void connect_proxy (GtkAction *action, GtkWidget *proxy) { - LOG ("Connect proxy") - if (EPHY_IS_LOCATION_ENTRY (proxy)) { + EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); EphyCompletionModel *model; GtkWidget *entry; @@ -244,13 +308,20 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) sync_editable (action, NULL, proxy); g_signal_connect_object (action, "notify::editable", G_CALLBACK (sync_editable), proxy, 0); + sync_icon (action, NULL, proxy); + g_signal_connect_object (action, "notify::icon", + G_CALLBACK (sync_icon), proxy, 0); - entry = GTK_BIN (proxy)->child; + entry = ephy_location_entry_get_entry (lentry); g_signal_connect_object (entry, "activate", G_CALLBACK (location_url_activate_cb), action, 0); g_signal_connect_object (proxy, "user_changed", G_CALLBACK (user_changed_cb), action, 0); + g_signal_connect_object (proxy, "get-location", + G_CALLBACK (get_location_cb), action, 0); + g_signal_connect_object (proxy, "get-title", + G_CALLBACK (get_title_cb), action, 0); } GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy); @@ -259,25 +330,22 @@ connect_proxy (GtkAction *action, GtkWidget *proxy) static void disconnect_proxy (GtkAction *action, GtkWidget *proxy) { - LOG ("Disconnect proxy") + GTK_ACTION_CLASS (parent_class)->disconnect_proxy (action, proxy); if (EPHY_IS_LOCATION_ENTRY (proxy)) { + EphyLocationEntry *lentry = EPHY_LOCATION_ENTRY (proxy); GtkWidget *entry; - entry = GTK_BIN (proxy)->child; - - g_signal_handlers_disconnect_by_func - (action, G_CALLBACK (sync_address), proxy); + entry = ephy_location_entry_get_entry (lentry); - g_signal_handlers_disconnect_by_func - (entry, G_CALLBACK (location_url_activate_cb), action); - - g_signal_handlers_disconnect_by_func - (proxy, G_CALLBACK (user_changed_cb), action); + g_signal_handlers_disconnect_matched (action, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, proxy); + g_signal_handlers_disconnect_matched (proxy, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, action); + g_signal_handlers_disconnect_matched (entry, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, action); } - - GTK_ACTION_CLASS (parent_class)->disconnect_proxy (action, proxy); } static void @@ -296,6 +364,13 @@ ephy_location_action_set_property (GObject *object, case PROP_EDITABLE: action->priv->editable = g_value_get_boolean (value); break; + case PROP_ICON: + g_free (action->priv->icon); + action->priv->icon = g_value_dup_string (value); + break; + case PROP_WINDOW: + action->priv->window = EPHY_WINDOW (g_value_get_object (value)); + break; } } @@ -315,6 +390,12 @@ ephy_location_action_get_property (GObject *object, case PROP_EDITABLE: g_value_set_boolean (value, action->priv->editable); break; + case PROP_ICON: + g_value_set_string (value, action->priv->icon); + break; + case PROP_WINDOW: + /* not readable */ + break; } } @@ -349,6 +430,22 @@ ephy_location_action_class_init (EphyLocationActionClass *class) TRUE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_ICON, + g_param_spec_string ("icon", + "Icon", + "The icon", + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_WINDOW, + g_param_spec_object ("window", + "Window", + "The navigation window", + G_TYPE_OBJECT, + G_PARAM_WRITABLE | + G_PARAM_CONSTRUCT_ONLY)); g_type_class_add_private (object_class, sizeof (EphyLocationActionPrivate)); } @@ -482,16 +579,22 @@ ephy_location_action_init (EphyLocationAction *action) EPHY_NODE_CHILD_CHANGED, (EphyNodeCallback)actions_child_changed_cb, G_OBJECT (action)); + + action->priv->cache = EPHY_FAVICON_CACHE + (ephy_embed_shell_get_favicon_cache (embed_shell)); + g_object_ref (action->priv->cache); } static void ephy_location_action_finalize (GObject *object) { EphyLocationAction *action = EPHY_LOCATION_ACTION (object); + EphyLocationActionPrivate *priv = action->priv; - g_list_free (action->priv->actions); - - g_free (action->priv->address); + g_list_free (priv->actions); + g_free (priv->address); + g_free (action->priv->icon); + g_object_unref (priv->cache); G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/src/ephy-window.c b/src/ephy-window.c index 70b508986..4a2a65f28 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1262,7 +1262,7 @@ sync_tab_icon (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) gtk_window_set_icon (GTK_WINDOW (window), pixbuf); - toolbar_update_favicon (window->priv->toolbar); + toolbar_update_favicon (window->priv->toolbar, address); if (pixbuf) { diff --git a/src/toolbar.c b/src/toolbar.c index e0f4a7f09..0c9857c01 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -23,7 +23,6 @@ #include "config.h" #include "toolbar.h" -#include "ephy-favicon-action.h" #include "ephy-link.h" #include "ephy-go-action.h" #include "ephy-home-action.h" @@ -376,6 +375,7 @@ toolbar_setup_actions (Toolbar *t) "stock_id", EPHY_STOCK_ENTRY, "tooltip", _("Enter a web address to open, or a phrase to search for on the web"), "visible-overflown", FALSE, + "window", t->priv->window, NULL); g_signal_connect_swapped (action, "open-link", G_CALLBACK (ephy_link_open), t); @@ -397,16 +397,6 @@ toolbar_setup_actions (Toolbar *t) gtk_action_group_add_action (t->priv->action_group, action); g_object_unref (action); - action = g_object_new (EPHY_TYPE_FAVICON_ACTION, - "name", "Favicon", - "label", _("Favicon"), - "tooltip", _("Drag and drop this icon to create a link to this page"), - "window", t->priv->window, - "visible-overflown", FALSE, - NULL); - gtk_action_group_add_action (t->priv->action_group, action); - g_object_unref (action); - action = g_object_new (EPHY_TYPE_GO_ACTION, "name", "ToolbarGo", "label", _("Go"), @@ -618,18 +608,15 @@ toolbar_set_location (Toolbar *t, } void -toolbar_update_favicon (Toolbar *t) +toolbar_update_favicon (Toolbar *t, + const char *icon) { - EphyTab *tab; - const char *url; GtkActionGroup *action_group; GtkAction *action; - tab = ephy_window_get_active_tab (t->priv->window); - url = ephy_tab_get_icon_address (tab); action_group = t->priv->action_group; - action = gtk_action_group_get_action (action_group, "Favicon"); - g_object_set (action, "icon", url, NULL); + action = gtk_action_group_get_action (action_group, "Location"); + g_object_set (action, "icon", icon, NULL); } const char * diff --git a/src/toolbar.h b/src/toolbar.h index 086943d40..38d51ae2b 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -73,7 +73,8 @@ void toolbar_set_location (Toolbar *t, void toolbar_activate_location (Toolbar *t); -void toolbar_update_favicon (Toolbar *t); +void toolbar_update_favicon (Toolbar *t, + const char *icon); void toolbar_update_navigation_actions (Toolbar *t, gboolean back, diff --git a/src/window-commands.c b/src/window-commands.c index 080610438..0a33f8caa 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -890,6 +890,14 @@ window_cmd_help_about (GtkAction *action, "copyright", "Copyright \xc2\xa9 2002-2005 Marco Pesenti Gritti", "authors", authors, "documenters", documenters, + /* Translators: This is a special message that shouldn't be translated + * literally. It is used in the about box to give credits to + * the translators. + * Thus, you should translate it to your name and email address. + * You should also include other translators who have contributed to + * this translation; in that case, please write each of them on a separate + * line seperated by newlines (\n). + */ "translator-credits", _("translator-credits"), "logo-icon-name", "web-browser", "website", "http://www.gnome.org/projects/epiphany", |