[gimp/metadata-browser] app: add view-size and view-border-width props to GimpContainerEditor
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: add view-size and view-border-width props to GimpContainerEditor
- Date: Fri, 2 Dec 2011 02:15:43 +0000 (UTC)
commit 672e34b55527ffa2bbfe296fbdee2f7e8b1e3f1a
Author: Michael Natterer <mitch gimp org>
Date: Sun Oct 9 21:04:49 2011 +0200
app: add view-size and view-border-width props to GimpContainerEditor
and remove them from the various public construct() functions.
app/widgets/gimpbrushfactoryview.c | 9 +++--
app/widgets/gimpbufferview.c | 17 +++++++--
app/widgets/gimpcontainereditor.c | 58 +++++++++++++++++++++++-------
app/widgets/gimpcontainereditor.h | 2 -
app/widgets/gimpcontainerpopup.c | 10 +++---
app/widgets/gimpdatafactoryview.c | 23 +++++-------
app/widgets/gimpdatafactoryview.h | 2 -
app/widgets/gimpdocumentview.c | 15 ++++++--
app/widgets/gimpdynamicsfactoryview.c | 9 +++--
app/widgets/gimpfontview.c | 15 ++++++--
app/widgets/gimpimageview.c | 15 ++++++--
app/widgets/gimppatternfactoryview.c | 9 +++--
app/widgets/gimptemplateview.c | 14 +++++--
app/widgets/gimptoolpresetfactoryview.c | 9 +++--
14 files changed, 135 insertions(+), 72 deletions(-)
---
diff --git a/app/widgets/gimpbrushfactoryview.c b/app/widgets/gimpbrushfactoryview.c
index 352ee19..9d2615a 100644
--- a/app/widgets/gimpbrushfactoryview.c
+++ b/app/widgets/gimpbrushfactoryview.c
@@ -132,15 +132,16 @@ gimp_brush_factory_view_new (GimpViewType view_type,
NULL);
factory_view = g_object_new (GIMP_TYPE_BRUSH_FACTORY_VIEW,
- "view-type", view_type,
- "data-factory", factory,
- "context", context,
+ "view-type", view_type,
+ "data-factory", factory,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
factory_view->change_brush_spacing = change_brush_spacing;
if (! gimp_data_factory_view_construct (GIMP_DATA_FACTORY_VIEW (factory_view),
- view_size, view_border_width,
menu_factory, "<Brushes>",
"/brushes-popup",
"brushes"))
diff --git a/app/widgets/gimpbufferview.c b/app/widgets/gimpbufferview.c
index 029094f..0cd0bf5 100644
--- a/app/widgets/gimpbufferview.c
+++ b/app/widgets/gimpbufferview.c
@@ -127,14 +127,23 @@ gimp_buffer_view_new (GimpViewType view_type,
GtkWidget *frame;
GtkWidget *hbox;
+ g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
+ g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (view_size > 0 &&
+ view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, FALSE);
+ g_return_val_if_fail (view_border_width >= 0 &&
+ view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
+ FALSE);
+
buffer_view = g_object_new (GIMP_TYPE_BUFFER_VIEW,
- "view-type", view_type,
- "container", container,
- "context", context,
+ "view-type", view_type,
+ "container", container,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (buffer_view),
- view_size, view_border_width,
menu_factory, "<Buffers>",
"/buffers-popup"))
{
diff --git a/app/widgets/gimpcontainereditor.c b/app/widgets/gimpcontainereditor.c
index b17e374..656d2b9 100644
--- a/app/widgets/gimpcontainereditor.c
+++ b/app/widgets/gimpcontainereditor.c
@@ -46,7 +46,9 @@ enum
PROP_0,
PROP_VIEW_TYPE,
PROP_CONTAINER,
- PROP_CONTEXT
+ PROP_CONTEXT,
+ PROP_VIEW_SIZE,
+ PROP_VIEW_BORDER_WIDTH
};
@@ -55,6 +57,8 @@ struct _GimpContainerEditorPrivate
GimpViewType view_type;
GimpContainer *container;
GimpContext *context;
+ gint view_size;
+ gint view_border_width;
};
@@ -145,6 +149,23 @@ gimp_container_editor_class_init (GimpContainerEditorClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class, PROP_VIEW_SIZE,
+ g_param_spec_int ("view-size",
+ NULL, NULL,
+ 1, GIMP_VIEWABLE_MAX_PREVIEW_SIZE,
+ GIMP_VIEW_SIZE_MEDIUM,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (object_class, PROP_VIEW_BORDER_WIDTH,
+ g_param_spec_int ("view-border-width",
+ NULL, NULL,
+ 0,
+ GIMP_VIEW_MAX_BORDER_WIDTH,
+ 1,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
g_type_class_add_private (klass, sizeof (GimpContainerEditorPrivate));
}
@@ -224,6 +245,14 @@ gimp_container_editor_set_property (GObject *object,
editor->priv->context = g_value_dup_object (value);
break;
+ case PROP_VIEW_SIZE:
+ editor->priv->view_size = g_value_get_int (value);
+ break;
+
+ case PROP_VIEW_BORDER_WIDTH:
+ editor->priv->view_border_width = g_value_get_int (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -252,6 +281,14 @@ gimp_container_editor_get_property (GObject *object,
g_value_set_object (value, editor->priv->context);
break;
+ case PROP_VIEW_SIZE:
+ g_value_set_int (value, editor->priv->view_size);
+ break;
+
+ case PROP_VIEW_BORDER_WIDTH:
+ g_value_set_int (value, editor->priv->view_border_width);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -260,18 +297,11 @@ gimp_container_editor_get_property (GObject *object,
gboolean
gimp_container_editor_construct (GimpContainerEditor *editor,
- gint view_size,
- gint view_border_width,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *ui_identifier)
{
g_return_val_if_fail (GIMP_IS_CONTAINER_EDITOR (editor), FALSE);
- g_return_val_if_fail (view_size > 0 &&
- view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, FALSE);
- g_return_val_if_fail (view_border_width >= 0 &&
- view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
- FALSE);
g_return_val_if_fail (menu_factory == NULL ||
GIMP_IS_MENU_FACTORY (menu_factory), FALSE);
@@ -282,14 +312,14 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
editor->view =
GIMP_CONTAINER_VIEW (gimp_container_icon_view_new (editor->priv->container,
editor->priv->context,
- view_size,
- view_border_width));
+ 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,
- view_size,
- view_border_width));
+ editor->priv->view_size,
+ editor->priv->view_border_width));
#endif
break;
@@ -297,8 +327,8 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
editor->view =
GIMP_CONTAINER_VIEW (gimp_container_tree_view_new (editor->priv->container,
editor->priv->context,
- view_size,
- view_border_width));
+ editor->priv->view_size,
+ editor->priv->view_border_width));
break;
default:
diff --git a/app/widgets/gimpcontainereditor.h b/app/widgets/gimpcontainereditor.h
index 555bf1e..fa2d195 100644
--- a/app/widgets/gimpcontainereditor.h
+++ b/app/widgets/gimpcontainereditor.h
@@ -65,8 +65,6 @@ void gimp_container_editor_set_selection_mode (GimpContainerEditor *
/* protected */
gboolean gimp_container_editor_construct (GimpContainerEditor *editor,
- gint view_size,
- gint view_border_width,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *ui_path);
diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c
index bb08084..e9c34af 100644
--- a/app/widgets/gimpcontainerpopup.c
+++ b/app/widgets/gimpcontainerpopup.c
@@ -550,14 +550,14 @@ gimp_container_popup_create_view (GimpContainerPopup *popup)
GtkWidget *button;
popup->editor = g_object_new (GIMP_TYPE_CONTAINER_EDITOR,
- "view-type", popup->view_type,
- "container", popup->container,
- "context", popup->context,
+ "view-type", popup->view_type,
+ "container", popup->container,
+ "context", popup->context,
+ "view-size", popup->view_size,
+ "view-border-width", popup->view_border_width,
NULL);
gimp_container_editor_construct (popup->editor,
- popup->view_size,
- popup->view_border_width,
NULL, NULL, NULL);
gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view),
diff --git a/app/widgets/gimpdatafactoryview.c b/app/widgets/gimpdatafactoryview.c
index 068348f..2b9af51 100644
--- a/app/widgets/gimpdatafactoryview.c
+++ b/app/widgets/gimpdatafactoryview.c
@@ -253,16 +253,21 @@ gimp_data_factory_view_new (GimpViewType view_type,
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (view_size > 0 &&
+ view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
+ g_return_val_if_fail (view_border_width >= 0 &&
+ view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
+ NULL);
factory_view = g_object_new (GIMP_TYPE_DATA_FACTORY_VIEW,
- "view-type", view_type,
- "data-factory", factory,
- "context", context,
+ "view-type", view_type,
+ "data-factory", factory,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_data_factory_view_construct (factory_view,
- view_size,
- view_border_width,
menu_factory,
menu_identifier,
ui_identifier,
@@ -327,8 +332,6 @@ gimp_data_factory_view_have (GimpDataFactoryView *factory_view,
gboolean
gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
- gint view_size,
- gint view_border_width,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *ui_identifier,
@@ -338,14 +341,8 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
gchar *str;
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), FALSE);
- g_return_val_if_fail (view_size > 0 &&
- view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, FALSE);
- g_return_val_if_fail (view_border_width >= 0 &&
- view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
- FALSE);
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (factory_view),
- view_size, view_border_width,
menu_factory, menu_identifier,
ui_identifier))
{
diff --git a/app/widgets/gimpdatafactoryview.h b/app/widgets/gimpdatafactoryview.h
index c870d19..959bac2 100644
--- a/app/widgets/gimpdatafactoryview.h
+++ b/app/widgets/gimpdatafactoryview.h
@@ -73,8 +73,6 @@ gboolean gimp_data_factory_view_have (GimpDataFactoryVi
/* protected */
gboolean gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
- gint view_size,
- gint view_border_width,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *ui_identifier,
diff --git a/app/widgets/gimpdocumentview.c b/app/widgets/gimpdocumentview.c
index 3189b61..d3091f4 100644
--- a/app/widgets/gimpdocumentview.c
+++ b/app/widgets/gimpdocumentview.c
@@ -36,6 +36,7 @@
#include "gimpdnd.h"
#include "gimpeditor.h"
#include "gimpuimanager.h"
+#include "gimpviewrenderer.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
@@ -82,15 +83,21 @@ gimp_document_view_new (GimpViewType view_type,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (view_size > 0 &&
+ view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, FALSE);
+ g_return_val_if_fail (view_border_width >= 0 &&
+ view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
+ FALSE);
document_view = g_object_new (GIMP_TYPE_DOCUMENT_VIEW,
- "view-type", view_type,
- "container", container,
- "context", context,
+ "view-type", view_type,
+ "container", container,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (document_view),
- view_size, view_border_width,
menu_factory, "<Documents>",
"/documents-popup"))
{
diff --git a/app/widgets/gimpdynamicsfactoryview.c b/app/widgets/gimpdynamicsfactoryview.c
index 3050fa3..13082a8 100644
--- a/app/widgets/gimpdynamicsfactoryview.c
+++ b/app/widgets/gimpdynamicsfactoryview.c
@@ -66,13 +66,14 @@ gimp_dynamics_factory_view_new (GimpViewType view_type,
NULL);
factory_view = g_object_new (GIMP_TYPE_DYNAMICS_FACTORY_VIEW,
- "view-type", view_type,
- "data-factory", factory,
- "context", context,
+ "view-type", view_type,
+ "data-factory", factory,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_data_factory_view_construct (GIMP_DATA_FACTORY_VIEW (factory_view),
- view_size, view_border_width,
menu_factory, "<Dynamics>",
"/dynamics-popup",
"dynamics"))
diff --git a/app/widgets/gimpfontview.c b/app/widgets/gimpfontview.c
index 1a217bc..6099989 100644
--- a/app/widgets/gimpfontview.c
+++ b/app/widgets/gimpfontview.c
@@ -34,6 +34,7 @@
#include "gimpfontview.h"
#include "gimphelp-ids.h"
#include "gimpuimanager.h"
+#include "gimpviewrenderer.h"
#include "gimp-intl.h"
@@ -74,15 +75,21 @@ gimp_font_view_new (GimpViewType view_type,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (view_size > 0 &&
+ view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
+ g_return_val_if_fail (view_border_width >= 0 &&
+ view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
+ NULL);
font_view = g_object_new (GIMP_TYPE_FONT_VIEW,
- "view-type", view_type,
- "container", container,
- "context", context,
+ "view-type", view_type,
+ "container", container,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (font_view),
- view_size, view_border_width,
menu_factory, "<Fonts>",
"/fonts-popup"))
{
diff --git a/app/widgets/gimpimageview.c b/app/widgets/gimpimageview.c
index b05cffe..5e65f1a 100644
--- a/app/widgets/gimpimageview.c
+++ b/app/widgets/gimpimageview.c
@@ -36,6 +36,7 @@
#include "gimpimageview.h"
#include "gimpdnd.h"
#include "gimpuimanager.h"
+#include "gimpviewrenderer.h"
#include "gimp-intl.h"
@@ -78,15 +79,21 @@ gimp_image_view_new (GimpViewType view_type,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (view_size > 0 &&
+ view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
+ g_return_val_if_fail (view_border_width >= 0 &&
+ view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
+ NULL);
image_view = g_object_new (GIMP_TYPE_IMAGE_VIEW,
- "view-type", view_type,
- "container", container,
- "context", context,
+ "view-type", view_type,
+ "container", container,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (image_view),
- view_size, view_border_width,
menu_factory, "<Images>",
"/images-popup"))
{
diff --git a/app/widgets/gimppatternfactoryview.c b/app/widgets/gimppatternfactoryview.c
index 216e788..a1bd978 100644
--- a/app/widgets/gimppatternfactoryview.c
+++ b/app/widgets/gimppatternfactoryview.c
@@ -69,13 +69,14 @@ gimp_pattern_factory_view_new (GimpViewType view_type,
NULL);
factory_view = g_object_new (GIMP_TYPE_PATTERN_FACTORY_VIEW,
- "view-type", view_type,
- "data-factory", factory,
- "context", context,
+ "view-type", view_type,
+ "data-factory", factory,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_data_factory_view_construct (GIMP_DATA_FACTORY_VIEW (factory_view),
- view_size, view_border_width,
menu_factory, "<Patterns>",
"/patterns-popup",
"patterns"))
diff --git a/app/widgets/gimptemplateview.c b/app/widgets/gimptemplateview.c
index 79ad705..ddc17c6 100644
--- a/app/widgets/gimptemplateview.c
+++ b/app/widgets/gimptemplateview.c
@@ -93,15 +93,21 @@ gimp_template_view_new (GimpViewType view_type,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (view_size > 0 &&
+ view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
+ g_return_val_if_fail (view_border_width >= 0 &&
+ view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
+ NULL);
template_view = g_object_new (GIMP_TYPE_TEMPLATE_VIEW,
- "view-type", view_type,
- "container", container,
- "context", context,
+ "view-type", view_type,
+ "container", container,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (template_view),
- view_size, view_border_width,
menu_factory, "<Templates>",
"/templates-popup"))
{
diff --git a/app/widgets/gimptoolpresetfactoryview.c b/app/widgets/gimptoolpresetfactoryview.c
index dbdf112..99ad9f1 100644
--- a/app/widgets/gimptoolpresetfactoryview.c
+++ b/app/widgets/gimptoolpresetfactoryview.c
@@ -68,13 +68,14 @@ gimp_tool_preset_factory_view_new (GimpViewType view_type,
NULL);
factory_view = g_object_new (GIMP_TYPE_TOOL_PRESET_FACTORY_VIEW,
- "view-type", view_type,
- "data-factory", factory,
- "context", context,
+ "view-type", view_type,
+ "data-factory", factory,
+ "context", context,
+ "view-size", view_size,
+ "view-border-width", view_border_width,
NULL);
if (! gimp_data_factory_view_construct (GIMP_DATA_FACTORY_VIEW (factory_view),
- view_size, view_border_width,
menu_factory, "<ToolPreset>",
"/tool-preset-popup",
"tool-preset"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]