[gimp/gtk3-port: 133/228] libgimpwidgets: implement GtkWidget::state_flags_changed()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 133/228] libgimpwidgets: implement GtkWidget::state_flags_changed()
- Date: Sun, 6 Jan 2013 14:56:45 +0000 (UTC)
commit 1d64e71071b5ab74ba0659adadb5ddc88aff5cbf
Author: Michael Natterer <mitch gimp org>
Date: Tue Dec 21 00:07:03 2010 +0100
libgimpwidgets: implement GtkWidget::state_flags_changed()
instead of GtkWidget::state_changed()
libgimpwidgets/gimpcolorarea.c | 119 +++++++++++++++++++-------------------
libgimpwidgets/gimpcolorbutton.c | 93 +++++++++++++++---------------
libgimpwidgets/gimpcolorscale.c | 63 ++++++++++----------
3 files changed, 139 insertions(+), 136 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorarea.c b/libgimpwidgets/gimpcolorarea.c
index 9d2b89e..28a1d1a 100644
--- a/libgimpwidgets/gimpcolorarea.c
+++ b/libgimpwidgets/gimpcolorarea.c
@@ -63,48 +63,48 @@ enum
};
-static void gimp_color_area_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_color_area_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_color_area_finalize (GObject *object);
-
-static void gimp_color_area_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gimp_color_area_state_changed (GtkWidget *widget,
- GtkStateType previous_state);
-static gboolean gimp_color_area_draw (GtkWidget *widget,
- cairo_t *cr);
-static void gimp_color_area_render_buf (GtkWidget *widget,
- gboolean insensitive,
- GimpColorAreaType type,
- guchar *buf,
- guint width,
- guint height,
- guint rowstride,
- GimpRGB *color);
-static void gimp_color_area_render (GimpColorArea *area);
-
-static void gimp_color_area_drag_begin (GtkWidget *widget,
- GdkDragContext *context);
-static void gimp_color_area_drag_end (GtkWidget *widget,
- GdkDragContext *context);
-static void gimp_color_area_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
-static void gimp_color_area_drag_data_get (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
+static void gimp_color_area_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_color_area_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_color_area_finalize (GObject *object);
+
+static void gimp_color_area_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+static void gimp_color_area_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags previous_state);
+static gboolean gimp_color_area_draw (GtkWidget *widget,
+ cairo_t *cr);
+static void gimp_color_area_render_buf (GtkWidget *widget,
+ gboolean insensitive,
+ GimpColorAreaType type,
+ guchar *buf,
+ guint width,
+ guint height,
+ guint rowstride,
+ GimpRGB *color);
+static void gimp_color_area_render (GimpColorArea *area);
+
+static void gimp_color_area_drag_begin (GtkWidget *widget,
+ GdkDragContext *context);
+static void gimp_color_area_drag_end (GtkWidget *widget,
+ GdkDragContext *context);
+static void gimp_color_area_drag_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time);
+static void gimp_color_area_drag_data_get (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time);
G_DEFINE_TYPE (GimpColorArea, gimp_color_area, GTK_TYPE_DRAWING_AREA)
@@ -132,20 +132,20 @@ gimp_color_area_class_init (GimpColorAreaClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- object_class->get_property = gimp_color_area_get_property;
- object_class->set_property = gimp_color_area_set_property;
- object_class->finalize = gimp_color_area_finalize;
+ object_class->get_property = gimp_color_area_get_property;
+ object_class->set_property = gimp_color_area_set_property;
+ object_class->finalize = gimp_color_area_finalize;
- widget_class->size_allocate = gimp_color_area_size_allocate;
- widget_class->state_changed = gimp_color_area_state_changed;
- widget_class->draw = gimp_color_area_draw;
+ widget_class->size_allocate = gimp_color_area_size_allocate;
+ widget_class->state_flags_changed = gimp_color_area_state_flags_changed;
+ widget_class->draw = gimp_color_area_draw;
- widget_class->drag_begin = gimp_color_area_drag_begin;
- widget_class->drag_end = gimp_color_area_drag_end;
- widget_class->drag_data_received = gimp_color_area_drag_data_received;
- widget_class->drag_data_get = gimp_color_area_drag_data_get;
+ widget_class->drag_begin = gimp_color_area_drag_begin;
+ widget_class->drag_end = gimp_color_area_drag_end;
+ widget_class->drag_data_received = gimp_color_area_drag_data_received;
+ widget_class->drag_data_get = gimp_color_area_drag_data_get;
- klass->color_changed = NULL;
+ klass->color_changed = NULL;
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
@@ -325,17 +325,18 @@ gimp_color_area_size_allocate (GtkWidget *widget,
}
static void
-gimp_color_area_state_changed (GtkWidget *widget,
- GtkStateType previous_state)
+gimp_color_area_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags previous_state)
{
- if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
- previous_state == GTK_STATE_INSENSITIVE)
+ if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE) !=
+ (previous_state & GTK_STATE_FLAG_INSENSITIVE))
{
GIMP_COLOR_AREA (widget)->needs_render = TRUE;
}
- if (GTK_WIDGET_CLASS (parent_class)->state_changed)
- GTK_WIDGET_CLASS (parent_class)->state_changed (widget, previous_state);
+ if (GTK_WIDGET_CLASS (parent_class)->state_flags_changed)
+ GTK_WIDGET_CLASS (parent_class)->state_flags_changed (widget,
+ previous_state);
}
static gboolean
diff --git a/libgimpwidgets/gimpcolorbutton.c b/libgimpwidgets/gimpcolorbutton.c
index eee071a..929f04c 100644
--- a/libgimpwidgets/gimpcolorbutton.c
+++ b/libgimpwidgets/gimpcolorbutton.c
@@ -90,39 +90,39 @@ enum
};
-static void gimp_color_button_class_init (GimpColorButtonClass *klass);
-static void gimp_color_button_init (GimpColorButton *button,
- GimpColorButtonClass *klass);
-
-static void gimp_color_button_finalize (GObject *object);
-static void gimp_color_button_dispose (GObject *object);
-static void gimp_color_button_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_color_button_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static gboolean gimp_color_button_button_press (GtkWidget *widget,
- GdkEventButton *bevent);
-static void gimp_color_button_state_changed (GtkWidget *widget,
- GtkStateType prev_state);
-static void gimp_color_button_clicked (GtkButton *button);
-static GType gimp_color_button_get_action_type (GimpColorButton *button);
-
-static void gimp_color_button_dialog_response (GtkWidget *dialog,
- gint response_id,
- GimpColorButton *button);
-static void gimp_color_button_use_color (GtkAction *action,
- GimpColorButton *button);
-static void gimp_color_button_area_changed (GtkWidget *color_area,
- GimpColorButton *button);
-static void gimp_color_button_selection_changed (GtkWidget *selection,
- GimpColorButton *button);
-static void gimp_color_button_help_func (const gchar *help_id,
- gpointer help_data);
+static void gimp_color_button_class_init (GimpColorButtonClass *klass);
+static void gimp_color_button_init (GimpColorButton *button,
+ GimpColorButtonClass *klass);
+
+static void gimp_color_button_finalize (GObject *object);
+static void gimp_color_button_dispose (GObject *object);
+static void gimp_color_button_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_color_button_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static gboolean gimp_color_button_button_press (GtkWidget *widget,
+ GdkEventButton *bevent);
+static void gimp_color_button_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags prev_state);
+static void gimp_color_button_clicked (GtkButton *button);
+static GType gimp_color_button_get_action_type (GimpColorButton *button);
+
+static void gimp_color_button_dialog_response (GtkWidget *dialog,
+ gint response_id,
+ GimpColorButton *button);
+static void gimp_color_button_use_color (GtkAction *action,
+ GimpColorButton *button);
+static void gimp_color_button_area_changed (GtkWidget *color_area,
+ GimpColorButton *button);
+static void gimp_color_button_selection_changed (GtkWidget *selection,
+ GimpColorButton *button);
+static void gimp_color_button_help_func (const gchar *help_id,
+ gpointer help_data);
static const GtkActionEntry actions[] =
@@ -202,18 +202,18 @@ gimp_color_button_class_init (GimpColorButtonClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- object_class->finalize = gimp_color_button_finalize;
- object_class->dispose = gimp_color_button_dispose;
- object_class->get_property = gimp_color_button_get_property;
- object_class->set_property = gimp_color_button_set_property;
+ object_class->finalize = gimp_color_button_finalize;
+ object_class->dispose = gimp_color_button_dispose;
+ object_class->get_property = gimp_color_button_get_property;
+ object_class->set_property = gimp_color_button_set_property;
- widget_class->button_press_event = gimp_color_button_button_press;
- widget_class->state_changed = gimp_color_button_state_changed;
+ widget_class->button_press_event = gimp_color_button_button_press;
+ widget_class->state_flags_changed = gimp_color_button_state_flags_changed;
- button_class->clicked = gimp_color_button_clicked;
+ button_class->clicked = gimp_color_button_clicked;
- klass->color_changed = NULL;
- klass->get_action_type = gimp_color_button_get_action_type;
+ klass->color_changed = NULL;
+ klass->get_action_type = gimp_color_button_get_action_type;
gimp_rgba_set (&color, 0.0, 0.0, 0.0, 1.0);
@@ -508,16 +508,17 @@ gimp_color_button_button_press (GtkWidget *widget,
}
static void
-gimp_color_button_state_changed (GtkWidget *widget,
- GtkStateType prev_state)
+gimp_color_button_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags previous_state)
{
g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));
if (! gtk_widget_is_sensitive (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);
- if (GTK_WIDGET_CLASS (parent_class)->state_changed)
- GTK_WIDGET_CLASS (parent_class)->state_changed (widget, prev_state);
+ if (GTK_WIDGET_CLASS (parent_class)->state_flags_changed)
+ GTK_WIDGET_CLASS (parent_class)->state_flags_changed (widget,
+ previous_state);
}
static void
diff --git a/libgimpwidgets/gimpcolorscale.c b/libgimpwidgets/gimpcolorscale.c
index c2da2de..5a56564 100644
--- a/libgimpwidgets/gimpcolorscale.c
+++ b/libgimpwidgets/gimpcolorscale.c
@@ -52,30 +52,30 @@ enum
};
-static void gimp_color_scale_finalize (GObject *object);
-static void gimp_color_scale_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_color_scale_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static void gimp_color_scale_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gimp_color_scale_state_changed (GtkWidget *widget,
- GtkStateType previous_state);
-static gboolean gimp_color_scale_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gboolean gimp_color_scale_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gboolean gimp_color_scale_draw (GtkWidget *widget,
- cairo_t *cr);
-
-static void gimp_color_scale_render (GimpColorScale *scale);
-static void gimp_color_scale_render_alpha (GimpColorScale *scale);
-static void gimp_color_scale_render_stipple (GimpColorScale *scale);
+static void gimp_color_scale_finalize (GObject *object);
+static void gimp_color_scale_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_color_scale_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_color_scale_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+static void gimp_color_scale_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags previous_state);
+static gboolean gimp_color_scale_button_press (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gimp_color_scale_button_release (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gimp_color_scale_draw (GtkWidget *widget,
+ cairo_t *cr);
+
+static void gimp_color_scale_render (GimpColorScale *scale);
+static void gimp_color_scale_render_alpha (GimpColorScale *scale);
+static void gimp_color_scale_render_stipple (GimpColorScale *scale);
G_DEFINE_TYPE (GimpColorScale, gimp_color_scale, GTK_TYPE_SCALE)
@@ -94,7 +94,7 @@ gimp_color_scale_class_init (GimpColorScaleClass *klass)
object_class->set_property = gimp_color_scale_set_property;
widget_class->size_allocate = gimp_color_scale_size_allocate;
- widget_class->state_changed = gimp_color_scale_state_changed;
+ widget_class->state_flags_changed = gimp_color_scale_state_flags_changed;
widget_class->button_press_event = gimp_color_scale_button_press;
widget_class->button_release_event = gimp_color_scale_button_release;
widget_class->draw = gimp_color_scale_draw;
@@ -258,17 +258,18 @@ gimp_color_scale_size_allocate (GtkWidget *widget,
}
static void
-gimp_color_scale_state_changed (GtkWidget *widget,
- GtkStateType previous_state)
+gimp_color_scale_state_flags_changed (GtkWidget *widget,
+ GtkStateFlags previous_state)
{
- if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
- previous_state == GTK_STATE_INSENSITIVE)
+ if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_INSENSITIVE) !=
+ (previous_state & GTK_STATE_FLAG_INSENSITIVE))
{
GIMP_COLOR_SCALE (widget)->needs_render = TRUE;
}
- if (GTK_WIDGET_CLASS (parent_class)->state_changed)
- GTK_WIDGET_CLASS (parent_class)->state_changed (widget, previous_state);
+ if (GTK_WIDGET_CLASS (parent_class)->state_flags_changed)
+ GTK_WIDGET_CLASS (parent_class)->state_flags_changed (widget,
+ previous_state);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]