aboutsummaryrefslogtreecommitdiffstats
path: root/src/toolbar.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-09 03:44:22 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-09 03:44:22 +0800
commitbf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d (patch)
tree5183e93fad2ca5634034d844c858c40439c9cd69 /src/toolbar.c
parent20dd70b526a557dccd623f9a1c0b05720317e9f7 (diff)
downloadgsoc2013-epiphany-bf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d.tar
gsoc2013-epiphany-bf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d.tar.gz
gsoc2013-epiphany-bf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d.tar.bz2
gsoc2013-epiphany-bf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d.tar.lz
gsoc2013-epiphany-bf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d.tar.xz
gsoc2013-epiphany-bf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d.tar.zst
gsoc2013-epiphany-bf5ae80d6a2281da9a661cc59fa0de7b0b4cc13d.zip
Update.
2003-04-08 Marco Pesenti Gritti <marco@it.gnome.org> * lib/egg/egg-toolbars-group.c: * lib/egg/egg-toolbars-group.h: Update. * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_class_init), (bookmarks_removed_cb), (topics_removed_cb), (ephy_bookmarks_init): * src/bookmarks/ephy-bookmarks.h: * src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_response_cb): * src/popup-commands.c: (popup_cmd_bookmark_link): * src/toolbar.c: (toolbar_get_action_name), (toolbar_get_action), (topic_remove_cb), (bookmark_remove_cb), (toolbar_init): * src/window-commands.c: (window_cmd_file_bookmark_page): Update toolbars when bookmarks and topics are removed. Use dialog_run for new_bookmark dialog. (Dave I hope this doesnt break something, but it's necessary to url dnd to toolbars to work correctly)
Diffstat (limited to 'src/toolbar.c')
-rwxr-xr-xsrc/toolbar.c61
1 files changed, 55 insertions, 6 deletions
diff --git a/src/toolbar.c b/src/toolbar.c
index ff28353a0..18fc59f61 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -62,6 +62,8 @@ enum
PROP_EPHY_WINDOW
};
+static EggToolbarsGroup *toolbars_group = NULL;
+
static GObjectClass *parent_class = NULL;
struct ToolbarPrivate
@@ -197,6 +199,8 @@ toolbar_get_action_name (EggEditableToolbar *etoolbar,
}
}
+ LOG ("Action name is %s", res)
+
return res;
}
@@ -219,6 +223,7 @@ toolbar_get_action (EggEditableToolbar *etoolbar,
}
else if (g_str_has_prefix (name, "GoBookmarkId"))
{
+ LOG ("Create action %s", name)
if (!ephy_str_to_int (name + strlen ("GoBookmarkId"), &id))
{
return NULL;
@@ -228,6 +233,7 @@ toolbar_get_action (EggEditableToolbar *etoolbar,
}
else if (g_str_has_prefix (name, "GoTopicId"))
{
+ LOG ("Create action %s", name)
if (!ephy_str_to_int (name + strlen ("GoTopicId"), &id))
{
return NULL;
@@ -395,10 +401,46 @@ toolbar_set_window (Toolbar *t, EphyWindow *window)
}
static void
-toolbar_init (Toolbar *t)
+topic_remove_cb (EphyBookmarks *eb,
+ long id,
+ Toolbar *t)
+{
+ EggAction *action;
+ char *name;
+
+ name = g_strdup_printf ("GoTopicId%ld", id);
+ action = egg_action_group_get_action (t->priv->action_group, name);
+ if (action)
+ {
+ egg_toolbars_group_remove_action (toolbars_group, action->name);
+ egg_action_group_remove_action (t->priv->action_group, action);
+ }
+
+ g_free (name);
+}
+
+static void
+bookmark_remove_cb (EphyBookmarks *eb,
+ long id,
+ Toolbar *t)
{
- static EggToolbarsGroup *group = NULL;
+ EggAction *action;
+ char *name;
+
+ name = g_strdup_printf ("GoBookmarkId%ld", id);
+ action = egg_action_group_get_action (t->priv->action_group, name);
+ if (action)
+ {
+ egg_toolbars_group_remove_action (toolbars_group, action->name);
+ egg_action_group_remove_action (t->priv->action_group, action);
+ }
+ g_free (name);
+}
+
+static void
+toolbar_init (Toolbar *t)
+{
t->priv = g_new0 (ToolbarPrivate, 1);
t->priv->window = NULL;
@@ -410,18 +452,25 @@ toolbar_init (Toolbar *t)
egg_editable_toolbar_add_drag_type (EGG_EDITABLE_TOOLBAR (t),
EPHY_DND_URL_TYPE);
- if (group == NULL)
+ if (toolbars_group == NULL)
{
char *user;
+ EphyBookmarks *bookmarks;
user = g_build_filename (ephy_dot_dir (), "toolbar.xml", NULL);
- group = egg_toolbars_group_new ();
+ toolbars_group = egg_toolbars_group_new ();
egg_toolbars_group_set_source
- (group, ephy_file ("epiphany-toolbar.xml"), user);
+ (toolbars_group, ephy_file ("epiphany-toolbar.xml"), user);
g_free (user);
+
+ bookmarks = ephy_shell_get_bookmarks (ephy_shell);
+ g_signal_connect (bookmarks, "bookmark_remove",
+ G_CALLBACK (bookmark_remove_cb), t);
+ g_signal_connect (bookmarks, "topic_remove",
+ G_CALLBACK (topic_remove_cb), t);
}
- g_object_set (t, "ToolbarsGroup", group, NULL);
+ g_object_set (t, "ToolbarsGroup", toolbars_group, NULL);
}
static void