* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
#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_finalize (GtkObject *object);
+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,
GtkAllocation *allocation);
static void
gtk_preview_class_init (GtkPreviewClass *klass)
{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
preview_class = klass;
- object_class->set_arg = gtk_preview_set_arg;
- object_class->get_arg = gtk_preview_get_arg;
- object_class->finalize = gtk_preview_finalize;
+ gobject_class->finalize = gtk_preview_finalize;
+
+ 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;
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;
}
}
void
gtk_preview_uninit (void)
{
-
/* unimplemented */
}
{
preview->expand = expand;
gtk_widget_queue_resize (GTK_WIDGET (preview));
+
+ g_object_notify (G_OBJECT (preview), "expand");
}
}
static void
-gtk_preview_finalize (GtkObject *object)
+gtk_preview_finalize (GObject *object)
{
GtkPreview *preview;
- g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_PREVIEW (object));
preview = GTK_PREVIEW (object);
g_free (preview->buffer);
preview->type = (GtkPreviewType) -1;
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void