aboutsummaryrefslogtreecommitdiffstats
path: root/src/toolbar.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-24 22:48:34 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-24 22:48:34 +0800
commitb0f66eed569bdc92c55cb8c39f62b5694b7f62b3 (patch)
tree16b2f0a1106cdf05e2a7a05c0572f656307a1e2e /src/toolbar.c
parent459e4b6f3a76d3904c84127b1147a14676586ed7 (diff)
downloadgsoc2013-epiphany-b0f66eed569bdc92c55cb8c39f62b5694b7f62b3.tar
gsoc2013-epiphany-b0f66eed569bdc92c55cb8c39f62b5694b7f62b3.tar.gz
gsoc2013-epiphany-b0f66eed569bdc92c55cb8c39f62b5694b7f62b3.tar.bz2
gsoc2013-epiphany-b0f66eed569bdc92c55cb8c39f62b5694b7f62b3.tar.lz
gsoc2013-epiphany-b0f66eed569bdc92c55cb8c39f62b5694b7f62b3.tar.xz
gsoc2013-epiphany-b0f66eed569bdc92c55cb8c39f62b5694b7f62b3.tar.zst
gsoc2013-epiphany-b0f66eed569bdc92c55cb8c39f62b5694b7f62b3.zip
Implement the data part of the toolbar editor. Partial implementation of
2003-01-24 Marco Pesenti Gritti <marco@it.gnome.org> * NEWS: * configure.in: * data/ui/epiphany-toolbar.xml.in: * lib/egg/Makefile.am: * lib/widgets/Makefile.am: * lib/widgets/ephy-editable-toolbar.c: (ephy_editable_toolbar_get_type), (find_action), (add_action_to_list), (parse_item_list), (parse_toolbars), (load_defaults), (load_toolbar), (toolbar_list_to_xml), (toolbar_list_to_string), (do_merge), (ephy_editable_toolbar_set_merge), (ephy_editable_toolbar_set_property), (ephy_editable_toolbar_get_property), (ephy_editable_toolbar_class_init), (ephy_editable_toolbar_init), (ephy_editable_toolbar_save), (ephy_editable_toolbar_finalize), (ephy_editable_toolbar_new): * lib/widgets/ephy-editable-toolbar.h: * src/Makefile.am: * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmark-action.c: (ephy_bookmark_action_get_type), (create_tool_item), (ephy_bookmark_action_sync_label), (connect_proxy), (ephy_bookmark_action_set_property), (ephy_bookmark_action_get_property), (ephy_bookmark_action_class_init), (ephy_bookmark_action_init), (ephy_bookmark_action_new): * src/bookmarks/ephy-bookmark-action.h: * src/ephy-tab.c: (ephy_tab_finalize), (ephy_tab_set_location): * src/toolbar.c: (toolbar_get_type), (toolbar_set_window), (editable_toolbar_request_action), (toolbar_init), (toolbar_finalize): * src/toolbar.h: Implement the data part of the toolbar editor. Partial implementation of Bookmark action. Try to fix crashes when switching tabs.
Diffstat (limited to 'src/toolbar.c')
-rwxr-xr-xsrc/toolbar.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/src/toolbar.c b/src/toolbar.c
index c97311fc8..7edc38490 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -28,9 +28,13 @@
#include "ephy-location-action.h"
#include "ephy-favicon-action.h"
#include "ephy-navigation-action.h"
+#include "ephy-bookmark-action.h"
#include "window-commands.h"
+#include "ephy-string.h"
#include "ephy-debug.h"
+#include <string.h>
+
static void toolbar_class_init (ToolbarClass *klass);
static void toolbar_init (Toolbar *t);
static void toolbar_finalize (GObject *object);
@@ -86,7 +90,7 @@ toolbar_get_type (void)
(GInstanceInitFunc) toolbar_init
};
- toolbar_type = g_type_register_static (G_TYPE_OBJECT,
+ toolbar_type = g_type_register_static (EPHY_EDITABLE_TOOLBAR_TYPE,
"Toolbar",
&our_info, 0);
}
@@ -149,14 +153,6 @@ toolbar_get_property (GObject *object,
}
static void
-toolbar_setup_widgets (Toolbar *t)
-{
- egg_menu_merge_add_ui_from_file
- (t->priv->ui_merge, ephy_file ("epiphany-toolbar.xml"), NULL);
- egg_menu_merge_ensure_update (t->priv->ui_merge);
-}
-
-static void
go_location_cb (EggAction *action, char *location, EphyWindow *window)
{
EphyEmbed *embed;
@@ -243,7 +239,29 @@ toolbar_set_window (Toolbar *t, EphyWindow *window)
toolbar_setup_actions (t);
egg_menu_merge_insert_action_group (t->priv->ui_merge,
t->priv->action_group, 1);
- toolbar_setup_widgets (t);
+ g_object_set (t, "MenuMerge", t->priv->ui_merge, NULL);
+}
+
+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
@@ -254,6 +272,10 @@ 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
@@ -272,14 +294,14 @@ toolbar_finalize (GObject *object)
g_return_if_fail (p != NULL);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+
g_object_unref (t->priv->action_group);
egg_menu_merge_remove_action_group (merge, t->priv->action_group);
g_free (t->priv);
LOG ("Toolbar finalized")
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
}
Toolbar *