aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-07-27 01:41:04 +0800
committerChristian Persch <chpe@src.gnome.org>2005-07-27 01:41:04 +0800
commitfc69f229f306940d351fd20606fe6a77104ef48d (patch)
tree4ebf2c194552d38c330a9ac974b5c38abe1b198c /src/bookmarks/ephy-bookmarks.c
parent185ea56fa4d1b5626ff1418a90d979f3cc15b108 (diff)
downloadgsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar
gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.gz
gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.bz2
gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.lz
gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.xz
gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.zst
gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.zip
Unify bookmarks/smart bookmarks address resolution, and add a signal to
2005-07-26 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-marshal.list: * src/bookmarks/ephy-bookmark-action.c: (open_in_tab_activate_cb), (open_in_window_activate_cb), (activate_cb): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_class_init), (impl_resolve_address), (ephy_bookmarks_resolve_address): * src/bookmarks/ephy-bookmarks.h: * src/bookmarks/ephy-topic-action.c: (menu_activate_cb), (open_in_tabs_activate_cb): * src/ephy-location-action.c: (action_activated_cb), (entry_activate_cb): * src/epiphany.defs: Unify bookmarks/smart bookmarks address resolution, and add a signal to EphyBookmarks for it.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r--src/bookmarks/ephy-bookmarks.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 948679577..b81ae3d46 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -35,6 +35,8 @@
#include "ephy-bookmarks-import.h"
#include "ephy-bookmark-properties.h"
#include "ephy-prefs.h"
+#include "ephy-marshal.h"
+#include "ephy-signal-accumulator.h"
#include "eel-gconf-extensions.h"
@@ -116,6 +118,7 @@ enum
enum
{
TREE_CHANGED,
+ RESOLVE_ADDRESS,
LAST_SIGNAL
};
@@ -124,6 +127,7 @@ static guint ephy_bookmarks_signals[LAST_SIGNAL] = { 0 };
static void ephy_bookmarks_class_init (EphyBookmarksClass *klass);
static void ephy_bookmarks_init (EphyBookmarks *tab);
static void ephy_bookmarks_finalize (GObject *object);
+static char *impl_resolve_address (EphyBookmarks*, const char*, const char*);
static GObjectClass *parent_class = NULL;
@@ -295,8 +299,10 @@ ephy_bookmarks_class_init (EphyBookmarksClass *klass)
object_class->set_property = ephy_bookmarks_set_property;
object_class->get_property = ephy_bookmarks_get_property;
+ klass->resolve_address = impl_resolve_address;
+
ephy_bookmarks_signals[TREE_CHANGED] =
- g_signal_new ("tree_changed",
+ g_signal_new ("tree-changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EphyBookmarksClass, tree_changed),
@@ -305,6 +311,18 @@ ephy_bookmarks_class_init (EphyBookmarksClass *klass)
G_TYPE_NONE,
0);
+ ephy_bookmarks_signals[RESOLVE_ADDRESS] =
+ g_signal_new ("resolve-address",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EphyBookmarksClass, resolve_address),
+ ephy_signal_accumulator_string, NULL,
+ ephy_marshal_STRING__STRING_STRING,
+ G_TYPE_STRING,
+ 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
g_object_class_install_property (object_class,
PROP_TOOLBARS_MODEL,
g_param_spec_object ("toolbars-model",
@@ -1315,20 +1333,22 @@ get_option (char *start,
return g_strndup (start, end - start);
}
-char *
-ephy_bookmarks_solve_smart_url (EphyBookmarks *eb,
- const char *smart_url,
- const char *content)
+static char *
+impl_resolve_address (EphyBookmarks *eb,
+ const char *address,
+ const char *content)
{
GString *result;
char *pos, *oldpos, *arg, *escaped_arg, *encoding, *optionsend;
- if (content == NULL || smart_url == NULL) return NULL;
+ if (address == NULL) return NULL;
- result = g_string_new_len (NULL, strlen (content) + strlen (smart_url));
+ if (content == NULL) content = "";
+
+ result = g_string_new_len (NULL, strlen (content) + strlen (address));
/* substitute %s's */
- oldpos = (char*) smart_url;
+ oldpos = (char*) address;
while ((pos = strstr (oldpos, "%s")) != NULL)
{
g_string_append_len (result, oldpos, pos - oldpos);
@@ -1371,6 +1391,22 @@ ephy_bookmarks_solve_smart_url (EphyBookmarks *eb,
return g_string_free (result, FALSE);
}
+char *
+ephy_bookmarks_resolve_address (EphyBookmarks *eb,
+ const char *address,
+ const char *parameter)
+{
+ char *retval = NULL;
+
+ g_return_val_if_fail (EPHY_IS_BOOKMARKS (eb), NULL);
+ g_return_val_if_fail (address != NULL, NULL);
+
+ g_signal_emit (eb, ephy_bookmarks_signals[RESOLVE_ADDRESS], 0,
+ address, parameter, &retval);
+
+ return retval;
+}
+
guint
ephy_bookmarks_get_smart_bookmark_width (EphyNode *bookmark)
{