aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmark-action.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-06-27 01:37:13 +0800
committerChristian Persch <chpe@src.gnome.org>2003-06-27 01:37:13 +0800
commit55a49dd166a823c2ac6551a7aedb39c7cd2951b5 (patch)
tree1d0867edefb99b802d0b055416716474a948baae /src/bookmarks/ephy-bookmark-action.c
parent9dbfd9b34b6dab67863392504c221e0c6f0eb4a2 (diff)
downloadgsoc2013-epiphany-55a49dd166a823c2ac6551a7aedb39c7cd2951b5.tar
gsoc2013-epiphany-55a49dd166a823c2ac6551a7aedb39c7cd2951b5.tar.gz
gsoc2013-epiphany-55a49dd166a823c2ac6551a7aedb39c7cd2951b5.tar.bz2
gsoc2013-epiphany-55a49dd166a823c2ac6551a7aedb39c7cd2951b5.tar.lz
gsoc2013-epiphany-55a49dd166a823c2ac6551a7aedb39c7cd2951b5.tar.xz
gsoc2013-epiphany-55a49dd166a823c2ac6551a7aedb39c7cd2951b5.tar.zst
gsoc2013-epiphany-55a49dd166a823c2ac6551a7aedb39c7cd2951b5.zip
Make the toolbar overflow item really activate the bookmark action.
2003-06-26 Christian Persch <chpe@cvs.gnome.org> * src/bookmarks/ephy-bookmark-action.c: (connect_proxy), (entry_activated_cb), (activate_cb), (menu_activate_cb): * src/bookmarks/ephy-bookmark-toolitem.h: * src/bookmarks/ephy-bookmark-toolitem.c: (activated_cb), (ephy_bookmark_toolitem_create_menu_proxy), (ephy_bookmark_toolitem_class_init): Make the toolbar overflow item really activate the bookmark action. Simplify code a little.
Diffstat (limited to 'src/bookmarks/ephy-bookmark-action.c')
-rw-r--r--src/bookmarks/ephy-bookmark-action.c78
1 files changed, 35 insertions, 43 deletions
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 119007818..1362b8d02 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -196,53 +196,45 @@ ephy_bookmark_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget
}
static void
-entry_activated_cb (GtkWidget *entry, EggAction *action)
+activate_cb (GtkWidget *widget, const char *text, EggAction *action)
{
- char *text;
- char *solved;
- char *smart_url;
- EphyBookmarks *bookmarks;
+ char *location = NULL;
- bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ if (text != NULL && text[0] != '\0')
+ {
+ char *smart_url;
+ EphyBookmarks *bookmarks;
- text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
- if (text == NULL) return;
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
- smart_url = EPHY_BOOKMARK_ACTION (action)->priv->location;
- solved = ephy_bookmarks_solve_smart_url (bookmarks,
- smart_url,
- text);
- g_signal_emit (action,
- ephy_bookmark_action_signals[GO_LOCATION],
- 0, solved);
+ smart_url = EPHY_BOOKMARK_ACTION (action)->priv->location;
+ location = ephy_bookmarks_solve_smart_url (bookmarks,
+ smart_url,
+ text);
+ }
+ else
+ {
+ EphyBookmarkAction *baction = EPHY_BOOKMARK_ACTION (action);
- g_free (text);
-}
+ if (baction->priv->smart_url)
+ {
+ GnomeVFSURI *uri;
-static void
-activate_cb (GtkWidget *widget, EggAction *action)
-{
- EphyBookmarkAction *baction = EPHY_BOOKMARK_ACTION (action);
- char *location = NULL;
+ uri = gnome_vfs_uri_new (baction->priv->location);
- if (baction->priv->smart_url)
- {
- GnomeVFSURI *uri;
-
- uri = gnome_vfs_uri_new (baction->priv->location);
+ if (uri)
+ {
+ location = g_strdup (gnome_vfs_uri_get_host_name (uri));
+ gnome_vfs_uri_unref (uri);
+ }
+ }
- if (uri)
+ if (location == NULL)
{
- location = g_strdup (gnome_vfs_uri_get_host_name (uri));
- gnome_vfs_uri_unref (uri);
+ location = g_strdup (baction->priv->location);
}
}
- if (location == NULL)
- {
- location = g_strdup (baction->priv->location);
- }
-
g_signal_emit (action,
ephy_bookmark_action_signals[GO_LOCATION],
0, location);
@@ -251,10 +243,14 @@ activate_cb (GtkWidget *widget, EggAction *action)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+menu_activate_cb (GtkWidget *widget, EggAction *action)
{
- GtkWidget *button, *entry;
+ activate_cb (widget, NULL, action);
+}
+static void
+connect_proxy (EggAction *action, GtkWidget *proxy)
+{
LOG ("Connecting action %p to proxy %p", action, proxy)
(* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
@@ -273,15 +269,11 @@ connect_proxy (EggAction *action, GtkWidget *proxy)
if (EGG_IS_TOOL_ITEM (proxy))
{
- button = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "button"));
- g_signal_connect (button, "clicked", G_CALLBACK (activate_cb), action);
-
- entry = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "entry"));
- g_signal_connect (entry, "activate", G_CALLBACK (entry_activated_cb), action);
+ g_signal_connect (proxy, "activate", G_CALLBACK (activate_cb), action);
}
else if (GTK_IS_MENU_ITEM (proxy))
{
- g_signal_connect (proxy, "activate", G_CALLBACK (activate_cb), action);
+ g_signal_connect (proxy, "activate", G_CALLBACK (menu_activate_cb), action);
}
}