Apply patch from John Margaglione converting from args to properties.

Tue May 15 10:11:59 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkpreview.c: Apply patch from John Margaglione converting
	from args to properties. (#51957)

	* gtk/gtkscale.c (gtk_scale_class_init): Move install property
	calls to after ->set_property call.
This commit is contained in:
Owen Taylor 2001-05-15 14:14:19 +00:00 committed by Owen Taylor
parent ee5b82c1bc
commit cbb2129147
9 changed files with 114 additions and 46 deletions

View File

@ -1,3 +1,11 @@
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting
from args to properties. (#51957)
* gtk/gtkscale.c (gtk_scale_class_init): Move install property
calls to after ->set_property call.
Mon May 14 14:56:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/prop-editor.c: Block against redundant changes.

View File

@ -1,3 +1,11 @@
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting
from args to properties. (#51957)
* gtk/gtkscale.c (gtk_scale_class_init): Move install property
calls to after ->set_property call.
Mon May 14 14:56:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/prop-editor.c: Block against redundant changes.

View File

@ -1,3 +1,11 @@
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting
from args to properties. (#51957)
* gtk/gtkscale.c (gtk_scale_class_init): Move install property
calls to after ->set_property call.
Mon May 14 14:56:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/prop-editor.c: Block against redundant changes.

View File

@ -1,3 +1,11 @@
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting
from args to properties. (#51957)
* gtk/gtkscale.c (gtk_scale_class_init): Move install property
calls to after ->set_property call.
Mon May 14 14:56:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/prop-editor.c: Block against redundant changes.

View File

@ -1,3 +1,11 @@
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting
from args to properties. (#51957)
* gtk/gtkscale.c (gtk_scale_class_init): Move install property
calls to after ->set_property call.
Mon May 14 14:56:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/prop-editor.c: Block against redundant changes.

View File

@ -1,3 +1,11 @@
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting
from args to properties. (#51957)
* gtk/gtkscale.c (gtk_scale_class_init): Move install property
calls to after ->set_property call.
Mon May 14 14:56:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/prop-editor.c: Block against redundant changes.

View File

@ -1,3 +1,11 @@
Tue May 15 10:11:59 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpreview.c: Apply patch from John Margaglione converting
from args to properties. (#51957)
* gtk/gtkscale.c (gtk_scale_class_init): Move install property
calls to after ->set_property call.
Mon May 14 14:56:21 2001 Owen Taylor <otaylor@redhat.com>
* tests/prop-editor.c: Block against redundant changes.

View File

@ -35,24 +35,27 @@
#include "gdk/gdkrgb.h"
#include "gtkpreview.h"
#include "gtksignal.h"
#include "gtkintl.h"
#define PREVIEW_CLASS(w) GTK_PREVIEW_CLASS (GTK_OBJECT (w)->klass)
enum {
ARG_0,
ARG_EXPAND
PROP_0,
PROP_EXPAND
};
static void gtk_preview_class_init (GtkPreviewClass *klass);
static void gtk_preview_init (GtkPreview *preview);
static void gtk_preview_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_preview_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_preview_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_preview_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_preview_finalize (GObject *object);
static void gtk_preview_realize (GtkWidget *widget);
static void gtk_preview_size_allocate (GtkWidget *widget,
@ -107,8 +110,8 @@ gtk_preview_class_init (GtkPreviewClass *klass)
gobject_class->finalize = gtk_preview_finalize;
object_class->set_arg = gtk_preview_set_arg;
object_class->get_arg = gtk_preview_get_arg;
gobject_class->set_property = gtk_preview_set_property;
gobject_class->get_property = gtk_preview_get_property;
widget_class->realize = gtk_preview_realize;
widget_class->size_allocate = gtk_preview_size_allocate;
@ -125,43 +128,51 @@ gtk_preview_class_init (GtkPreviewClass *klass)
klass->info.cmap = gdk_rgb_get_cmap ();
klass->info.visual = gdk_rgb_get_visual ();
gtk_object_add_arg_type ("GtkPreview::expand",
GTK_TYPE_BOOL,
GTK_ARG_READWRITE,
ARG_EXPAND);
g_object_class_install_property (gobject_class,
PROP_EXPAND,
g_param_spec_boolean ("expand",
_("Expand"),
_("Whether the preview widget should take up the entire space it is allocated"),
FALSE,
G_PARAM_READWRITE));
}
static void
gtk_preview_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_preview_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkPreview *preview = GTK_PREVIEW (object);
switch (arg_id)
switch (prop_id)
{
case ARG_EXPAND:
gtk_preview_set_expand (preview, GTK_VALUE_BOOL (*arg));
case PROP_EXPAND:
gtk_preview_set_expand (preview, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_preview_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
gtk_preview_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkPreview *preview;
preview = GTK_PREVIEW (object);
switch (arg_id)
switch (prop_id)
{
case ARG_EXPAND:
GTK_VALUE_BOOL (*arg) = preview->expand;
case PROP_EXPAND:
g_value_set_boolean (value, preview->expand);
break;
default:
arg->type = GTK_TYPE_INVALID;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@ -360,6 +371,8 @@ gtk_preview_set_expand (GtkPreview *preview,
{
preview->expand = expand;
gtk_widget_queue_resize (GTK_WIDGET (preview));
g_object_notify (G_OBJECT (preview), "expand");
}
}

View File

@ -118,6 +118,24 @@ gtk_scale_class_init (GtkScaleClass *class)
parent_class = gtk_type_class (GTK_TYPE_RANGE);
gobject_class->set_property = gtk_scale_set_property;
gobject_class->get_property = gtk_scale_get_property;
widget_class->map = gtk_scale_map;
widget_class->unmap = gtk_scale_unmap;
range_class->draw_background = gtk_scale_draw_background;
signals[FORMAT_VALUE] =
g_signal_newc ("format_value",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkScaleClass, format_value),
single_string_accumulator, NULL,
gtk_marshal_STRING__DOUBLE,
G_TYPE_STRING, 1,
G_TYPE_DOUBLE);
g_object_class_install_property (gobject_class,
PROP_DIGITS,
g_param_spec_int ("digits",
@ -145,25 +163,6 @@ gtk_scale_class_init (GtkScaleClass *class)
GTK_POS_LEFT,
G_PARAM_READWRITE));
signals[FORMAT_VALUE] =
g_signal_newc ("format_value",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkScaleClass, format_value),
single_string_accumulator, NULL,
gtk_marshal_STRING__DOUBLE,
G_TYPE_STRING, 1,
G_TYPE_DOUBLE);
gobject_class->set_property = gtk_scale_set_property;
gobject_class->get_property = gtk_scale_get_property;
widget_class->map = gtk_scale_map;
widget_class->unmap = gtk_scale_unmap;
range_class->draw_background = gtk_scale_draw_background;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("slider_length",
_("Slider Length"),