diff options
author | Peter Harvey <peter.a.harvey@gmail.com> | 2006-01-31 21:27:13 +0800 |
---|---|---|
committer | Peter Anthony Harvey <paharvey@src.gnome.org> | 2006-01-31 21:27:13 +0800 |
commit | dd621442b77f8a973c5e206ee7be5b5b7a495322 (patch) | |
tree | 1d8bad3c0fe5e3973d619607542cefd1b3acb5b0 /lib | |
parent | b7444805e19b872807b13af4e78c63bea10302cd (diff) | |
download | gsoc2013-epiphany-dd621442b77f8a973c5e206ee7be5b5b7a495322.tar gsoc2013-epiphany-dd621442b77f8a973c5e206ee7be5b5b7a495322.tar.gz gsoc2013-epiphany-dd621442b77f8a973c5e206ee7be5b5b7a495322.tar.bz2 gsoc2013-epiphany-dd621442b77f8a973c5e206ee7be5b5b7a495322.tar.lz gsoc2013-epiphany-dd621442b77f8a973c5e206ee7be5b5b7a495322.tar.xz gsoc2013-epiphany-dd621442b77f8a973c5e206ee7be5b5b7a495322.tar.zst gsoc2013-epiphany-dd621442b77f8a973c5e206ee7be5b5b7a495322.zip |
lib/egg/egg-toolbars-model.c lib/egg/egg-toolbars-model.h
2006-01-31 Peter Harvey <peter.a.harvey@gmail.com>
* lib/egg/egg-toolbars-model.c
* lib/egg/egg-toolbars-model.h
Added a useful function to remove all instances of
a named action from the toolbars.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/egg/egg-toolbars-model.c | 63 | ||||
-rwxr-xr-x | lib/egg/egg-toolbars-model.h | 2 |
2 files changed, 65 insertions, 0 deletions
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c index 257baf0d4..682ee59b3 100755 --- a/lib/egg/egg-toolbars-model.c +++ b/lib/egg/egg-toolbars-model.c @@ -761,6 +761,69 @@ egg_toolbars_model_move_item (EggToolbarsModel *model, new_toolbar_position, new_position); } +void +egg_toolbars_model_delete_item (EggToolbarsModel *model, + const char *name) +{ + EggToolbarsItem *idata; + EggToolbarsToolbar *tdata; + GNode *toolbar, *item, *next; + int tpos, ipos; + + g_return_if_fail (EGG_IS_TOOLBARS_MODEL (model)); + + toolbar = g_node_first_child (model->priv->toolbars); + tpos = 0; + + while (toolbar != NULL) + { + item = g_node_first_child (toolbar); + ipos = 0; + + if (item == NULL) + { + continue; + } + + while (item != NULL) + { + next = g_node_next_sibling (item); + idata = item->data; + if (strcmp (idata->name, name) == 0) + { + item_node_free (item, model); + g_signal_emit (G_OBJECT (model), + signals[ITEM_REMOVED], + 0, tpos, ipos); + } + else + { + ipos++; + } + + item = next; + } + + next = g_node_next_sibling (toolbar); + tdata = toolbar->data; + if (!(tdata->flags & EGG_TB_MODEL_NOT_REMOVABLE) && + g_node_first_child (toolbar) == NULL) + { + toolbar_node_free (toolbar, model); + + g_signal_emit (G_OBJECT (model), + signals[TOOLBAR_REMOVED], + 0, tpos); + } + else + { + tpos++; + } + + toolbar = next; + } +} + int egg_toolbars_model_n_items (EggToolbarsModel *model, int toolbar_position) diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h index 10b419a78..cfc19a75d 100755 --- a/lib/egg/egg-toolbars-model.h +++ b/lib/egg/egg-toolbars-model.h @@ -160,6 +160,8 @@ void egg_toolbars_model_move_item (EggToolbarsModel *model, int position, int new_toolbar_position, int new_position); +void egg_toolbars_model_delete_item (EggToolbarsModel *model, + const char *name); /* Functions for accessing the names of items. */ int egg_toolbars_model_n_items (EggToolbarsModel *model, |