aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-02-19 08:24:50 +0800
committerChristian Persch <chpe@src.gnome.org>2004-02-19 08:24:50 +0800
commitaa8e74d93a2c9fb43da9a5a8259cce7c75b1677f (patch)
tree58331d8098089f73dc8d8daa91158e8592a11a34
parent01ad74b01b77d67fb5591c2dc960bde63f90fdcd (diff)
downloadgsoc2013-epiphany-aa8e74d93a2c9fb43da9a5a8259cce7c75b1677f.tar
gsoc2013-epiphany-aa8e74d93a2c9fb43da9a5a8259cce7c75b1677f.tar.gz
gsoc2013-epiphany-aa8e74d93a2c9fb43da9a5a8259cce7c75b1677f.tar.bz2
gsoc2013-epiphany-aa8e74d93a2c9fb43da9a5a8259cce7c75b1677f.tar.lz
gsoc2013-epiphany-aa8e74d93a2c9fb43da9a5a8259cce7c75b1677f.tar.xz
gsoc2013-epiphany-aa8e74d93a2c9fb43da9a5a8259cce7c75b1677f.tar.zst
gsoc2013-epiphany-aa8e74d93a2c9fb43da9a5a8259cce7c75b1677f.zip
When removing a toolbar, make its items available again in the toolbar
2004-02-19 Christian Persch <chpe@cvs.gnome.org> * lib/egg/egg-toolbar-editor.c: (toolbar_removed_cb), (egg_toolbar_editor_set_model), (egg_toolbar_editor_class_init), (update_actions_list), (egg_toolbar_editor_load_actions): * lib/egg/egg-toolbar-editor.h: When removing a toolbar, make its items available again in the toolbar editor. Fixes bug #131182.
-rw-r--r--ChangeLog10
-rwxr-xr-xlib/egg/egg-toolbar-editor.c61
-rwxr-xr-xlib/egg/egg-toolbar-editor.h2
3 files changed, 54 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index e75827a82..99da702e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-02-19 Christian Persch <chpe@cvs.gnome.org>
+
+ * lib/egg/egg-toolbar-editor.c: (toolbar_removed_cb),
+ (egg_toolbar_editor_set_model), (egg_toolbar_editor_class_init),
+ (update_actions_list), (egg_toolbar_editor_load_actions):
+ * lib/egg/egg-toolbar-editor.h:
+
+ When removing a toolbar, make its items available again in the toolbar
+ editor. Fixes bug #131182.
+
2004-02-18 Alexander Winston <alexander.winston@comcast.net>
* help/C/epiphany.xml: Fixed typos in the bookmarks explanation.
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c
index a317ff458..7924e91ef 100755
--- a/lib/egg/egg-toolbar-editor.c
+++ b/lib/egg/egg-toolbar-editor.c
@@ -44,6 +44,7 @@ static int n_source_drag_types = G_N_ELEMENTS (source_drag_types);
static void egg_toolbar_editor_class_init (EggToolbarEditorClass *klass);
static void egg_toolbar_editor_init (EggToolbarEditor *t);
static void egg_toolbar_editor_finalize (GObject *object);
+static void update_actions_list (EggToolbarEditor *editor);
static void update_editor_sheet (EggToolbarEditor *editor);
enum
@@ -161,12 +162,24 @@ egg_toolbar_editor_set_merge (EggToolbarEditor *t,
}
static void
+toolbar_removed_cb (EggToolbarsModel *model,
+ int position,
+ EggToolbarEditor *editor)
+{
+ update_actions_list (editor);
+ update_editor_sheet (editor);
+}
+
+static void
egg_toolbar_editor_set_model (EggToolbarEditor *t,
EggToolbarsModel *model)
{
g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (t));
t->priv->model = g_object_ref (model);
+
+ g_signal_connect_object (model, "toolbar_removed",
+ G_CALLBACK (toolbar_removed_cb), t, 0);
}
static void
@@ -224,14 +237,16 @@ egg_toolbar_editor_class_init (EggToolbarEditorClass *klass)
"MenuMerge",
"Menu merge",
GTK_TYPE_UI_MANAGER,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_TOOLBARS_MODEL,
g_param_spec_object ("ToolbarsModel",
"ToolbarsModel",
"Toolbars Model",
EGG_TYPE_TOOLBARS_MODEL,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (object_class, sizeof (EggToolbarEditorPrivate));
}
@@ -581,7 +596,7 @@ egg_toolbar_editor_init (EggToolbarEditor *t)
setup_editor (t);
}
-void
+static void
egg_toolbar_editor_add_action (EggToolbarEditor *editor,
const char *action_name)
{
@@ -638,6 +653,31 @@ model_has_action (EggToolbarsModel *model, GtkAction *action)
return FALSE;
}
+static void
+update_actions_list (EggToolbarEditor *editor)
+{
+ GList *l;
+
+ if (editor->priv->actions_list)
+ g_list_free (editor->priv->actions_list);
+
+ /* Remove the already used items */
+ editor->priv->actions_list = NULL;
+
+ for (l = editor->priv->default_actions_list; l != NULL; l = l->next)
+ {
+ GtkAction *action = GTK_ACTION (l->data);
+
+ if (!model_has_action (editor->priv->model, action))
+ {
+ editor->priv->actions_list = g_list_prepend
+ (editor->priv->actions_list, action);
+ }
+ }
+
+ sort_list (editor);
+}
+
void
egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
const char *xml_file)
@@ -662,19 +702,6 @@ egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
xmlFreeDoc (doc);
- /* Remove the already used items */
- editor->priv->actions_list = g_list_copy (editor->priv->default_actions_list);
- for (l = editor->priv->default_actions_list; l != NULL; l = l->next)
- {
- GtkAction *action = GTK_ACTION (l->data);
-
- if (model_has_action (editor->priv->model, action))
- {
- editor->priv->actions_list = g_list_remove
- (editor->priv->actions_list, action);
- }
- }
- sort_list (editor);
-
+ update_actions_list (editor);
update_editor_sheet (editor);
}
diff --git a/lib/egg/egg-toolbar-editor.h b/lib/egg/egg-toolbar-editor.h
index 671dfa26e..5a96ad46f 100755
--- a/lib/egg/egg-toolbar-editor.h
+++ b/lib/egg/egg-toolbar-editor.h
@@ -56,8 +56,6 @@ struct EggToolbarEditorClass
GType egg_toolbar_editor_get_type (void);
GtkWidget *egg_toolbar_editor_new (GtkUIManager *merge,
EggToolbarsModel *model);
-void egg_toolbar_editor_add_action (EggToolbarEditor *editor,
- const char *action_name);
void egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
const char *xml_file);