Commit 5d8b25a2 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

variant of gimp_config_connect() which allows the connected objects to

2006-01-14  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpconfig-utils.[ch] (gimp_config_connect_full):
	variant of gimp_config_connect() which allows the connected
	objects to have different propertynames.

	* app/widgets/widgets-enums.[ch]: removed enum GimpViewType...

	* app/core/core-enums.[ch]: ...and added it here.

	* app/widgets/gimpviewablebutton.[ch] (gimp_viewable_button_new):
	added "button_preview_size" parameter so the button and popup
	preview sizes can be specified separately.

	* app/widgets/gimptemplateeditor.c: changed accordingly.

	* app/widgets/gimpviewablebox.[ch] (gimp_prop_*_box_new):
	new functions which take additional "view_type_prop" and
	"view_size_prop" parameters and sync the passed context's
	properties with the resp. properties of the viewable button.

	* app/paint/gimppaintoptions.[ch]
	* app/tools/gimpbucketfilloptions.c
	* app/tools/gimpclonetool.c
	* app/tools/gimppaintoptions-gui.c
	* app/tools/gimptextoptions.[ch]: added view-type and view-size
	properties to the options objects and use the new viewable box
	constructors so the selected view types and sizes are persistant
	across sessions. Fixes bug #315443.
parent 078c3c8c
2006-01-14 Michael Natterer <mitch@gimp.org>
* app/config/gimpconfig-utils.[ch] (gimp_config_connect_full):
variant of gimp_config_connect() which allows the connected
objects to have different propertynames.
* app/widgets/widgets-enums.[ch]: removed enum GimpViewType...
* app/core/core-enums.[ch]: ...and added it here.
* app/widgets/gimpviewablebutton.[ch] (gimp_viewable_button_new):
added "button_preview_size" parameter so the button and popup
preview sizes can be specified separately.
* app/widgets/gimptemplateeditor.c: changed accordingly.
* app/widgets/gimpviewablebox.[ch] (gimp_prop_*_box_new):
new functions which take additional "view_type_prop" and
"view_size_prop" parameters and sync the passed context's
properties with the resp. properties of the viewable button.
* app/paint/gimppaintoptions.[ch]
* app/tools/gimpbucketfilloptions.c
* app/tools/gimpclonetool.c
* app/tools/gimppaintoptions-gui.c
* app/tools/gimptextoptions.[ch]: added view-type and view-size
properties to the options objects and use the new viewable box
constructors so the selected view types and sizes are persistant
across sessions. Fixes bug #315443.
2006-01-14 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpsessioninfo.c (gimp_session_info_restore): always
......
......@@ -105,6 +105,101 @@ gimp_config_connect (GObject *a,
g_free (signal_name);
}
static void
gimp_config_connect_full_notify (GObject *src,
GParamSpec *param_spec,
GObject *dest)
{
if (param_spec->flags & G_PARAM_READABLE)
{
gchar *attach_key;
gchar *dest_prop_name;
GParamSpec *dest_spec = NULL;
attach_key = g_strdup_printf ("%p-%s", dest, param_spec->name);
dest_prop_name = g_object_get_data (src, attach_key);
g_free (attach_key);
if (dest_prop_name)
dest_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dest),
dest_prop_name);
if (dest_spec &&
(dest_spec->value_type == param_spec->value_type) &&
(dest_spec->flags & G_PARAM_WRITABLE) &&
(dest_spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0)
{
GValue value = { 0, };
g_value_init (&value, param_spec->value_type);
g_object_get_property (src, param_spec->name, &value);
g_signal_handlers_block_by_func (dest,
gimp_config_connect_full_notify, src);
g_object_set_property (dest, dest_prop_name, &value);
g_signal_handlers_unblock_by_func (dest,
gimp_config_connect_full_notify, src);
g_value_unset (&value);
}
}
}
/**
* gimp_config_connect_full:
* @a: a #GObject
* @b: another #GObject
* @property_name_a: the name of a property of @a to connect
* @property_name_b: the name of a property of @b to connect
*
* Connects the two object @a and @b in a way that property changes of
* one are propagated to the other. This is a two-way connection.
*
* If @property_name is %NULL the connection is setup for all
* properties. It is not required that @a and @b are of the same type.
* Only changes on properties that exist in both object classes and
* are of the same value_type are propagated.
**/
void
gimp_config_connect_full (GObject *a,
GObject *b,
const gchar *property_name_a,
const gchar *property_name_b)
{
gchar *signal_name;
gchar *attach_key;
g_return_if_fail (a != b);
g_return_if_fail (G_IS_OBJECT (a) && G_IS_OBJECT (b));
g_return_if_fail (property_name_a != NULL);
g_return_if_fail (property_name_b != NULL);
signal_name = g_strconcat ("notify::", property_name_a, NULL);
attach_key = g_strdup_printf ("%p-%s", b, property_name_a);
g_signal_connect_object (a, signal_name,
G_CALLBACK (gimp_config_connect_full_notify),
b, 0);
g_object_set_data_full (a, attach_key, g_strdup (property_name_b),
(GDestroyNotify) g_free);
g_free (signal_name);
g_free (attach_key);
signal_name = g_strconcat ("notify::", property_name_b, NULL);
attach_key = g_strdup_printf ("%p-%s", a, property_name_b);
g_signal_connect_object (b, signal_name,
G_CALLBACK (gimp_config_connect_full_notify),
a, 0);
g_object_set_data_full (b, attach_key, g_strdup (property_name_a),
(GDestroyNotify) g_free);
g_free (signal_name);
g_free (attach_key);
}
/**
* gimp_config_disconnect:
* @a: a #GObject
......
......@@ -23,11 +23,15 @@
#define __APP_GIMP_CONFIG_UTILS_H__
void gimp_config_connect (GObject *a,
GObject *b,
const gchar *property_name);
void gimp_config_disconnect (GObject *a,
GObject *b);
void gimp_config_connect (GObject *a,
GObject *b,
const gchar *property_name);
void gimp_config_connect_full (GObject *a,
GObject *b,
const gchar *property_name_a,
const gchar *property_name_b);
void gimp_config_disconnect (GObject *a,
GObject *b);
#endif /* __APP_GIMP_CONFIG_UTILS_H__ */
......@@ -544,6 +544,34 @@ gimp_view_size_get_type (void)
return type;
}
GType
gimp_view_type_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_VIEW_TYPE_LIST, "GIMP_VIEW_TYPE_LIST", "list" },
{ GIMP_VIEW_TYPE_GRID, "GIMP_VIEW_TYPE_GRID", "grid" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_VIEW_TYPE_LIST, N_("View as list"), NULL },
{ GIMP_VIEW_TYPE_GRID, N_("View as grid"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (! type)
{
type = g_enum_register_static ("GimpViewType", values);
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_selection_control_get_type (void)
{
......
......@@ -259,6 +259,17 @@ typedef enum /*< pdb-skip >*/
} GimpViewSize;
#define GIMP_TYPE_VIEW_TYPE (gimp_view_type_get_type ())
GType gimp_view_type_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_VIEW_TYPE_LIST, /*< desc="View as list" >*/
GIMP_VIEW_TYPE_GRID /*< desc="View as grid" >*/
} GimpViewType;
#define GIMP_TYPE_SELECTION_CONTROL (gimp_selection_control_get_type ())
GType gimp_selection_control_get_type (void) G_GNUC_CONST;
......
......@@ -80,7 +80,14 @@ enum
PROP_GRADIENT_LENGTH,
PROP_GRADIENT_UNIT,
PROP_USE_JITTER,
PROP_JITTER_AMOUNT
PROP_JITTER_AMOUNT,
PROP_BRUSH_VIEW_TYPE,
PROP_BRUSH_VIEW_SIZE,
PROP_PATTERN_VIEW_TYPE,
PROP_PATTERN_VIEW_SIZE,
PROP_GRADIENT_VIEW_TYPE,
PROP_GRADIENT_VIEW_SIZE
};
......@@ -200,6 +207,42 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
"gradient-unit", NULL,
TRUE, TRUE, DEFAULT_GRADIENT_UNIT,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_BRUSH_VIEW_TYPE,
"brush-view-type", NULL,
GIMP_TYPE_VIEW_TYPE,
GIMP_VIEW_TYPE_GRID,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_BRUSH_VIEW_SIZE,
"brush-view-size", NULL,
GIMP_VIEW_SIZE_TINY,
GIMP_VIEWABLE_MAX_BUTTON_SIZE,
GIMP_VIEW_SIZE_SMALL,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PATTERN_VIEW_TYPE,
"pattern-view-type", NULL,
GIMP_TYPE_VIEW_TYPE,
GIMP_VIEW_TYPE_GRID,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_PATTERN_VIEW_SIZE,
"pattern-view-size", NULL,
GIMP_VIEW_SIZE_TINY,
GIMP_VIEWABLE_MAX_BUTTON_SIZE,
GIMP_VIEW_SIZE_SMALL,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_GRADIENT_VIEW_TYPE,
"gradient-view-type", NULL,
GIMP_TYPE_VIEW_TYPE,
GIMP_VIEW_TYPE_LIST,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_GRADIENT_VIEW_SIZE,
"gradient-view-size", NULL,
GIMP_VIEW_SIZE_TINY,
GIMP_VIEWABLE_MAX_BUTTON_SIZE,
GIMP_VIEW_SIZE_LARGE,
0);
}
static void
......@@ -314,6 +357,27 @@ gimp_paint_options_set_property (GObject *object,
gradient_options->gradient_unit = g_value_get_int (value);
break;
case PROP_BRUSH_VIEW_TYPE:
options->brush_view_type = g_value_get_enum (value);
break;
case PROP_BRUSH_VIEW_SIZE:
options->brush_view_size = g_value_get_int (value);
break;
case PROP_PATTERN_VIEW_TYPE:
options->pattern_view_type = g_value_get_enum (value);
break;
case PROP_PATTERN_VIEW_SIZE:
options->pattern_view_size = g_value_get_int (value);
break;
case PROP_GRADIENT_VIEW_TYPE:
options->gradient_view_type = g_value_get_enum (value);
break;
case PROP_GRADIENT_VIEW_SIZE:
options->gradient_view_size = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -405,6 +469,27 @@ gimp_paint_options_get_property (GObject *object,
g_value_set_int (value, gradient_options->gradient_unit);
break;
case PROP_BRUSH_VIEW_TYPE:
g_value_set_enum (value, options->brush_view_type);
break;
case PROP_BRUSH_VIEW_SIZE:
g_value_set_int (value, options->brush_view_size);
break;
case PROP_PATTERN_VIEW_TYPE:
g_value_set_enum (value, options->pattern_view_type);
break;
case PROP_PATTERN_VIEW_SIZE:
g_value_set_int (value, options->pattern_view_size);
break;
case PROP_GRADIENT_VIEW_TYPE:
g_value_set_enum (value, options->gradient_view_type);
break;
case PROP_GRADIENT_VIEW_SIZE:
g_value_set_int (value, options->gradient_view_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......
......@@ -94,6 +94,13 @@ struct _GimpPaintOptions
GimpFadeOptions *fade_options;
GimpGradientOptions *gradient_options;
GimpJitterOptions *jitter_options;
GimpViewType brush_view_type;
GimpViewSize brush_view_size;
GimpViewType pattern_view_type;
GimpViewSize pattern_view_size;
GimpViewType gradient_view_type;
GimpViewSize gradient_view_size;
};
struct _GimpPaintOptionsClass
......
......@@ -218,7 +218,8 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
hbox = gimp_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
"pattern-view-type", "pattern-view-size");
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_BUCKET_FILL);
/* fill selection */
......
......@@ -305,7 +305,8 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
_("Sample merged"));
gimp_enum_radio_frame_add (GTK_FRAME (frame), button, GIMP_IMAGE_CLONE);
hbox = gimp_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
"pattern-view-type", "pattern-view-size");
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_CLONE);
table = gtk_table_new (1, 2, FALSE);
......
......@@ -123,7 +123,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
tool_type != GIMP_TYPE_BLEND_TOOL &&
tool_type != GIMP_TYPE_INK_TOOL)
{
button = gimp_brush_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
button = gimp_prop_brush_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
"brush-view-type", "brush-view-size");
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
_("Brush:"), 0.0, 0.5,
button, 2, FALSE);
......@@ -132,8 +133,10 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
/* the gradient */
if (tool_type == GIMP_TYPE_BLEND_TOOL)
{
button = gimp_gradient_box_new (NULL, GIMP_CONTEXT (tool_options),
"gradient-reverse", 2);
button = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
"gradient-view-type",
"gradient-view-size",
"gradient-reverse");
gimp_table_attach_aligned (GTK_TABLE (table), 0, table_row++,
_("Gradient:"), 0.0, 0.5,
button, 2, TRUE);
......@@ -459,8 +462,10 @@ gradient_options_gui (GimpGradientOptions *gradient,
}
/* the gradient view */
button = gimp_gradient_box_new (NULL, GIMP_CONTEXT (config),
"gradient-reverse", 2);
button = gimp_prop_gradient_box_new (NULL, GIMP_CONTEXT (config), 2,
"gradient-view-type",
"gradient-view-size",
"gradient-reverse");
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Gradient:"), 0.0, 0.5,
button, 2, TRUE);
......
......@@ -305,7 +305,8 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
_("Sample merged"));
gimp_enum_radio_frame_add (GTK_FRAME (frame), button, GIMP_IMAGE_CLONE);
hbox = gimp_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
hbox = gimp_prop_pattern_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
"pattern-view-type", "pattern-view-size");
gimp_enum_radio_frame_add (GTK_FRAME (frame), hbox, GIMP_PATTERN_CLONE);
table = gtk_table_new (1, 2, FALSE);
......
......@@ -62,7 +62,10 @@ enum
PROP_JUSTIFICATION,
PROP_INDENTATION,
PROP_LINE_SPACING,
PROP_LETTER_SPACING
PROP_LETTER_SPACING,
PROP_FONT_VIEW_TYPE,
PROP_FONT_VIEW_SIZE
};
......@@ -155,6 +158,18 @@ gimp_text_options_class_init (GimpTextOptionsClass *klass)
N_("Adjust letter spacing"),
-8192.0, 8192.0, 0.0,
GIMP_CONFIG_PARAM_DEFAULTS);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_FONT_VIEW_TYPE,
"font-view-type", NULL,
GIMP_TYPE_VIEW_TYPE,
GIMP_VIEW_TYPE_LIST,
0);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_FONT_VIEW_SIZE,
"font-view-size", NULL,
GIMP_VIEW_SIZE_TINY,
GIMP_VIEWABLE_MAX_BUTTON_SIZE,
GIMP_VIEW_SIZE_SMALL,
0);
}
static void
......@@ -206,6 +221,14 @@ gimp_text_options_get_property (GObject *object,
case PROP_LETTER_SPACING:
g_value_set_double (value, options->letter_spacing);
break;
case PROP_FONT_VIEW_TYPE:
g_value_set_enum (value, options->font_view_type);
break;
case PROP_FONT_VIEW_SIZE:
g_value_set_int (value, options->font_view_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -256,6 +279,14 @@ gimp_text_options_set_property (GObject *object,
case PROP_LETTER_SPACING:
options->letter_spacing = g_value_get_double (value);
break;
case PROP_FONT_VIEW_TYPE:
options->font_view_type = g_value_get_enum (value);
break;
case PROP_FONT_VIEW_SIZE:
options->font_view_size = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -392,7 +423,8 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
hbox = gimp_font_box_new (NULL, GIMP_CONTEXT (tool_options), 2);
hbox = gimp_prop_font_box_new (NULL, GIMP_CONTEXT (tool_options), 2,
"font-view-type", "font-view-size");
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Font:"), 0.0, 0.5,
hbox, 2, FALSE);
......
......@@ -50,6 +50,9 @@ struct _GimpTextOptions
gdouble line_spacing;
gdouble letter_spacing;
GimpViewType font_view_type;
GimpViewSize font_view_size;
GimpSizeEntry *size_entry;
};
......
......@@ -531,6 +531,7 @@ gimp_template_editor_new (GimpTemplate *template,
button = gimp_viewable_button_new (editor->stock_id_container,
editor->stock_id_context,
GIMP_VIEW_TYPE_LIST,
GIMP_VIEW_SIZE_SMALL,
GIMP_VIEW_SIZE_SMALL, 0,
NULL, NULL, NULL, NULL);
gimp_viewable_button_set_view_type (GIMP_VIEWABLE_BUTTON (button),
......
......@@ -24,6 +24,8 @@
#include "widgets-types.h"
#include "config/gimpconfig-utils.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
......@@ -42,85 +44,168 @@
/* local function prototypes */
static GtkWidget * gimp_viewable_box_new (GimpContainer *container,
static GtkWidget * gimp_viewable_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
GimpViewType view_type,
GimpViewType button_view_size,
GimpViewSize view_size,
const gchar *dialog_identifier,
const gchar *dialog_stock_id,
const gchar *dialog_tooltip);
static GtkWidget * view_props_connect (GtkWidget *box,
GimpContext *context,
const gchar *view_type_prop,
const gchar *view_size_prop);
static void gimp_gradient_box_reverse_notify (GObject *object,
GParamSpec *pspec,
GimpView *view);
/* public functions */
/* brush boxes */
GtkWidget *
gimp_brush_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
static GtkWidget *
brush_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
GimpViewType view_type,
GimpViewSize view_size)
{
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
if (! container)
container = context->gimp->brush_factory->container;
return gimp_viewable_box_new (container, context, spacing,
GIMP_VIEW_TYPE_GRID, GIMP_VIEW_SIZE_SMALL,
view_type, GIMP_VIEW_SIZE_SMALL, view_size,
"gimp-brush-grid|gimp-brush-list",
GIMP_STOCK_BRUSH,
_("Open the brush selection dialog"));
}
GtkWidget *
gimp_pattern_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
gimp_brush_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
{
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return brush_box_new (container, context, spacing,
GIMP_VIEW_TYPE_GRID, GIMP_VIEW_SIZE_SMALL);
}
GtkWidget *
gimp_prop_brush_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
const gchar *view_type_prop,
const gchar *view_size_prop)
{
GimpViewType view_type;
GimpViewSize view_size;
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_object_get (context,
view_type_prop, &view_type,
view_size_prop, &view_size,
NULL);
return view_props_connect (brush_box_new (container, context, spacing,
view_type, view_size),
context,
view_type_prop, view_size_prop);
}
/* pattern boxes */
static GtkWidget *
pattern_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
GimpViewType view_type,
GimpViewSize view_size)
{
if (! container)
container = context->gimp->pattern_factory->container;
return gimp_viewable_box_new (container, context, spacing,
GIMP_VIEW_TYPE_GRID, GIMP_VIEW_SIZE_SMALL,
view_type, GIMP_VIEW_SIZE_SMALL, view_size,
"gimp-pattern-grid|gimp-pattern-list",
GIMP_STOCK_PATTERN,
_("Open the pattern selection dialog"));
}
GtkWidget *
gimp_gradient_box_new (GimpContainer *container,
GimpContext *context,
const gchar *reverse_prop,
gint spacing)
gimp_pattern_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
{
GtkWidget *hbox;
GtkWidget *button;
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return pattern_box_new (container, context, spacing,
GIMP_VIEW_TYPE_GRID, GIMP_VIEW_SIZE_SMALL);
}
GtkWidget *
gimp_prop_pattern_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
const gchar *view_type_prop,
const gchar *view_size_prop)
{
GimpViewType view_type;
GimpViewSize view_size;
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_object_get (context,
view_type_prop, &view_type,
view_size_prop, &view_size,
NULL);
return view_props_connect (pattern_box_new (container, context, spacing,
view_type, view_size),
context,
view_type_prop, view_size_prop);
}
/* gradient boxes */
GtkWidget *
gradient_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
GimpViewType view_type,
GimpViewSize view_size,
const gchar *reverse_prop)
{
GtkWidget *hbox;
GtkWidget *button;
if (! container)
container = context->gimp->gradient_factory->container;
hbox = gtk_hbox_new (FALSE, spacing);
button = gimp_viewable_button_new (container, context,
GIMP_VIEW_TYPE_LIST,
GIMP_VIEW_SIZE_LARGE, 1,
view_type,
GIMP_VIEW_SIZE_LARGE, view_size, 1,
gimp_dialog_factory_from_name ("dock"),
"gimp-gradient-list|gimp-gradient-grid",
GIMP_STOCK_GRADIENT,
_("Open the gradient selection dialog"));
GIMP_VIEWABLE_BUTTON (button)->preview_size = GIMP_VIEW_SIZE_SMALL;
GIMP_VIEWABLE_BUTTON (button)->button_preview_size = GIMP_VIEW_SIZE_SMALL;
g_object_set_data (G_OBJECT (hbox), "viewable-button", button);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
......@@ -152,43 +237,163 @@ gimp_gradient_box_new (GimpContainer *container,
}
GtkWidget *
gimp_palette_box_new (GimpContainer *container,
GimpContext *context,
gint spacing)
gimp_gradient_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
const gchar *reverse_prop)
{
g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return gradient_box_new (container, context, spacing,
GIMP_VIEW_TYPE_LIST, GIMP_VIEW_SIZE_LARGE,
reverse_prop);
}
GtkWidget *
gimp_prop_gradient_box_new (GimpContainer *container,
GimpContext *context,
gint spacing,
const gchar *view_type_prop,
const gchar *view_size_prop,
const gchar *reverse_prop)
{
GimpViewType view_type;
GimpViewSize view_size;
g_return_val_if_fail (container == NULL