[gimp] app: add "gimp" property needed for next step
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: add "gimp" property needed for next step
- Date: Fri, 12 Feb 2010 22:37:11 +0000 (UTC)
commit 56fabf760e02a76c8a46bbf50fdba6d8c53d544d
Author: Michael Natterer <mitch gimp org>
Date: Fri Feb 12 23:36:38 2010 +0100
app: add "gimp" property needed for next step
app/dialogs/preferences-dialog.c | 2 +-
app/widgets/gimpdeviceeditor.c | 107 ++++++++++++++++++++++++++++++++++++--
app/widgets/gimpdeviceeditor.h | 2 +-
3 files changed, 105 insertions(+), 6 deletions(-)
---
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 5eb841a..f7e95eb 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -531,7 +531,7 @@ prefs_input_devices_dialog (GtkWidget *widget,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (input_dialog));
- editor = gimp_device_editor_new ();
+ editor = gimp_device_editor_new (gimp);
gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
gtk_container_add (GTK_CONTAINER (content_area), editor);
gtk_widget_show (editor);
diff --git a/app/widgets/gimpdeviceeditor.c b/app/widgets/gimpdeviceeditor.c
index f15d5dc..02606f6 100644
--- a/app/widgets/gimpdeviceeditor.c
+++ b/app/widgets/gimpdeviceeditor.c
@@ -23,19 +23,30 @@
#include "widgets-types.h"
+#include "core/gimp.h"
#include "core/gimpmarshal.h"
#include "gimpdeviceeditor.h"
#include "gimpdeviceinfo.h"
#include "gimpdeviceinfoeditor.h"
+#include "gimpdevices.h"
#include "gimp-intl.h"
+enum
+{
+ PROP_0,
+ PROP_GIMP
+};
+
+
typedef struct _GimpDeviceEditorPrivate GimpDeviceEditorPrivate;
struct _GimpDeviceEditorPrivate
{
+ Gimp *gimp;
+
GtkWidget *notebook;
};
@@ -46,12 +57,26 @@ struct _GimpDeviceEditorPrivate
GimpDeviceEditorPrivate)
-static void gimp_device_editor_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen);
+static GObject * gimp_device_editor_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params);
+static void gimp_device_editor_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_device_editor_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_device_editor_screen_changed (GtkWidget *widget,
+ GdkScreen *previous_screen);
G_DEFINE_TYPE (GimpDeviceEditor, gimp_device_editor, GTK_TYPE_HBOX)
+#define parent_class gimp_device_editor_parent_class
+
static void
gimp_device_editor_class_init (GimpDeviceEditorClass *klass)
@@ -59,8 +84,19 @@ gimp_device_editor_class_init (GimpDeviceEditorClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ object_class->constructor = gimp_device_editor_constructor;
+ object_class->set_property = gimp_device_editor_set_property;
+ object_class->get_property = gimp_device_editor_get_property;
+
widget_class->screen_changed = gimp_device_editor_screen_changed;
+ g_object_class_install_property (object_class, PROP_GIMP,
+ g_param_spec_object ("gimp",
+ NULL, NULL,
+ GIMP_TYPE_GIMP,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
g_type_class_add_private (object_class, sizeof (GimpDeviceEditorPrivate));
}
@@ -77,6 +113,65 @@ gimp_device_editor_init (GimpDeviceEditor *editor)
gtk_widget_show (private->notebook);
}
+static GObject *
+gimp_device_editor_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params)
+{
+ GObject *object;
+ GimpDeviceEditor *editor;
+ GimpDeviceEditorPrivate *private;
+
+ object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
+
+ editor = GIMP_DEVICE_EDITOR (object);
+ private = GIMP_DEVICE_EDITOR_GET_PRIVATE (editor);
+
+ g_assert (GIMP_IS_GIMP (private->gimp));
+
+ return object;
+}
+
+static void
+gimp_device_editor_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpDeviceEditorPrivate *private = GIMP_DEVICE_EDITOR_GET_PRIVATE (object);
+
+ switch (property_id)
+ {
+ case PROP_GIMP:
+ private->gimp = g_value_get_object (value); /* don't ref */
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_device_editor_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpDeviceEditorPrivate *private = GIMP_DEVICE_EDITOR_GET_PRIVATE (object);
+
+ switch (property_id)
+ {
+ case PROP_GIMP:
+ g_value_set_object (value, private->gimp);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
static void
gimp_device_editor_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
@@ -123,7 +218,11 @@ gimp_device_editor_screen_changed (GtkWidget *widget,
}
GtkWidget *
-gimp_device_editor_new (void)
+gimp_device_editor_new (Gimp *gimp)
{
- return g_object_new (GIMP_TYPE_DEVICE_EDITOR, NULL);
+ g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+
+ return g_object_new (GIMP_TYPE_DEVICE_EDITOR,
+ "gimp", gimp,
+ NULL);
}
diff --git a/app/widgets/gimpdeviceeditor.h b/app/widgets/gimpdeviceeditor.h
index c50e9f8..98f223e 100644
--- a/app/widgets/gimpdeviceeditor.h
+++ b/app/widgets/gimpdeviceeditor.h
@@ -42,7 +42,7 @@ struct _GimpDeviceEditorClass
GType gimp_device_editor_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_device_editor_new (void);
+GtkWidget * gimp_device_editor_new (Gimp *gimp);
#endif /* __GIMP_DEVICE_EDITOR_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]