diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-30 05:06:40 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-30 05:06:40 +0800 |
commit | dff9e866bb4f2fc18074d5c638733ee860746f9b (patch) | |
tree | 654f9332e949ce91c5d2f5c9a61280c874ce0ab5 /src/toolbar.c | |
parent | ec52d432955e2e2d5467a8da01c8ce929388325c (diff) | |
download | gsoc2013-epiphany-dff9e866bb4f2fc18074d5c638733ee860746f9b.tar gsoc2013-epiphany-dff9e866bb4f2fc18074d5c638733ee860746f9b.tar.gz gsoc2013-epiphany-dff9e866bb4f2fc18074d5c638733ee860746f9b.tar.bz2 gsoc2013-epiphany-dff9e866bb4f2fc18074d5c638733ee860746f9b.tar.lz gsoc2013-epiphany-dff9e866bb4f2fc18074d5c638733ee860746f9b.tar.xz gsoc2013-epiphany-dff9e866bb4f2fc18074d5c638733ee860746f9b.tar.zst gsoc2013-epiphany-dff9e866bb4f2fc18074d5c638733ee860746f9b.zip |
Complete (or nearly) toolbar editor implementation. Bookmarks are
2003-01-29 Marco Pesenti Gritti <marco@it.gnome.org>
* lib/ephy-bonobo-extensions.c: (ephy_bonobo_clear_path),
(ephy_bonobo_replace_path):
* lib/ephy-bonobo-extensions.h:
* lib/ephy-marshal.list:
* lib/ephy-string.c: (ephy_str_to_int):
* lib/ephy-string.h:
* lib/widgets/ephy-editable-toolbar.c: (impl_get_action),
(add_action), (parse_item_list), (add_toolbar), (parse_toolbars),
(load_defaults), (load_toolbar), (drag_data_received_cb),
(setup_toolbar_drag), (ensure_toolbars_min_size), (do_merge),
(ephy_editable_toolbar_class_init), (editor_get_dimensions),
(hide_editor), (editor_close_cb), (editor_add_toolbar_cb),
(editor_drag_data_received_cb), (editor_drag_data_delete_cb),
(setup_editor), (button_press_cb), (show_editor),
(ephy_editable_toolbar_edit), (ephy_editable_toolbar_get_action):
* lib/widgets/ephy-editable-toolbar.h:
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_get_bookmark_id):
* src/bookmarks/ephy-bookmarks.h:
* src/session.c: (session_load):
* src/toolbar.c: (go_location_cb), (toolbar_get_action),
(toolbar_class_init), (toolbar_init):
Complete (or nearly) toolbar editor implementation.
Bookmarks are implemented too, but some minor problems
are stopping them to work.
Diffstat (limited to 'src/toolbar.c')
-rwxr-xr-x | src/toolbar.c | 94 |
1 files changed, 56 insertions, 38 deletions
diff --git a/src/toolbar.c b/src/toolbar.c index ff5f9cba1..29ae4665f 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -100,17 +100,72 @@ toolbar_get_type (void) } static void +go_location_cb (EggAction *action, char *location, EphyWindow *window) +{ + EphyEmbed *embed; + + embed = ephy_window_get_active_embed (window); + g_return_if_fail (embed != NULL); + + ephy_embed_load_url (embed, location); +} + +static EggAction * +toolbar_get_action (EphyEditableToolbar *etoolbar, + const char *type, + const char *name) +{ + Toolbar *t = TOOLBAR (etoolbar); + EggAction *action = NULL; + EphyBookmarks *bookmarks; + gulong id = 0; + + if (type && (strcmp (type, EPHY_DND_URL_TYPE) == 0)) + { + char action_name[255]; + + bookmarks = ephy_shell_get_bookmarks (ephy_shell); + id = ephy_bookmarks_get_bookmark_id (bookmarks, name); + + snprintf (action_name, 255, "GoBookmarkId%ld", id); + action = ephy_bookmark_action_new (name, id); + } + else if (g_str_has_prefix (name, "GoBookmarkId")) + { + ephy_str_to_int (name + strlen ("GoBookmarkId"), &id); + } + + if (action) + { + g_signal_connect (action, "go_location", + G_CALLBACK (go_location_cb), t->priv->window); + egg_action_group_add_action (t->priv->action_group, action); + g_object_unref (action); + } + else + { + action = EPHY_EDITABLE_TOOLBAR_CLASS + (parent_class)->get_action (etoolbar, type, name); + } + + return action; +} + +static void toolbar_class_init (ToolbarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + EphyEditableToolbarClass *eet_class; parent_class = g_type_class_peek_parent (klass); + eet_class = EPHY_EDITABLE_TOOLBAR_CLASS (klass); object_class->finalize = toolbar_finalize; - object_class->set_property = toolbar_set_property; object_class->get_property = toolbar_get_property; + eet_class->get_action = toolbar_get_action; + g_object_class_install_property (object_class, PROP_EPHY_WINDOW, g_param_spec_object ("EphyWindow", @@ -153,17 +208,6 @@ toolbar_get_property (GObject *object, } static void -go_location_cb (EggAction *action, char *location, EphyWindow *window) -{ - EphyEmbed *embed; - - embed = ephy_window_get_active_embed (window); - g_return_if_fail (embed != NULL); - - ephy_embed_load_url (embed, location); -} - -static void toolbar_setup_actions (Toolbar *t) { EggAction *action; @@ -246,28 +290,6 @@ toolbar_set_window (Toolbar *t, EphyWindow *window) } static void -editable_toolbar_request_action (Toolbar *t, - const char *name, - EphyEditableToolbar *etoolbar) -{ - guint id; - - if (g_str_has_prefix (name, "GoBookmark") && - ephy_str_to_int (name + strlen ("GoBookmark"), &id)) - { - EggAction *action; - - LOG ("Create an action for bookmark %d", id) - - action = ephy_bookmark_action_new (name, id); - g_signal_connect (action, "go_location", - G_CALLBACK (go_location_cb), t->priv->window); - egg_action_group_add_action (t->priv->action_group, action); - g_object_unref (action); - } -} - -static void toolbar_init (Toolbar *t) { t->priv = g_new0 (ToolbarPrivate, 1); @@ -275,10 +297,6 @@ toolbar_init (Toolbar *t) t->priv->window = NULL; t->priv->ui_merge = NULL; t->priv->visibility = TRUE; - - g_signal_connect (t, "request_action", - G_CALLBACK (editable_toolbar_request_action), - EPHY_EDITABLE_TOOLBAR (t)); } static void |