aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog45
-rw-r--r--data/ui/epiphany-toolbar.xml2
-rw-r--r--lib/ephy-marshal.list1
-rw-r--r--lib/ephy-signal-accumulator.c11
-rw-r--r--lib/ephy-signal-accumulator.h4
-rw-r--r--lib/widgets/ephy-location-entry.c156
-rw-r--r--lib/widgets/ephy-location-entry.h11
-rw-r--r--src/Makefile.am2
-rw-r--r--src/ephy-favicon-action.c323
-rw-r--r--src/ephy-favicon-action.h52
-rw-r--r--src/ephy-location-action.c181
-rw-r--r--src/ephy-window.c2
-rwxr-xr-xsrc/toolbar.c23
-rw-r--r--src/toolbar.h3
-rw-r--r--src/window-commands.c8
15 files changed, 357 insertions, 467 deletions
diff --git a/ChangeLog b/ChangeLog
index 53aee9660..e7f50c27f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,48 @@
+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.
+
+2005-01-07 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/Makefile.am:
+ * lib/Makefile.am:
+ * lib/egg/Makefile.am:
+ * src/Makefile.am:
+
+ Avoid unnecessary rebuilts of the generated enum .h files by using
+ stamp files.
+
2005-01-07 Christian Persch <chpe@cvs.gnome.org>
* lib/egg/egg-toolbars-model.c: (egg_toolbars_model_get_type),
diff --git a/data/ui/epiphany-toolbar.xml b/data/ui/epiphany-toolbar.xml
index b1cb0f73d..e6f1e4278 100644
--- a/data/ui/epiphany-toolbar.xml
+++ b/data/ui/epiphany-toolbar.xml
@@ -17,7 +17,6 @@
<toolitem name="FileBookmarkPage"/>
<toolitem name="ViewFullscreen"/>
<toolitem name="EditFind"/>
- <toolitem name="Favicon"/>
<toolitem name="Location"/>
<toolitem name="ToolbarGo"/>
<toolitem name="Zoom"/>
@@ -35,7 +34,6 @@
<toolitem name="EditFind"/>
</toolbar>
<toolbar name="EntryToolbar">
- <toolitem name="Favicon"/>
<toolitem name="Location"/>
<toolitem name="ToolbarGo"/>
</toolbar>
diff --git a/lib/ephy-marshal.list b/lib/ephy-marshal.list
index 8d61a9a54..3bfa98df3 100644
--- a/lib/ephy-marshal.list
+++ b/lib/ephy-marshal.list
@@ -3,6 +3,7 @@ BOOLEAN:STRING,STRING
BOOLEAN:VOID
OBJECT:FLAGS
OBJECT:STRING,OBJECT,FLAGS
+STRING:VOID
VOID:POINTER,BOOLEAN
VOID:POINTER,POINTER
VOID:STRING,FLAGS
diff --git a/lib/ephy-signal-accumulator.c b/lib/ephy-signal-accumulator.c
index d34273721..eb6a05562 100644
--- a/lib/ephy-signal-accumulator.c
+++ b/lib/ephy-signal-accumulator.c
@@ -48,3 +48,14 @@ ephy_signal_accumulator_object (GSignalInvocationHint *ihint,
return TRUE;
}
+
+gboolean
+ephy_signal_accumulator_string (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer accu_data)
+{
+ g_value_copy (handler_return, return_accu);
+
+ return g_value_get_string (handler_return) == NULL;
+}
diff --git a/lib/ephy-signal-accumulator.h b/lib/ephy-signal-accumulator.h
index 8991bcf12..b62e7d610 100644
--- a/lib/ephy-signal-accumulator.h
+++ b/lib/ephy-signal-accumulator.h
@@ -30,6 +30,10 @@ gboolean ephy_signal_accumulator_object (GSignalInvocationHint *ihint,
const GValue *handler_return,
gpointer accu_data);
+gboolean ephy_signal_accumulator_string (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer accu_data);
G_END_DECLS
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 0dbb7192e..889b23003 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -26,9 +26,12 @@
#include "ephy-tree-model-node.h"
#include "ephy-location-entry.h"
#include "ephy-marshal.h"
-#include "ephy-debug.h"
+#include "ephy-signal-accumulator.h"
+#include "ephy-dnd.h"
#include "egg-editable-toolbar.h"
+#include "ephy-debug.h"
+#include <glib/gi18n.h>
#include <gtk/gtktoolbar.h>
#include <gtk/gtkentry.h>
#include <gtk/gtkwindow.h>
@@ -37,9 +40,11 @@
#include <gtk/gtktreemodelsort.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkimage.h>
+#include <gtk/gtkeventbox.h>
+#include <gtk/gtkbox.h>
+#include <gtk/gtkhbox.h>
#include <gtk/gtkimagemenuitem.h>
#include <gtk/gtkseparatormenuitem.h>
-#include <glib/gi18n.h>
#include <string.h>
@@ -48,6 +53,8 @@
struct _EphyLocationEntryPrivate
{
GtkWidget *entry;
+ GtkWidget *icon_ebox;
+ GtkWidget *icon;
char *before_completion;
gboolean user_changed;
@@ -71,17 +78,27 @@ web_prefixes [] =
{ "www.", 4 }
};
+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);
+
static void ephy_location_entry_class_init (EphyLocationEntryClass *klass);
static void ephy_location_entry_init (EphyLocationEntry *le);
static GObjectClass *parent_class = NULL;
-enum EphyLocationEntrySignalsEnum
+enum signalsEnum
{
USER_CHANGED,
+ GET_LOCATION,
+ GET_TITLE,
LAST_SIGNAL
};
-static gint EphyLocationEntrySignals[LAST_SIGNAL];
+static gint signals[LAST_SIGNAL];
enum
{
@@ -133,9 +150,9 @@ ephy_location_entry_set_tooltip (GtkToolItem *tool_item,
{
EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (tool_item);
- g_return_val_if_fail (EPHY_IS_LOCATION_ENTRY (entry), FALSE);
-
gtk_tooltips_set_tip (tooltips, entry->priv->entry, tip_text, tip_private);
+ gtk_tooltips_set_tip (tooltips, entry->priv->icon_ebox,
+ _("Drag and drop this icon to create a link to this page"), NULL);
return TRUE;
}
@@ -150,9 +167,9 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
tool_item_class->set_tooltip = ephy_location_entry_set_tooltip;
- EphyLocationEntrySignals[USER_CHANGED] = g_signal_new (
+ signals[USER_CHANGED] = g_signal_new (
"user_changed", G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EphyLocationEntryClass, user_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
@@ -160,6 +177,27 @@ ephy_location_entry_class_init (EphyLocationEntryClass *klass)
0,
G_TYPE_NONE);
+ signals[GET_LOCATION] = g_signal_new (
+ "get-location", G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyLocationEntryClass, get_location),
+ ephy_signal_accumulator_string, NULL,
+ ephy_marshal_STRING__VOID,
+ G_TYPE_STRING,
+ 0,
+ G_TYPE_NONE);
+
+ signals[GET_TITLE] = g_signal_new (
+ "get-title", G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyLocationEntryClass, get_title),
+ ephy_signal_accumulator_string, NULL,
+ ephy_marshal_STRING__VOID,
+ G_TYPE_STRING,
+ 0,
+ G_TYPE_NONE);
+
+
g_type_class_add_private (object_class, sizeof (EphyLocationEntryPrivate));
}
@@ -170,7 +208,7 @@ editable_changed_cb (GtkEditable *editable, EphyLocationEntry *e)
if (p->user_changed)
{
- g_signal_emit (e, EphyLocationEntrySignals[USER_CHANGED], 0);
+ g_signal_emit (e, signals[USER_CHANGED], 0);
}
}
@@ -382,27 +420,77 @@ entry_populate_popup_cb (GtkEntry *entry,
}
static void
-ephy_location_entry_construct_contents (EphyLocationEntry *le)
+each_url_get_data_binder (EphyDragEachSelectedItemDataGet iteratee,
+ gpointer iterator_context,
+ gpointer return_data)
{
- EphyLocationEntryPrivate *p = le->priv;
+ EphyLocationEntry *entry = EPHY_LOCATION_ENTRY (iterator_context);
+ char *title = NULL, *address = NULL;
+
+ g_signal_emit (entry, signals[GET_LOCATION], 0, &address);
+ g_signal_emit (entry, signals[GET_TITLE], 0, &title);
+ g_return_if_fail (address != NULL && title != NULL);
+
+ iteratee (address, title, return_data);
- LOG ("EphyLocationEntry constructing contents %p", le)
-
- p->entry = gtk_entry_new ();
-
- gtk_container_add (GTK_CONTAINER (le), p->entry);
- gtk_widget_show (p->entry);
-
- g_signal_connect (p->entry, "populate_popup",
- G_CALLBACK (entry_populate_popup_cb), le);
- g_signal_connect (p->entry, "button_press_event",
- G_CALLBACK (entry_button_press_cb), le);
- g_signal_connect (p->entry, "changed",
- G_CALLBACK (editable_changed_cb), le);
- g_signal_connect (p->entry, "drag_motion",
- G_CALLBACK (entry_drag_motion_cb), le);
- g_signal_connect (p->entry, "drag_drop",
- G_CALLBACK (entry_drag_drop_cb), le);
+ g_free (address);
+ g_free (title);
+}
+
+static void
+favicon_drag_data_get_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint32 time,
+ EphyLocationEntry *entry)
+{
+ g_assert (widget != NULL);
+ g_return_if_fail (context != NULL);
+
+ ephy_dnd_drag_data_get (widget, context, selection_data,
+ time, entry, each_url_get_data_binder);
+}
+
+static void
+ephy_location_entry_construct_contents (EphyLocationEntry *entry)
+{
+ EphyLocationEntryPrivate *priv = entry->priv;
+ GtkWidget *hbox;
+
+ LOG ("EphyLocationEntry constructing contents %p", entry)
+
+ hbox = gtk_hbox_new (FALSE, 3); /* FIXME themeable spacing? */
+ gtk_container_add (GTK_CONTAINER (entry), hbox);
+
+ priv->icon_ebox = gtk_event_box_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (priv->icon_ebox), 2);
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->icon_ebox), FALSE);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->icon_ebox, FALSE, FALSE, 0);
+ gtk_drag_source_set (priv->icon_ebox, GDK_BUTTON1_MASK,
+ url_drag_types, n_url_drag_types,
+ GDK_ACTION_COPY);
+
+ priv->icon = gtk_image_new ();
+ gtk_container_add (GTK_CONTAINER (priv->icon_ebox), priv->icon);
+
+ priv->entry = gtk_entry_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), priv->entry, TRUE, TRUE, 0);
+
+ gtk_widget_show_all (hbox);
+
+ g_signal_connect (priv->icon_ebox, "drag_data_get",
+ G_CALLBACK (favicon_drag_data_get_cb), entry);
+ g_signal_connect (priv->entry, "populate_popup",
+ G_CALLBACK (entry_populate_popup_cb), entry);
+ g_signal_connect (priv->entry, "button_press_event",
+ G_CALLBACK (entry_button_press_cb), entry);
+ g_signal_connect (priv->entry, "changed",
+ G_CALLBACK (editable_changed_cb), entry);
+ g_signal_connect (priv->entry, "drag_motion",
+ G_CALLBACK (entry_drag_motion_cb), entry);
+ g_signal_connect (priv->entry, "drag_drop",
+ G_CALLBACK (entry_drag_drop_cb), entry);
}
static void
@@ -518,3 +606,15 @@ ephy_location_entry_activate (EphyLocationEntry *le)
gtk_window_set_focus (GTK_WINDOW(toplevel),
le->priv->entry);
}
+
+GtkWidget *
+ephy_location_entry_get_entry (EphyLocationEntry *entry)
+{
+ return entry->priv->entry;
+}
+
+GtkWidget *
+ephy_location_entry_get_image (EphyLocationEntry *entry)
+{
+ return entry->priv->icon;
+}
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index 08446b0d5..c4a44addc 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -25,6 +25,7 @@
#include "ephy-node.h"
+#include <gtk/gtkwidget.h>
#include <gtk/gtktoolitem.h>
#include <gtk/gtktreemodel.h>
@@ -45,7 +46,11 @@ struct _EphyLocationEntryClass
{
GtkToolItemClass parent_class;
- void (*user_changed) (EphyLocationEntry *le);
+ /* Signals */
+ void (*user_changed) (EphyLocationEntry *entry);
+ /* for getting the drag data */
+ char * (* get_location) (EphyLocationEntry *entry);
+ char * (* get_title) (EphyLocationEntry *entry);
};
struct _EphyLocationEntry
@@ -74,6 +79,10 @@ const char *ephy_location_entry_get_location (EphyLocationEntry *le);
void ephy_location_entry_activate (EphyLocationEntry *le);
+GtkWidget *ephy_location_entry_get_entry (EphyLocationEntry *entry);
+
+GtkWidget *ephy_location_entry_get_image (EphyLocationEntry *entry);
+
G_END_DECLS
#endif
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",