[gimp/metadata-browser] app: remove most code from the public gimp_container_editor_construct()
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: remove most code from the public gimp_container_editor_construct()
- Date: Fri, 2 Dec 2011 02:15:48 +0000 (UTC)
commit 9b33a4726c8d094c9a03dc5927460bc8f6ec01e5
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 9 21:19:14 2011 +0200
app: remove most code from the public gimp_container_editor_construct()
and move it to GObject::constructed().
app/widgets/gimpcontainereditor.c | 115 ++++++++++++++++++-------------------
1 files changed, 57 insertions(+), 58 deletions(-)
---
diff --git a/app/widgets/gimpcontainereditor.c b/app/widgets/gimpcontainereditor.c
index 656d2b9..f427662 100644
--- a/app/widgets/gimpcontainereditor.c
+++ b/app/widgets/gimpcontainereditor.c
@@ -201,6 +201,63 @@ gimp_container_editor_constructed (GObject *object)
g_assert (GIMP_IS_CONTAINER (editor->priv->container));
g_assert (GIMP_IS_CONTEXT (editor->priv->context));
+
+ switch (editor->priv->view_type)
+ {
+ case GIMP_VIEW_TYPE_GRID:
+#if 0
+ editor->view =
+ GIMP_CONTAINER_VIEW (gimp_container_icon_view_new (editor->priv->container,
+ editor->priv->context,
+ editor->priv->view_size,
+ editor->priv->view_border_width));
+#else
+ editor->view =
+ GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (editor->priv->container,
+ editor->priv->context,
+ editor->priv->view_size,
+ editor->priv->view_border_width));
+#endif
+ break;
+
+ case GIMP_VIEW_TYPE_LIST:
+ editor->view =
+ GIMP_CONTAINER_VIEW (gimp_container_tree_view_new (editor->priv->container,
+ editor->priv->context,
+ editor->priv->view_size,
+ editor->priv->view_border_width));
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ if (GIMP_IS_LIST (editor->priv->container))
+ gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (editor->view),
+ ! GIMP_LIST (editor->priv->container)->sort_func);
+
+ gtk_box_pack_start (GTK_BOX (editor), GTK_WIDGET (editor->view),
+ TRUE, TRUE, 0);
+ gtk_widget_show (GTK_WIDGET (editor->view));
+
+ g_signal_connect_object (editor->view, "select-item",
+ G_CALLBACK (gimp_container_editor_select_item),
+ editor, 0);
+ g_signal_connect_object (editor->view, "activate-item",
+ G_CALLBACK (gimp_container_editor_activate_item),
+ editor, 0);
+ g_signal_connect_object (editor->view, "context-item",
+ G_CALLBACK (gimp_container_editor_context_item),
+ editor, 0);
+
+ {
+ GimpObject *object = gimp_context_get_by_type (editor->priv->context,
+ gimp_container_get_children_type (editor->priv->container));
+
+ gimp_container_editor_select_item (GTK_WIDGET (editor->view),
+ (GimpViewable *) object, NULL,
+ editor);
+ }
}
static void
@@ -305,69 +362,11 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
g_return_val_if_fail (menu_factory == NULL ||
GIMP_IS_MENU_FACTORY (menu_factory), FALSE);
- switch (editor->priv->view_type)
- {
- case GIMP_VIEW_TYPE_GRID:
-#if 0
- editor->view =
- GIMP_CONTAINER_VIEW (gimp_container_icon_view_new (editor->priv->container,
- editor->priv->context,
- editor->priv->view_size,
- editor->priv->view_border_width));
-#else
- editor->view =
- GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (editor->priv->container,
- editor->priv->context,
- editor->priv->view_size,
- editor->priv->view_border_width));
-#endif
- break;
-
- case GIMP_VIEW_TYPE_LIST:
- editor->view =
- GIMP_CONTAINER_VIEW (gimp_container_tree_view_new (editor->priv->container,
- editor->priv->context,
- editor->priv->view_size,
- editor->priv->view_border_width));
- break;
-
- default:
- g_warning ("%s: unknown GimpViewType passed", G_STRFUNC);
- return FALSE;
- }
-
- if (GIMP_IS_LIST (editor->priv->container))
- gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (editor->view),
- ! GIMP_LIST (editor->priv->container)->sort_func);
-
if (menu_factory && menu_identifier && ui_identifier)
gimp_editor_create_menu (GIMP_EDITOR (editor->view),
menu_factory, menu_identifier, ui_identifier,
editor);
- gtk_box_pack_start (GTK_BOX (editor), GTK_WIDGET (editor->view),
- TRUE, TRUE, 0);
- gtk_widget_show (GTK_WIDGET (editor->view));
-
- g_signal_connect_object (editor->view, "select-item",
- G_CALLBACK (gimp_container_editor_select_item),
- editor, 0);
- g_signal_connect_object (editor->view, "activate-item",
- G_CALLBACK (gimp_container_editor_activate_item),
- editor, 0);
- g_signal_connect_object (editor->view, "context-item",
- G_CALLBACK (gimp_container_editor_context_item),
- editor, 0);
-
- {
- GimpObject *object = gimp_context_get_by_type (editor->priv->context,
- gimp_container_get_children_type (editor->priv->container));
-
- gimp_container_editor_select_item (GTK_WIDGET (editor->view),
- (GimpViewable *) object, NULL,
- editor);
- }
-
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]