Apply patch from John Margaglione that converts from args to properties.

2001-05-15  Alexander Larsson  <alla@lysator.liu.se>

	* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
	from args to properties.
This commit is contained in:
Alexander Larsson 2001-05-15 15:31:45 +00:00 committed by Alexander Larsson
parent f2d46127db
commit e3eb7927e7
8 changed files with 165 additions and 56 deletions

View File

@ -1,3 +1,8 @@
2001-05-15 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
from args to properties.
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com> Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting * gtk/gtkpreview.c: Apply patch from John Margaglione converting

View File

@ -1,3 +1,8 @@
2001-05-15 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
from args to properties.
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com> Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting * gtk/gtkpreview.c: Apply patch from John Margaglione converting

View File

@ -1,3 +1,8 @@
2001-05-15 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
from args to properties.
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com> Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting * gtk/gtkpreview.c: Apply patch from John Margaglione converting

View File

@ -1,3 +1,8 @@
2001-05-15 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
from args to properties.
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com> Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting * gtk/gtkpreview.c: Apply patch from John Margaglione converting

View File

@ -1,3 +1,8 @@
2001-05-15 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
from args to properties.
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com> Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting * gtk/gtkpreview.c: Apply patch from John Margaglione converting

View File

@ -1,3 +1,8 @@
2001-05-15 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
from args to properties.
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com> Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting * gtk/gtkpreview.c: Apply patch from John Margaglione converting

View File

@ -1,3 +1,8 @@
2001-05-15 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkpacker.c: Apply patch from John Margaglione that converts
from args to properties.
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com> Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting * gtk/gtkpreview.c: Apply patch from John Margaglione converting

View File

@ -95,16 +95,16 @@ terms specified in this license.
#include "gtkpacker.h" #include "gtkpacker.h"
#include "gtkintl.h"
enum { enum {
ARG_0, PROP_0,
ARG_SPACING, PROP_SPACING,
ARG_D_BORDER_WIDTH, PROP_D_BORDER_WIDTH,
ARG_D_PAD_X, PROP_D_PAD_X,
ARG_D_PAD_Y, PROP_D_PAD_Y,
ARG_D_IPAD_X, PROP_D_IPAD_X,
ARG_D_IPAD_Y PROP_D_IPAD_Y
}; };
enum { enum {
@ -139,12 +139,14 @@ static void gtk_packer_forall (GtkContainer *container,
gboolean include_internals, gboolean include_internals,
GtkCallback callback, GtkCallback callback,
gpointer callback_data); gpointer callback_data);
static void gtk_packer_set_arg (GtkObject *object, static void gtk_packer_set_property (GObject *object,
GtkArg *arg, guint prop_id,
guint arg_id); const GValue *value,
static void gtk_packer_get_arg (GtkObject *object, GParamSpec *pspec);
GtkArg *arg, static void gtk_packer_get_property (GObject *object,
guint arg_id); guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_packer_get_child_arg (GtkContainer *container, static void gtk_packer_get_child_arg (GtkContainer *container,
GtkWidget *child, GtkWidget *child,
GtkArg *arg, GtkArg *arg,
@ -187,21 +189,16 @@ static void
gtk_packer_class_init (GtkPackerClass *klass) gtk_packer_class_init (GtkPackerClass *klass)
{ {
GtkObjectClass *object_class; GtkObjectClass *object_class;
GObjectClass *gobject_class;
GtkWidgetClass *widget_class; GtkWidgetClass *widget_class;
GtkContainerClass *container_class; GtkContainerClass *container_class;
gobject_class = G_OBJECT_CLASS (klass);
object_class = (GtkObjectClass*) klass; object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass; widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass; container_class = (GtkContainerClass*) klass;
parent_class = gtk_type_class (GTK_TYPE_CONTAINER); parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
gtk_object_add_arg_type ("GtkPacker::spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_SPACING);
gtk_object_add_arg_type ("GtkPacker::default_border_width", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_BORDER_WIDTH);
gtk_object_add_arg_type ("GtkPacker::default_pad_x", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_PAD_X);
gtk_object_add_arg_type ("GtkPacker::default_pad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_PAD_Y);
gtk_object_add_arg_type ("GtkPacker::default_ipad_x", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_IPAD_X);
gtk_object_add_arg_type ("GtkPacker::default_ipad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_D_IPAD_Y);
gtk_container_add_child_arg_type ("GtkPacker::side", GTK_TYPE_SIDE_TYPE, GTK_ARG_READWRITE, CHILD_ARG_SIDE); gtk_container_add_child_arg_type ("GtkPacker::side", GTK_TYPE_SIDE_TYPE, GTK_ARG_READWRITE, CHILD_ARG_SIDE);
gtk_container_add_child_arg_type ("GtkPacker::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, CHILD_ARG_ANCHOR); gtk_container_add_child_arg_type ("GtkPacker::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, CHILD_ARG_ANCHOR);
gtk_container_add_child_arg_type ("GtkPacker::expand", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_EXPAND); gtk_container_add_child_arg_type ("GtkPacker::expand", GTK_TYPE_BOOL, GTK_ARG_READWRITE, CHILD_ARG_EXPAND);
@ -215,8 +212,8 @@ gtk_packer_class_init (GtkPackerClass *klass)
gtk_container_add_child_arg_type ("GtkPacker::ipad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_I_PAD_Y); gtk_container_add_child_arg_type ("GtkPacker::ipad_y", GTK_TYPE_UINT, GTK_ARG_READWRITE, CHILD_ARG_I_PAD_Y);
gtk_container_add_child_arg_type ("GtkPacker::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION); gtk_container_add_child_arg_type ("GtkPacker::position", GTK_TYPE_INT, GTK_ARG_READWRITE, CHILD_ARG_POSITION);
object_class->set_arg = gtk_packer_set_arg; gobject_class->set_property = gtk_packer_set_property;
object_class->get_arg = gtk_packer_get_arg; gobject_class->get_property = gtk_packer_get_property;
widget_class->map = gtk_packer_map; widget_class->map = gtk_packer_map;
widget_class->unmap = gtk_packer_unmap; widget_class->unmap = gtk_packer_unmap;
@ -230,44 +227,106 @@ gtk_packer_class_init (GtkPackerClass *klass)
container_class->child_type = gtk_packer_child_type; container_class->child_type = gtk_packer_child_type;
container_class->get_child_arg = gtk_packer_get_child_arg; container_class->get_child_arg = gtk_packer_get_child_arg;
container_class->set_child_arg = gtk_packer_set_child_arg; container_class->set_child_arg = gtk_packer_set_child_arg;
g_object_class_install_property (gobject_class,
PROP_SPACING,
g_param_spec_uint ("spacing",
_("Spacing"),
_("Width between child elements"),
0,
G_MAXUINT,
0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_D_BORDER_WIDTH,
g_param_spec_uint ("default_border_width",
_("Default Border"),
_("Default border width"),
0,
G_MAXUINT,
0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_D_PAD_X,
g_param_spec_uint ("default_pad_x",
_("Default Pad X"),
_("Default horizontal padding"),
0,
G_MAXUINT,
0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_D_PAD_Y,
g_param_spec_uint ("default_pad_y",
_("Default Pad Y"),
_("Default vertical padding"),
0,
G_MAXUINT,
0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_D_IPAD_X,
g_param_spec_uint ("default_ipad_x",
_("Default IPad X"),
_("Default horizontal internal padding"),
0,
G_MAXUINT,
0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_D_IPAD_Y,
g_param_spec_uint ("default_ipad_y",
_("Default IPad Y"),
_("Default vertical internal padding"),
0,
G_MAXUINT,
0,
G_PARAM_READWRITE));
} }
static void static void
gtk_packer_set_arg (GtkObject *object, gtk_packer_set_property (GObject *object,
GtkArg *arg, guint prop_id,
guint arg_id) const GValue *value,
GParamSpec *pspec)
{ {
GtkPacker *packer; GtkPacker *packer;
packer = GTK_PACKER (object); packer = GTK_PACKER (object);
switch (arg_id) switch (prop_id)
{ {
case ARG_SPACING: case PROP_SPACING:
gtk_packer_set_spacing (packer, GTK_VALUE_UINT (*arg)); gtk_packer_set_spacing (packer, g_value_get_uint (value));
break; break;
case ARG_D_BORDER_WIDTH: case PROP_D_BORDER_WIDTH:
gtk_packer_set_default_border_width (packer, GTK_VALUE_UINT (*arg)); gtk_packer_set_default_border_width (packer, g_value_get_uint (value));
break; break;
case ARG_D_PAD_X: case PROP_D_PAD_X:
gtk_packer_set_default_pad (packer, gtk_packer_set_default_pad (packer,
GTK_VALUE_UINT (*arg), g_value_get_uint (value),
packer->default_pad_y); packer->default_pad_y);
break; break;
case ARG_D_PAD_Y: case PROP_D_PAD_Y:
gtk_packer_set_default_pad (packer, gtk_packer_set_default_pad (packer,
packer->default_pad_x, packer->default_pad_x,
GTK_VALUE_UINT (*arg)); g_value_get_uint (value));
break; break;
case ARG_D_IPAD_X: case PROP_D_IPAD_X:
gtk_packer_set_default_ipad (packer, gtk_packer_set_default_ipad (packer,
GTK_VALUE_UINT (*arg), g_value_get_uint (value),
packer->default_i_pad_y); packer->default_i_pad_y);
break; break;
case ARG_D_IPAD_Y: case PROP_D_IPAD_Y:
gtk_packer_set_default_ipad (packer, gtk_packer_set_default_ipad (packer,
packer->default_i_pad_x, packer->default_i_pad_x,
GTK_VALUE_UINT (*arg)); g_value_get_uint (value));
break; break;
default: default:
break; break;
@ -275,36 +334,37 @@ gtk_packer_set_arg (GtkObject *object,
} }
static void static void
gtk_packer_get_arg (GtkObject *object, gtk_packer_get_property (GObject *object,
GtkArg *arg, guint prop_id,
guint arg_id) GValue *value,
GParamSpec *pspec)
{ {
GtkPacker *packer; GtkPacker *packer;
packer = GTK_PACKER (object); packer = GTK_PACKER (object);
switch (arg_id) switch (prop_id)
{ {
case ARG_SPACING: case PROP_SPACING:
GTK_VALUE_UINT (*arg) = packer->spacing; g_value_set_uint (value, packer->spacing);
break; break;
case ARG_D_BORDER_WIDTH: case PROP_D_BORDER_WIDTH:
GTK_VALUE_UINT (*arg) = packer->default_border_width; g_value_set_uint (value, packer->default_border_width);
break; break;
case ARG_D_PAD_X: case PROP_D_PAD_X:
GTK_VALUE_UINT (*arg) = packer->default_pad_x; g_value_set_uint (value, packer->default_pad_x);
break; break;
case ARG_D_PAD_Y: case PROP_D_PAD_Y:
GTK_VALUE_UINT (*arg) = packer->default_pad_y; g_value_set_uint (value, packer->default_pad_y);
break; break;
case ARG_D_IPAD_X: case PROP_D_IPAD_X:
GTK_VALUE_UINT (*arg) = packer->default_i_pad_x; g_value_set_uint (value, packer->default_i_pad_x);
break; break;
case ARG_D_IPAD_Y: case PROP_D_IPAD_Y:
GTK_VALUE_UINT (*arg) = packer->default_i_pad_y; g_value_set_uint (value, packer->default_i_pad_y);
break; break;
default: default:
arg->type = GTK_TYPE_INVALID; G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
@ -510,6 +570,8 @@ gtk_packer_set_spacing (GtkPacker *packer,
{ {
packer->spacing = spacing; packer->spacing = spacing;
gtk_widget_queue_resize (GTK_WIDGET (packer)); gtk_widget_queue_resize (GTK_WIDGET (packer));
g_object_notify (G_OBJECT (packer), "spacing");
} }
} }
@ -554,6 +616,8 @@ gtk_packer_set_default_border_width (GtkPacker *packer,
{ {
packer->default_border_width = border;; packer->default_border_width = border;;
redo_defaults_children (packer); redo_defaults_children (packer);
g_object_notify (G_OBJECT (packer), "default_border_width");
} }
} }
void void
@ -570,6 +634,11 @@ gtk_packer_set_default_pad (GtkPacker *packer,
packer->default_pad_x = pad_x; packer->default_pad_x = pad_x;
packer->default_pad_y = pad_y; packer->default_pad_y = pad_y;
redo_defaults_children (packer); redo_defaults_children (packer);
if (packer->default_pad_x != pad_x)
g_object_notify (G_OBJECT (packer), "default_pad_x");
if (packer->default_pad_y != pad_y)
g_object_notify (G_OBJECT (packer), "default_pad_y");
} }
} }
@ -587,6 +656,11 @@ gtk_packer_set_default_ipad (GtkPacker *packer,
packer->default_i_pad_x = i_pad_x; packer->default_i_pad_x = i_pad_x;
packer->default_i_pad_y = i_pad_y; packer->default_i_pad_y = i_pad_y;
redo_defaults_children (packer); redo_defaults_children (packer);
if (packer->default_i_pad_x != i_pad_x)
g_object_notify (G_OBJECT (packer), "default_ipad_x");
if (packer->default_i_pad_y != i_pad_y)
g_object_notify (G_OBJECT (packer), "default_ipad_y");
} }
} }