diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-12-27 18:32:42 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-12-27 18:32:42 +0800 |
commit | a9863f3bfeb5d8852304d4c92e284e0653dc8ee6 (patch) | |
tree | fe4f9832b6d522a5c758cf2386c9e435168e436c /lib/egg/egg-toolbar-editor.c | |
parent | bde4c29f92204eafbe4f953353730946486dc474 (diff) | |
download | gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.gz gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.bz2 gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.lz gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.xz gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.tar.zst gsoc2013-epiphany-a9863f3bfeb5d8852304d4c92e284e0653dc8ee6.zip |
Brought type macros in line with the rest of libegg; and use gobject
2003-12-27 Christian Persch <chpe@cvs.gnome.org>
* lib/egg/egg-editable-toolbar.c: (find_action),
(drag_data_delete_cb), (drag_data_get_cb),
(egg_editable_toolbar_set_model), (egg_editable_toolbar_set_merge),
(egg_editable_toolbar_class_init), (egg_editable_toolbar_init),
(egg_editable_toolbar_finalize), (egg_editable_toolbar_new):
* lib/egg/egg-editable-toolbar.h:
* lib/egg/egg-toolbar-editor.c: (find_action),
(egg_toolbar_editor_set_merge), (egg_toolbar_editor_set_model),
(egg_toolbar_editor_class_init), (egg_toolbar_editor_finalize),
(egg_toolbar_editor_new), (editor_drag_data_received_cb),
(editor_drag_data_delete_cb), (update_editor_sheet),
(setup_editor), (egg_toolbar_editor_init):
* lib/egg/egg-toolbar-editor.h:
* lib/egg/egg-toolbars-model.c: (egg_toolbars_model_to_xml),
(egg_toolbars_model_save), (egg_toolbars_model_add_separator),
(impl_add_item), (egg_toolbars_model_add_toolbar),
(egg_toolbars_model_load), (egg_toolbars_model_class_init),
(egg_toolbars_model_init), (egg_toolbars_model_finalize),
(egg_toolbars_model_new), (egg_toolbars_model_remove_toolbar),
(egg_toolbars_model_remove_item):
* lib/egg/egg-toolbars-model.h:
Brought type macros in line with the rest of libegg; and use
gobject instance private data.
* src/ephy-toolbars-model.c: (ephy_toolbars_model_get_type),
(update_toolbar_removeable_flag),
(ephy_toolbars_model_set_bookmarks), (toolbar_added),
(toolbar_removed), (ephy_toolbars_model_new),
(ephy_toolbars_model_has_bookmark):
* src/ephy-toolbars-model.h:
* src/toolbar.c: (toolbar_get_type), (init_normal_mode):
Fix crasher bug #129991.
Diffstat (limited to 'lib/egg/egg-toolbar-editor.c')
-rwxr-xr-x | lib/egg/egg-toolbar-editor.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index 297251481..a317ff458 100755 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -55,6 +55,8 @@ enum static GObjectClass *parent_class = NULL; +#define EGG_TOOLBAR_EDITOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EGG_TYPE_TOOLBAR_EDITOR, EggToolbarEditorPrivate)) + struct EggToolbarEditorPrivate { GtkUIManager *merge; @@ -133,7 +135,7 @@ find_action (EggToolbarEditor *t, l = gtk_ui_manager_get_action_groups (t->priv->merge); - g_return_val_if_fail (IS_EGG_TOOLBAR_EDITOR (t), NULL); + g_return_val_if_fail (EGG_IS_TOOLBAR_EDITOR (t), NULL); g_return_val_if_fail (name != NULL, NULL); for (; l != NULL; l = l->next) @@ -153,18 +155,18 @@ egg_toolbar_editor_set_merge (EggToolbarEditor *t, GtkUIManager *merge) { g_return_if_fail (GTK_IS_UI_MANAGER (merge)); - g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (t)); + g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (t)); - t->priv->merge = merge; + t->priv->merge = g_object_ref (merge); } static void egg_toolbar_editor_set_model (EggToolbarEditor *t, EggToolbarsModel *model) { - g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (t)); + g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (t)); - t->priv->model = model; + t->priv->model = g_object_ref (model); } static void @@ -228,19 +230,26 @@ egg_toolbar_editor_class_init (EggToolbarEditorClass *klass) g_param_spec_object ("ToolbarsModel", "ToolbarsModel", "Toolbars Model", - EGG_TOOLBARS_MODEL_TYPE, + EGG_TYPE_TOOLBARS_MODEL, G_PARAM_READWRITE)); + + g_type_class_add_private (object_class, sizeof (EggToolbarEditorPrivate)); } static void egg_toolbar_editor_finalize (GObject *object) { - EggToolbarEditor *t = EGG_TOOLBAR_EDITOR (object); + EggToolbarEditor *editor = EGG_TOOLBAR_EDITOR (object); - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (object)); + if (editor->priv->merge) + { + g_object_unref (editor->priv->merge); + } - g_free (t->priv); + if (editor->priv->model) + { + g_object_unref (editor->priv->model); + } G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -249,16 +258,10 @@ GtkWidget * egg_toolbar_editor_new (GtkUIManager *merge, EggToolbarsModel *model) { - EggToolbarEditor *t; - - t = EGG_TOOLBAR_EDITOR (g_object_new (EGG_TOOLBAR_EDITOR_TYPE, - "MenuMerge", merge, - "ToolbarsModel", model, - NULL)); - - g_return_val_if_fail (t->priv != NULL, NULL); - - return GTK_WIDGET (t); + return GTK_WIDGET (g_object_new (EGG_TYPE_TOOLBAR_EDITOR, + "MenuMerge", merge, + "ToolbarsModel", model, + NULL)); } static void @@ -287,7 +290,7 @@ editor_drag_data_received_cb (GtkWidget *widget, { GtkAction *action; - g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor)); + g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); g_return_if_fail (selection_data != NULL); action = find_action (editor, (const char *)selection_data->data); @@ -309,7 +312,7 @@ editor_drag_data_delete_cb (GtkWidget *widget, EggToolbarEditor *editor) { GtkAction *action; - g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor)); + g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); action = GTK_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action")); if (action) @@ -470,7 +473,7 @@ update_editor_sheet (EggToolbarEditor *editor) GtkWidget *item; GtkWidget *icon; - g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor)); + g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); viewport = GTK_BIN (editor->priv->scrolled_window)->child; if (viewport) @@ -543,7 +546,7 @@ setup_editor (EggToolbarEditor *editor) GtkWidget *image; GtkWidget *label; - g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor)); + g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); gtk_container_set_border_width (GTK_CONTAINER (editor), 12); scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -569,7 +572,7 @@ setup_editor (EggToolbarEditor *editor) static void egg_toolbar_editor_init (EggToolbarEditor *t) { - t->priv = g_new0 (EggToolbarEditorPrivate, 1); + t->priv = EGG_TOOLBAR_EDITOR_GET_PRIVATE (t); t->priv->merge = NULL; t->priv->default_actions_list = NULL; @@ -578,7 +581,7 @@ egg_toolbar_editor_init (EggToolbarEditor *t) setup_editor (t); } -static void +void egg_toolbar_editor_add_action (EggToolbarEditor *editor, const char *action_name) { |