[gimp/gtk3-port: 173/231] Implement GtkWidget::style_updated() instead of ::style_set()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 173/231] Implement GtkWidget::style_updated() instead of ::style_set()
- Date: Sun, 13 Dec 2015 18:51:05 +0000 (UTC)
commit 5a2a5b72dde7a645a932bad3c8cd19bbd14c9212
Author: Michael Natterer <mitch gimp org>
Date: Sun Jan 9 20:38:01 2011 +0100
Implement GtkWidget::style_updated() instead of ::style_set()
app/widgets/gimpcoloreditor.c | 16 ++--
app/widgets/gimpcolorframe.c | 18 ++---
app/widgets/gimpcurveview.c | 10 +--
app/widgets/gimpdataeditor.c | 20 ++---
app/widgets/gimpdock.c | 11 +--
app/widgets/gimpdockable.c | 15 ++--
app/widgets/gimpeditor.c | 18 ++---
app/widgets/gimpitemtreeview.c | 10 +--
app/widgets/gimpmenudock.c | 11 +--
app/widgets/gimpsamplepointeditor.c | 26 ++++---
app/widgets/gimptoolpalette.c | 11 +--
libgimp/gimpaspectpreview.c | 138 +++++++++++++++++-----------------
libgimp/gimpdrawablepreview.c | 45 ++++++------
libgimp/gimpzoompreview.c | 99 +++++++++++++------------
14 files changed, 217 insertions(+), 231 deletions(-)
---
diff --git a/app/widgets/gimpcoloreditor.c b/app/widgets/gimpcoloreditor.c
index 5673d4c..31b74b7 100644
--- a/app/widgets/gimpcoloreditor.c
+++ b/app/widgets/gimpcoloreditor.c
@@ -63,8 +63,7 @@ static void gimp_color_editor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_color_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_color_editor_style_updated (GtkWidget *widget);
static void gimp_color_editor_set_aux_info (GimpDocked *docked,
GList *aux_info);
@@ -112,11 +111,11 @@ gimp_color_editor_class_init (GimpColorEditorClass* klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->dispose = gimp_color_editor_dispose;
- object_class->set_property = gimp_color_editor_set_property;
- object_class->get_property = gimp_color_editor_get_property;
+ object_class->dispose = gimp_color_editor_dispose;
+ object_class->set_property = gimp_color_editor_set_property;
+ object_class->get_property = gimp_color_editor_get_property;
- widget_class->style_set = gimp_color_editor_style_set;
+ widget_class->style_updated = gimp_color_editor_style_updated;
g_object_class_install_property (object_class, PROP_CONTEXT,
g_param_spec_object ("context",
@@ -474,12 +473,11 @@ gimp_color_editor_new (GimpContext *context)
}
static void
-gimp_color_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_color_editor_style_updated (GtkWidget *widget)
{
GimpColorEditor *editor = GIMP_COLOR_EDITOR (widget);
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
if (editor->hbox)
gimp_editor_set_box_style (GIMP_EDITOR (editor), GTK_BOX (editor->hbox));
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index 472ea61..fd9214e 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -57,8 +57,7 @@ static void gimp_color_frame_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);
-static void gimp_color_frame_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_color_frame_style_updated (GtkWidget *widget);
static gboolean gimp_color_frame_draw (GtkWidget *widget,
cairo_t *cr);
@@ -78,12 +77,12 @@ gimp_color_frame_class_init (GimpColorFrameClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = gimp_color_frame_finalize;
- object_class->get_property = gimp_color_frame_get_property;
- object_class->set_property = gimp_color_frame_set_property;
+ object_class->finalize = gimp_color_frame_finalize;
+ object_class->get_property = gimp_color_frame_get_property;
+ object_class->set_property = gimp_color_frame_set_property;
- widget_class->style_set = gimp_color_frame_style_set;
- widget_class->draw = gimp_color_frame_draw;
+ widget_class->style_updated = gimp_color_frame_style_updated;
+ widget_class->draw = gimp_color_frame_draw;
g_object_class_install_property (object_class, PROP_MODE,
g_param_spec_enum ("mode",
@@ -252,12 +251,11 @@ gimp_color_frame_set_property (GObject *object,
}
static void
-gimp_color_frame_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_color_frame_style_updated (GtkWidget *widget)
{
GimpColorFrame *frame = GIMP_COLOR_FRAME (widget);
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
if (frame->number_layout)
{
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 77c040d..acadfe5 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -78,8 +78,7 @@ static void gimp_curve_view_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_curve_view_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_curve_view_style_updated (GtkWidget *widget);
static gboolean gimp_curve_view_draw (GtkWidget *widget,
cairo_t *cr);
static gboolean gimp_curve_view_button_press (GtkWidget *widget,
@@ -123,7 +122,7 @@ gimp_curve_view_class_init (GimpCurveViewClass *klass)
object_class->set_property = gimp_curve_view_set_property;
object_class->get_property = gimp_curve_view_get_property;
- widget_class->style_set = gimp_curve_view_style_set;
+ widget_class->style_updated = gimp_curve_view_style_updated;
widget_class->draw = gimp_curve_view_draw;
widget_class->button_press_event = gimp_curve_view_button_press;
widget_class->button_release_event = gimp_curve_view_button_release;
@@ -350,12 +349,11 @@ gimp_curve_view_get_property (GObject *object,
}
static void
-gimp_curve_view_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_curve_view_style_updated (GtkWidget *widget)
{
GimpCurveView *view = GIMP_CURVE_VIEW (widget);
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
if (view->layout)
{
diff --git a/app/widgets/gimpdataeditor.c b/app/widgets/gimpdataeditor.c
index a00c048..9c50c32 100644
--- a/app/widgets/gimpdataeditor.c
+++ b/app/widgets/gimpdataeditor.c
@@ -70,8 +70,7 @@ static void gimp_data_editor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_data_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_data_editor_style_updated (GtkWidget *widget);
static void gimp_data_editor_set_context (GimpDocked *docked,
GimpContext *context);
@@ -120,14 +119,14 @@ gimp_data_editor_class_init (GimpDataEditorClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->constructed = gimp_data_editor_constructed;
- object_class->dispose = gimp_data_editor_dispose;
- object_class->set_property = gimp_data_editor_set_property;
- object_class->get_property = gimp_data_editor_get_property;
+ object_class->constructed = gimp_data_editor_constructed;
+ object_class->set_property = gimp_data_editor_set_property;
+ object_class->get_property = gimp_data_editor_get_property;
+ object_class->dispose = gimp_data_editor_dispose;
- widget_class->style_set = gimp_data_editor_style_set;
+ widget_class->style_updated = gimp_data_editor_style_updated;
- klass->set_data = gimp_data_editor_real_set_data;
+ klass->set_data = gimp_data_editor_real_set_data;
g_object_class_install_property (object_class, PROP_DATA_FACTORY,
g_param_spec_object ("data-factory",
@@ -298,13 +297,12 @@ gimp_data_editor_get_property (GObject *object,
}
static void
-gimp_data_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_data_editor_style_updated (GtkWidget *widget)
{
GimpDataEditor *editor = GIMP_DATA_EDITOR (widget);
gint minimal_height;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
gtk_widget_style_get (widget,
"minimal-height", &minimal_height,
diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c
index 1af97af..5f310b1 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -74,8 +74,8 @@ struct _GimpDockPrivate
static void gimp_dock_dispose (GObject *object);
-static void gimp_dock_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_dock_style_updated (GtkWidget *widget);
+
static gchar * gimp_dock_real_get_description (GimpDock *dock,
gboolean complete);
static void gimp_dock_real_book_added (GimpDock *dock,
@@ -141,7 +141,7 @@ gimp_dock_class_init (GimpDockClass *klass)
object_class->dispose = gimp_dock_dispose;
- widget_class->style_set = gimp_dock_style_set;
+ widget_class->style_updated = gimp_dock_style_updated;
klass->get_description = gimp_dock_real_get_description;
klass->set_host_geometry_hints = NULL;
@@ -215,13 +215,12 @@ gimp_dock_dispose (GObject *object)
}
static void
-gimp_dock_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_dock_style_updated (GtkWidget *widget)
{
GimpDock *dock = GIMP_DOCK (widget);
gdouble font_scale = 1.0;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
gtk_widget_style_get (widget,
"font-scale", &font_scale,
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index 0a37f05..0b49692 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -117,8 +117,7 @@ static gboolean gimp_dockable_drag_drop (GtkWidget *widget,
gint y,
guint time);
-static void gimp_dockable_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_dockable_style_updated (GtkWidget *widget);
static void gimp_dockable_add (GtkContainer *container,
GtkWidget *widget);
@@ -157,7 +156,7 @@ gimp_dockable_class_init (GimpDockableClass *klass)
widget_class->get_preferred_width = gimp_dockable_get_preferred_width;
widget_class->get_preferred_height = gimp_dockable_get_preferred_height;
widget_class->size_allocate = gimp_dockable_size_allocate;
- widget_class->style_set = gimp_dockable_style_set;
+ widget_class->style_updated = gimp_dockable_style_updated;
widget_class->drag_leave = gimp_dockable_drag_leave;
widget_class->drag_motion = gimp_dockable_drag_motion;
widget_class->drag_drop = gimp_dockable_drag_drop;
@@ -189,6 +188,7 @@ gimp_dockable_init (GimpDockable *dockable)
dockable->p = G_TYPE_INSTANCE_GET_PRIVATE (dockable,
GIMP_TYPE_DOCKABLE,
GimpDockablePrivate);
+
dockable->p->tab_style = GIMP_TAB_STYLE_AUTOMATIC;
dockable->p->actual_tab_style = GIMP_TAB_STYLE_UNDEFINED;
dockable->p->drag_x = GIMP_DOCKABLE_DRAG_OFFSET;
@@ -413,12 +413,11 @@ gimp_dockable_drag_drop (GtkWidget *widget,
}
static void
-gimp_dockable_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_dockable_style_updated (GtkWidget *widget)
{
gint content_border;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
gtk_widget_style_get (widget,
"content-border", &content_border,
@@ -964,8 +963,8 @@ gimp_dockable_set_aux_info (GimpSessionManaged *session_managed,
}
static GimpTabStyle
-gimp_dockable_convert_tab_style (GimpDockable *dockable,
- GimpTabStyle tab_style)
+gimp_dockable_convert_tab_style (GimpDockable *dockable,
+ GimpTabStyle tab_style)
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c
index 7a8132e..89c2af4 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -82,8 +82,7 @@ static void gimp_editor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gimp_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_editor_style_updated (GtkWidget *widget);
static GimpUIManager * gimp_editor_get_menu (GimpDocked *docked,
const gchar **ui_path,
@@ -110,12 +109,12 @@ gimp_editor_class_init (GimpEditorClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->constructed = gimp_editor_constructed;
- object_class->dispose = gimp_editor_dispose;
- object_class->set_property = gimp_editor_set_property;
- object_class->get_property = gimp_editor_get_property;
+ object_class->constructed = gimp_editor_constructed;
+ object_class->dispose = gimp_editor_dispose;
+ object_class->set_property = gimp_editor_set_property;
+ object_class->get_property = gimp_editor_get_property;
- widget_class->style_set = gimp_editor_style_set;
+ widget_class->style_updated = gimp_editor_style_updated;
g_object_class_install_property (object_class, PROP_MENU_FACTORY,
g_param_spec_object ("menu-factory",
@@ -354,13 +353,12 @@ gimp_editor_get_property (GObject *object,
}
static void
-gimp_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_editor_style_updated (GtkWidget *widget)
{
GimpEditor *editor = GIMP_EDITOR (widget);
gint content_spacing;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
gtk_widget_style_get (widget, "content-spacing", &content_spacing, NULL);
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index 09294e3..61a2df8 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -104,8 +104,7 @@ static void gimp_item_tree_view_docked_iface_init (GimpDockedInterface *docked
static void gimp_item_tree_view_constructed (GObject *object);
static void gimp_item_tree_view_dispose (GObject *object);
-static void gimp_item_tree_view_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_item_tree_view_style_updated (GtkWidget *widget);
static void gimp_item_tree_view_real_set_image (GimpItemTreeView *view,
GimpImage *image);
@@ -245,7 +244,7 @@ gimp_item_tree_view_class_init (GimpItemTreeViewClass *klass)
object_class->constructed = gimp_item_tree_view_constructed;
object_class->dispose = gimp_item_tree_view_dispose;
- widget_class->style_set = gimp_item_tree_view_style_set;
+ widget_class->style_updated = gimp_item_tree_view_style_updated;
tree_view_class->drop_possible = gimp_item_tree_view_drop_possible;
tree_view_class->drop_viewable = gimp_item_tree_view_drop_viewable;
@@ -523,8 +522,7 @@ gimp_item_tree_view_dispose (GObject *object)
}
static void
-gimp_item_tree_view_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_item_tree_view_style_updated (GtkWidget *widget)
{
GimpItemTreeView *view = GIMP_ITEM_TREE_VIEW (widget);
GList *children;
@@ -604,7 +602,7 @@ gimp_item_tree_view_style_set (GtkWidget *widget,
"icon-name", GIMP_STOCK_LINKED,
NULL);
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
}
GtkWidget *
diff --git a/app/widgets/gimpmenudock.c b/app/widgets/gimpmenudock.c
index 7303e7b..db6237c 100644
--- a/app/widgets/gimpmenudock.c
+++ b/app/widgets/gimpmenudock.c
@@ -45,14 +45,14 @@
#define DEFAULT_MINIMAL_WIDTH 200
+
struct _GimpMenuDockPrivate
{
gint make_sizeof_greater_than_zero;
};
-static void gimp_menu_dock_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_menu_dock_style_updated (GtkWidget *widget);
G_DEFINE_TYPE (GimpMenuDock, gimp_menu_dock, GIMP_TYPE_DOCK)
@@ -65,7 +65,7 @@ gimp_menu_dock_class_init (GimpMenuDockClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->style_set = gimp_menu_dock_style_set;
+ widget_class->style_updated = gimp_menu_dock_style_updated;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("minimal-width",
@@ -84,12 +84,11 @@ gimp_menu_dock_init (GimpMenuDock *dock)
}
static void
-gimp_menu_dock_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_menu_dock_style_updated (GtkWidget *widget)
{
gint minimal_width = -1;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
gtk_widget_style_get (widget,
"minimal-width", &minimal_width,
diff --git a/app/widgets/gimpsamplepointeditor.c b/app/widgets/gimpsamplepointeditor.c
index 1dd6242..9e0d601 100644
--- a/app/widgets/gimpsamplepointeditor.c
+++ b/app/widgets/gimpsamplepointeditor.c
@@ -59,8 +59,7 @@ static void gimp_sample_point_editor_get_property (GObject *ob
GValue *value,
GParamSpec *pspec);
-static void gimp_sample_point_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_sample_point_editor_style_updated (GtkWidget *widget);
static void gimp_sample_point_editor_set_image (GimpImageEditor *editor,
GimpImage *image);
@@ -104,7 +103,7 @@ gimp_sample_point_editor_class_init (GimpSamplePointEditorClass *klass)
object_class->get_property = gimp_sample_point_editor_get_property;
object_class->set_property = gimp_sample_point_editor_set_property;
- widget_class->style_set = gimp_sample_point_editor_style_set;
+ widget_class->style_updated = gimp_sample_point_editor_style_updated;
image_editor_class->set_image = gimp_sample_point_editor_set_image;
@@ -225,20 +224,23 @@ gimp_sample_point_editor_get_property (GObject *object,
}
static void
-gimp_sample_point_editor_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_sample_point_editor_style_updated (GtkWidget *widget)
{
GimpSamplePointEditor *editor = GIMP_SAMPLE_POINT_EDITOR (widget);
- gint content_spacing;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
- gtk_widget_style_get (widget,
- "content-spacing", &content_spacing,
- NULL);
+ if (editor->table)
+ {
+ gint content_spacing;
- gtk_table_set_row_spacing (GTK_TABLE (editor->table), 0, content_spacing);
- gtk_table_set_col_spacing (GTK_TABLE (editor->table), 0, content_spacing);
+ gtk_widget_style_get (widget,
+ "content-spacing", &content_spacing,
+ NULL);
+
+ gtk_table_set_row_spacing (GTK_TABLE (editor->table), 0, content_spacing);
+ gtk_table_set_col_spacing (GTK_TABLE (editor->table), 0, content_spacing);
+ }
}
static void
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
index 7901404..095912a 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -74,9 +74,7 @@ static void gimp_tool_palette_height_for_width (GtkWidget *widget,
gint width,
gint *min_width,
gint *pref_width);
-
-static void gimp_tool_palette_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
+static void gimp_tool_palette_style_updated (GtkWidget *widget);
static void gimp_tool_palette_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
@@ -107,7 +105,7 @@ gimp_tool_palette_class_init (GimpToolPaletteClass *klass)
widget_class->get_preferred_width = gimp_tool_palette_get_preferred_width;
widget_class->get_preferred_height = gimp_tool_palette_get_preferred_height;
widget_class->get_preferred_height_for_width = gimp_tool_palette_height_for_width;
- widget_class->style_set = gimp_tool_palette_style_set;
+ widget_class->style_updated = gimp_tool_palette_style_updated;
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("tool-icon-size",
@@ -211,8 +209,7 @@ gimp_tool_palette_height_for_width (GtkWidget *widget,
}
static void
-gimp_tool_palette_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
+gimp_tool_palette_style_updated (GtkWidget *widget)
{
GimpToolPalettePrivate *private = GET_PRIVATE (widget);
Gimp *gimp;
@@ -220,7 +217,7 @@ gimp_tool_palette_style_set (GtkWidget *widget,
GtkReliefStyle relief;
GList *list;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
if (! gimp_toolbox_get_context (private->toolbox))
return;
diff --git a/libgimp/gimpaspectpreview.c b/libgimp/gimpaspectpreview.c
index 225c087..7f43963 100644
--- a/libgimp/gimpaspectpreview.c
+++ b/libgimp/gimpaspectpreview.c
@@ -66,39 +66,38 @@ typedef struct
GIMP_TYPE_ASPECT_PREVIEW, \
GimpAspectPreviewPrivate)
-static void gimp_aspect_preview_constructed (GObject *object);
-static void gimp_aspect_preview_dispose (GObject *object);
-static void gimp_aspect_preview_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_aspect_preview_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static void gimp_aspect_preview_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
-static void gimp_aspect_preview_draw (GimpPreview *preview);
-static void gimp_aspect_preview_draw_buffer (GimpPreview *preview,
- const guchar *buffer,
- gint rowstride);
-static void gimp_aspect_preview_transform (GimpPreview *preview,
- gint src_x,
- gint src_y,
- gint *dest_x,
- gint *dest_y);
-static void gimp_aspect_preview_untransform (GimpPreview *preview,
- gint src_x,
- gint src_y,
- gint *dest_x,
- gint *dest_y);
-
-static void gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
- GimpDrawable *drawable);
+static void gimp_aspect_preview_constructed (GObject *object);
+static void gimp_aspect_preview_dispose (GObject *object);
+static void gimp_aspect_preview_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_aspect_preview_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_aspect_preview_style_updated (GtkWidget *widget);
+static void gimp_aspect_preview_draw (GimpPreview *preview);
+static void gimp_aspect_preview_draw_buffer (GimpPreview *preview,
+ const guchar *buffer,
+ gint rowstride);
+static void gimp_aspect_preview_transform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y);
+static void gimp_aspect_preview_untransform (GimpPreview *preview,
+ gint src_x,
+ gint src_y,
+ gint *dest_x,
+ gint *dest_y);
+
+static void gimp_aspect_preview_set_drawable (GimpAspectPreview *preview,
+ GimpDrawable *drawable);
static void gimp_aspect_preview_set_drawable_id
- (GimpAspectPreview *preview,
- gint32 drawable_ID);
+ (GimpAspectPreview *preview,
+ gint32 drawable_ID);
G_DEFINE_TYPE (GimpAspectPreview, gimp_aspect_preview, GIMP_TYPE_PREVIEW)
@@ -115,17 +114,17 @@ gimp_aspect_preview_class_init (GimpAspectPreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
- object_class->constructed = gimp_aspect_preview_constructed;
- object_class->dispose = gimp_aspect_preview_dispose;
- object_class->get_property = gimp_aspect_preview_get_property;
- object_class->set_property = gimp_aspect_preview_set_property;
+ object_class->constructed = gimp_aspect_preview_constructed;
+ object_class->dispose = gimp_aspect_preview_dispose;
+ object_class->get_property = gimp_aspect_preview_get_property;
+ object_class->set_property = gimp_aspect_preview_set_property;
- widget_class->style_set = gimp_aspect_preview_style_set;
+ widget_class->style_updated = gimp_aspect_preview_style_updated;
- preview_class->draw = gimp_aspect_preview_draw;
- preview_class->draw_buffer = gimp_aspect_preview_draw_buffer;
- preview_class->transform = gimp_aspect_preview_transform;
- preview_class->untransform = gimp_aspect_preview_untransform;
+ preview_class->draw = gimp_aspect_preview_draw;
+ preview_class->draw_buffer = gimp_aspect_preview_draw_buffer;
+ preview_class->transform = gimp_aspect_preview_transform;
+ preview_class->untransform = gimp_aspect_preview_untransform;
g_type_class_add_private (object_class, sizeof (GimpAspectPreviewPrivate));
@@ -259,41 +258,42 @@ gimp_aspect_preview_set_property (GObject *object,
}
static void
-gimp_aspect_preview_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_aspect_preview_style_updated (GtkWidget *widget)
{
- GimpPreview *preview = GIMP_PREVIEW (widget);
- GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
- gint width;
- gint height;
- gint size;
-
- if (GTK_WIDGET_CLASS (parent_class)->style_set)
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
-
- gtk_widget_style_get (widget,
- "size", &size,
- NULL);
+ GimpPreview *preview = GIMP_PREVIEW (widget);
- width = gimp_drawable_width (priv->drawable_ID);
- height = gimp_drawable_height (priv->drawable_ID);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
- if (width > height)
+ if (preview->area)
{
- preview->width = MIN (width, size);
- preview->height = (height * preview->width) / width;
+ GimpAspectPreviewPrivate *priv = GIMP_ASPECT_PREVIEW_GET_PRIVATE (preview);
+ gint width;
+ gint height;
+ gint size;
+
+ width = gimp_drawable_width (priv->drawable_ID);
+ height = gimp_drawable_height (priv->drawable_ID);
+
+ gtk_widget_style_get (widget,
+ "size", &size,
+ NULL);
+
+ if (width > height)
+ {
+ preview->width = MIN (width, size);
+ preview->height = (height * preview->width) / width;
+ }
+ else
+ {
+ preview->height = MIN (height, size);
+ preview->width = (width * preview->height) / height;
+ }
+
+ gtk_widget_set_size_request (preview->area,
+ preview->width, preview->height);
}
- else
- {
- preview->height = MIN (height, size);
- preview->width = (width * preview->height) / height;
- }
-
- gtk_widget_set_size_request (preview->area,
- preview->width, preview->height);
}
-
static void
gimp_aspect_preview_draw (GimpPreview *preview)
{
diff --git a/libgimp/gimpdrawablepreview.c b/libgimp/gimpdrawablepreview.c
index a95f5d9..6bc96b0 100644
--- a/libgimp/gimpdrawablepreview.c
+++ b/libgimp/gimpdrawablepreview.c
@@ -79,8 +79,7 @@ static void gimp_drawable_preview_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);
-static void gimp_drawable_preview_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_drawable_preview_style_updated (GtkWidget *widget);
static void gimp_drawable_preview_draw_original (GimpPreview *preview);
static void gimp_drawable_preview_draw_thumb (GimpPreview *preview,
@@ -113,16 +112,16 @@ gimp_drawable_preview_class_init (GimpDrawablePreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
- object_class->constructed = gimp_drawable_preview_constructed;
- object_class->dispose = gimp_drawable_preview_dispose;
- object_class->get_property = gimp_drawable_preview_get_property;
- object_class->set_property = gimp_drawable_preview_set_property;
+ object_class->constructed = gimp_drawable_preview_constructed;
+ object_class->dispose = gimp_drawable_preview_dispose;
+ object_class->get_property = gimp_drawable_preview_get_property;
+ object_class->set_property = gimp_drawable_preview_set_property;
- widget_class->style_set = gimp_drawable_preview_style_set;
+ widget_class->style_updated = gimp_drawable_preview_style_updated;
- preview_class->draw = gimp_drawable_preview_draw_original;
- preview_class->draw_thumb = gimp_drawable_preview_draw_thumb;
- preview_class->draw_buffer = gimp_drawable_preview_draw_buffer;
+ preview_class->draw = gimp_drawable_preview_draw_original;
+ preview_class->draw_thumb = gimp_drawable_preview_draw_thumb;
+ preview_class->draw_buffer = gimp_drawable_preview_draw_buffer;
g_type_class_add_private (object_class, sizeof (GimpDrawablePreviewPrivate));
@@ -261,23 +260,25 @@ gimp_drawable_preview_set_property (GObject *object,
}
static void
-gimp_drawable_preview_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_drawable_preview_style_updated (GtkWidget *widget)
{
GimpPreview *preview = GIMP_PREVIEW (widget);
- gint width = preview->xmax - preview->xmin;
- gint height = preview->ymax - preview->ymin;
- gint size;
- if (GTK_WIDGET_CLASS (parent_class)->style_set)
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
- gtk_widget_style_get (widget,
- "size", &size,
- NULL);
+ if (preview->area)
+ {
+ gint width = preview->xmax - preview->xmin;
+ gint height = preview->ymax - preview->ymin;
+ gint size;
+
+ gtk_widget_style_get (widget,
+ "size", &size,
+ NULL);
- gtk_widget_set_size_request (GIMP_PREVIEW (preview)->area,
- MIN (width, size), MIN (height, size));
+ gtk_widget_set_size_request (GIMP_PREVIEW (preview)->area,
+ MIN (width, size), MIN (height, size));
+ }
}
static void
diff --git a/libgimp/gimpzoompreview.c b/libgimp/gimpzoompreview.c
index 8b68287..a6786d8 100644
--- a/libgimp/gimpzoompreview.c
+++ b/libgimp/gimpzoompreview.c
@@ -87,8 +87,7 @@ static void gimp_zoom_preview_set_adjustments (GimpZoomPreview *preview,
static void gimp_zoom_preview_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpZoomPreview *preview);
-static void gimp_zoom_preview_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
+static void gimp_zoom_preview_style_updated (GtkWidget *widget);
static gboolean gimp_zoom_preview_scroll_event (GtkWidget *widget,
GdkEventScroll *event,
GimpZoomPreview *preview);
@@ -140,20 +139,20 @@ gimp_zoom_preview_class_init (GimpZoomPreviewClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GimpPreviewClass *preview_class = GIMP_PREVIEW_CLASS (klass);
- object_class->constructed = gimp_zoom_preview_constructed;
- object_class->finalize = gimp_zoom_preview_finalize;
- object_class->dispose = gimp_zoom_preview_dispose;
- object_class->get_property = gimp_zoom_preview_get_property;
- object_class->set_property = gimp_zoom_preview_set_property;
+ object_class->constructed = gimp_zoom_preview_constructed;
+ object_class->finalize = gimp_zoom_preview_finalize;
+ object_class->dispose = gimp_zoom_preview_dispose;
+ object_class->get_property = gimp_zoom_preview_get_property;
+ object_class->set_property = gimp_zoom_preview_set_property;
- widget_class->style_set = gimp_zoom_preview_style_set;
+ widget_class->style_updated = gimp_zoom_preview_style_updated;
- preview_class->draw = gimp_zoom_preview_draw;
- preview_class->draw_buffer = gimp_zoom_preview_draw_buffer;
- preview_class->draw_thumb = gimp_zoom_preview_draw_thumb;
- preview_class->set_cursor = gimp_zoom_preview_set_cursor;
- preview_class->transform = gimp_zoom_preview_transform;
- preview_class->untransform = gimp_zoom_preview_untransform;
+ preview_class->draw = gimp_zoom_preview_draw;
+ preview_class->draw_buffer = gimp_zoom_preview_draw_buffer;
+ preview_class->draw_thumb = gimp_zoom_preview_draw_thumb;
+ preview_class->set_cursor = gimp_zoom_preview_set_cursor;
+ preview_class->transform = gimp_zoom_preview_transform;
+ preview_class->untransform = gimp_zoom_preview_untransform;
g_type_class_add_private (object_class, sizeof (GimpZoomPreviewPrivate));
@@ -406,46 +405,48 @@ gimp_zoom_preview_size_allocate (GtkWidget *widget,
}
static void
-gimp_zoom_preview_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+gimp_zoom_preview_style_updated (GtkWidget *widget)
{
- GimpPreview *preview = GIMP_PREVIEW (widget);
- GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW (preview)->priv;
- gint size;
- gint width, height;
- gint x1, y1;
- gint x2, y2;
-
- if (GTK_WIDGET_CLASS (parent_class)->style_set)
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GimpPreview *preview = GIMP_PREVIEW (widget);
- gtk_widget_style_get (widget, "size", &size, NULL);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
- if (_gimp_drawable_preview_get_bounds (priv->drawable_ID,
- &x1, &y1, &x2, &y2))
- {
- width = x2 - x1;
- height = y2 - y1;
- }
- else
+ if (preview->area)
{
- width = gimp_drawable_width (priv->drawable_ID);
- height = gimp_drawable_height (priv->drawable_ID);
- }
+ GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
+ gint size;
+ gint width, height;
+ gint x1, y1;
+ gint x2, y2;
- if (width > height)
- {
- preview->width = MIN (width, size);
- preview->height = (height * preview->width) / width;
- }
- else
- {
- preview->height = MIN (height, size);
- preview->width = (width * preview->height) / height;
- }
+ gtk_widget_style_get (widget, "size", &size, NULL);
+
+ if (_gimp_drawable_preview_get_bounds (priv->drawable_ID,
+ &x1, &y1, &x2, &y2))
+ {
+ width = x2 - x1;
+ height = y2 - y1;
+ }
+ else
+ {
+ width = gimp_drawable_width (priv->drawable_ID);
+ height = gimp_drawable_height (priv->drawable_ID);
+ }
- gtk_widget_set_size_request (preview->area,
- preview->width, preview->height);
+ if (width > height)
+ {
+ preview->width = MIN (width, size);
+ preview->height = (height * preview->width) / width;
+ }
+ else
+ {
+ preview->height = MIN (height, size);
+ preview->width = (width * preview->height) / height;
+ }
+
+ gtk_widget_set_size_request (preview->area,
+ preview->width, preview->height);
+ }
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]