aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-03-02 03:37:39 +0800
committerChristian Persch <chpe@src.gnome.org>2004-03-02 03:37:39 +0800
commit048097ea7ab957055ba125557bac9e96d7754129 (patch)
tree9f4a5801b50fc63b4ce516ddae0ce674487e876d
parent450175b2b569994aeb7f1efa2a70a23b40f01d4a (diff)
downloadgsoc2013-epiphany-048097ea7ab957055ba125557bac9e96d7754129.tar
gsoc2013-epiphany-048097ea7ab957055ba125557bac9e96d7754129.tar.gz
gsoc2013-epiphany-048097ea7ab957055ba125557bac9e96d7754129.tar.bz2
gsoc2013-epiphany-048097ea7ab957055ba125557bac9e96d7754129.tar.lz
gsoc2013-epiphany-048097ea7ab957055ba125557bac9e96d7754129.tar.xz
gsoc2013-epiphany-048097ea7ab957055ba125557bac9e96d7754129.tar.zst
gsoc2013-epiphany-048097ea7ab957055ba125557bac9e96d7754129.zip
Ensure we always have a BookmarksBar toolbar in the model. Fixes bug
2004-03-01 Christian Persch <chpe@cvs.gnome.org> * src/ephy-toolbars-model.c: (get_toolbar_pos), (ephy_toolbars_model_set_bookmarks): Ensure we always have a BookmarksBar toolbar in the model. Fixes bug #135701.
-rw-r--r--ChangeLog8
-rwxr-xr-xsrc/ephy-toolbars-model.c55
2 files changed, 39 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 7544e2681..c7b32278f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-03-01 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-toolbars-model.c: (get_toolbar_pos),
+ (ephy_toolbars_model_set_bookmarks):
+
+ Ensure we always have a BookmarksBar toolbar in the model.
+ Fixes bug #135701.
+
2004-03-01 Marco Pesenti Gritti <marco@gnome.org>
* lib/egg/eggstatusicon.c: (egg_status_icon_init),
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index 132172f91..0de9d97f5 100755
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -281,6 +281,30 @@ get_toolbar_and_item_pos (EphyToolbarsModel *model,
return FALSE;
}
+static int
+get_toolbar_pos (EphyToolbarsModel *model,
+ const char *name)
+{
+ int i, n_toolbars;
+
+ n_toolbars = egg_toolbars_model_n_toolbars
+ (EGG_TOOLBARS_MODEL (model));
+
+ for (i = 0; i < n_toolbars; i++)
+ {
+ const char *t_name;
+
+ t_name = egg_toolbars_model_toolbar_nth
+ (EGG_TOOLBARS_MODEL (model), i);
+ if (strcmp (name, t_name) == 0)
+ {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
static gboolean
impl_add_item (EggToolbarsModel *t,
int toolbar_position,
@@ -375,6 +399,13 @@ ephy_toolbars_model_set_bookmarks (EphyToolbarsModel *model, EphyBookmarks *book
egg_toolbars_model_load (egg_model, default_xml);
}
+ /* ensure that we have a BookmarksBar */
+ if (get_toolbar_pos (model, "BookmarksBar") == -1)
+ {
+ egg_toolbars_model_add_toolbar
+ (EGG_TOOLBARS_MODEL (model), -1, "BookmarksBar");
+ }
+
model->priv->loading = FALSE;
}
@@ -531,30 +562,6 @@ ephy_toolbars_model_new (EphyBookmarks *bookmarks)
NULL));
}
-static int
-get_toolbar_pos (EphyToolbarsModel *model,
- const char *name)
-{
- int i, n_toolbars;
-
- n_toolbars = egg_toolbars_model_n_toolbars
- (EGG_TOOLBARS_MODEL (model));
-
- for (i = 0; i < n_toolbars; i++)
- {
- const char *t_name;
-
- t_name = egg_toolbars_model_toolbar_nth
- (EGG_TOOLBARS_MODEL (model), i);
- if (strcmp (name, t_name) == 0)
- {
- return i;
- }
- }
-
- return -1;
-}
-
void
ephy_toolbars_model_remove_bookmark (EphyToolbarsModel *model,
long id)