aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-08-09 00:21:19 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-08-09 00:21:19 +0800
commitddf8fccbe9c2afd3c432c06bf2240c398732c279 (patch)
tree2ae582aa50b0a99a7345e79ce56a5002711bab41
parentfdba09646384da9c8526371507f75be15c9f2c17 (diff)
downloadgsoc2013-epiphany-ddf8fccbe9c2afd3c432c06bf2240c398732c279.tar
gsoc2013-epiphany-ddf8fccbe9c2afd3c432c06bf2240c398732c279.tar.gz
gsoc2013-epiphany-ddf8fccbe9c2afd3c432c06bf2240c398732c279.tar.bz2
gsoc2013-epiphany-ddf8fccbe9c2afd3c432c06bf2240c398732c279.tar.lz
gsoc2013-epiphany-ddf8fccbe9c2afd3c432c06bf2240c398732c279.tar.xz
gsoc2013-epiphany-ddf8fccbe9c2afd3c432c06bf2240c398732c279.tar.zst
gsoc2013-epiphany-ddf8fccbe9c2afd3c432c06bf2240c398732c279.zip
Update
2003-08-08 Marco Pesenti Gritti <marco@it.gnome.org> * lib/egg/egg-toolbars-model.c: * lib/egg/egg-toolbars-model.h: Update * src/ephy-toolbars-model.c: (get_toolbar_and_item_pos), (impl_add_item), (ephy_toolbars_model_class_init), (get_toolbar_pos): Do not add duped bookmarks to toolbars
-rw-r--r--ChangeLog13
-rwxr-xr-xlib/egg/egg-toolbars-model.c26
-rwxr-xr-xlib/egg/egg-toolbars-model.h7
-rwxr-xr-xsrc/ephy-toolbars-model.c103
4 files changed, 103 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 5bad37665..f809b7d39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2003-08-08 Marco Pesenti Gritti <marco@it.gnome.org>
+
+ * lib/egg/egg-toolbars-model.c:
+ * lib/egg/egg-toolbars-model.h:
+
+ Update
+
+ * src/ephy-toolbars-model.c: (get_toolbar_and_item_pos),
+ (impl_add_item), (ephy_toolbars_model_class_init),
+ (get_toolbar_pos):
+
+ Do not add duped bookmarks to toolbars
+
2003-08-08 Xan Lopez <xan@masilla.org>
* embed/downloader-view.c: (downloader_view_update_details),
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c
index 2166ede5f..436f018d7 100755
--- a/lib/egg/egg-toolbars-model.c
+++ b/lib/egg/egg-toolbars-model.c
@@ -313,12 +313,12 @@ egg_toolbars_model_add_separator (EggToolbarsModel *t,
toolbar_position, real_position);
}
-void
-egg_toolbars_model_add_item (EggToolbarsModel *t,
- int toolbar_position,
- int position,
- const char *id,
- const char *type)
+gboolean
+impl_add_item (EggToolbarsModel *t,
+ int toolbar_position,
+ int position,
+ const char *id,
+ const char *type)
{
GNode *parent_node;
GNode *node;
@@ -338,6 +338,8 @@ egg_toolbars_model_add_item (EggToolbarsModel *t,
g_signal_emit (G_OBJECT (t), egg_toolbars_model_signals[ITEM_ADDED], 0,
toolbar_position, real_position);
+
+ return TRUE;
}
static void
@@ -485,6 +487,7 @@ egg_toolbars_model_class_init (EggToolbarsModelClass *klass)
object_class->finalize = egg_toolbars_model_finalize;
+ klass->add_item = impl_add_item;
klass->get_item_id = impl_get_item_id;
klass->get_item_name = impl_get_item_name;
klass->get_item_type = impl_get_item_type;
@@ -664,6 +667,17 @@ egg_toolbars_model_toolbar_nth (EggToolbarsModel *t,
return tdata->name;
}
+gboolean
+egg_toolbars_model_add_item (EggToolbarsModel *t,
+ int toolbar_position,
+ int position,
+ const char *id,
+ const char *type)
+{
+ EggToolbarsModelClass *klass = EGG_TOOLBARS_MODEL_GET_CLASS (t);
+ return klass->add_item (t, toolbar_position, position, id, type);
+}
+
char *
egg_toolbars_model_get_item_id (EggToolbarsModel *t,
const char *type,
diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h
index 5de72fbcb..baf4b6ac6 100755
--- a/lib/egg/egg-toolbars-model.h
+++ b/lib/egg/egg-toolbars-model.h
@@ -70,6 +70,11 @@ struct EggToolbarsModelClass
int position);
/* Virtual Table */
+ gboolean (* add_item) (EggToolbarsModel *t,
+ int toolbar_position,
+ int position,
+ const char *id,
+ const char *type);
char * (* get_item_type) (EggToolbarsModel *t,
GdkAtom dnd_type);
char * (* get_item_id) (EggToolbarsModel *t,
@@ -106,7 +111,7 @@ char *egg_toolbars_model_get_item_id (EggToolbarsModel *t,
char *egg_toolbars_model_get_item_name (EggToolbarsModel *t,
const char *type,
const char *id);
-void egg_toolbars_model_add_item (EggToolbarsModel *t,
+gboolean egg_toolbars_model_add_item (EggToolbarsModel *t,
int toolbar_position,
int position,
const char *id,
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index 6bfce6264..3933be965 100755
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -228,6 +228,69 @@ impl_get_item_type (EggToolbarsModel *t,
return EGG_TOOLBARS_MODEL_CLASS (parent_class)->get_item_type (t, type);
}
+static gboolean
+get_toolbar_and_item_pos (EphyToolbarsModel *model,
+ const char *action_name,
+ int *toolbar,
+ int *position)
+{
+ int n_toolbars, n_items;
+ int t,i;
+
+ n_toolbars = egg_toolbars_model_n_toolbars (EGG_TOOLBARS_MODEL (model));
+
+ for (t = 0; t < n_toolbars; t++)
+ {
+ n_items = egg_toolbars_model_n_items
+ (EGG_TOOLBARS_MODEL (model), t);
+
+ for (i = 0; i < n_items; i++)
+ {
+ const char *i_name;
+ gboolean is_separator;
+
+ i_name = egg_toolbars_model_item_nth
+ (EGG_TOOLBARS_MODEL (model), t, i,
+ &is_separator);
+ g_return_val_if_fail (i_name != NULL, FALSE);
+
+ if (strcmp (i_name, action_name) == 0)
+ {
+ if (toolbar) *toolbar = t;
+ if (position) *position = i;
+
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+static gboolean
+impl_add_item (EggToolbarsModel *t,
+ int toolbar_position,
+ int position,
+ const char *id,
+ const char *type)
+{
+ EphyToolbarsModel *model = EPHY_TOOLBARS_MODEL (t);
+ gboolean is_bookmark;
+
+ is_bookmark = strcmp (type, EPHY_DND_TOPIC_TYPE) == 0 ||
+ strcmp (type, EPHY_DND_URL_TYPE) == 0;
+
+ if (!is_bookmark || !get_toolbar_and_item_pos (model, id, NULL, NULL))
+ {
+ return EGG_TOOLBARS_MODEL_CLASS (parent_class)->add_item
+ (t, toolbar_position, position, id, type);
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
static void
connect_item (EphyToolbarsModel *model,
const char *name)
@@ -322,6 +385,7 @@ ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass)
object_class->set_property = ephy_toolbars_model_set_property;
object_class->get_property = ephy_toolbars_model_get_property;
+ etm_class->add_item = impl_add_item;
etm_class->get_item_id = impl_get_item_id;
etm_class->get_item_name = impl_get_item_name;
etm_class->get_item_type = impl_get_item_type;
@@ -454,45 +518,6 @@ get_toolbar_pos (EphyToolbarsModel *model,
return -1;
}
-static gboolean
-get_toolbar_and_item_pos (EphyToolbarsModel *model,
- const char *action_name,
- int *toolbar,
- int *position)
-{
- int n_toolbars, n_items;
- int t,i;
-
- n_toolbars = egg_toolbars_model_n_toolbars (EGG_TOOLBARS_MODEL (model));
-
- for (t = 0; t < n_toolbars; t++)
- {
- n_items = egg_toolbars_model_n_items
- (EGG_TOOLBARS_MODEL (model), t);
-
- for (i = 0; i < n_items; i++)
- {
- const char *i_name;
- gboolean is_separator;
-
- i_name = egg_toolbars_model_item_nth
- (EGG_TOOLBARS_MODEL (model), t, i,
- &is_separator);
- g_return_val_if_fail (i_name != NULL, FALSE);
-
- if (strcmp (i_name, action_name) == 0)
- {
- *toolbar = t;
- *position = i;
-
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
void
ephy_toolbars_model_remove_bookmark (EphyToolbarsModel *model,
long id)