[gimp/gtk3-port: 172/274] 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: 172/274] Implement GtkWidget::style_updated() instead of ::style_set()
- Date: Tue, 1 May 2018 21:41:26 +0000 (UTC)
commit adf947f27f1f4c58a25d7654a57840d5bf6246c4
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 | 18 ++---
app/widgets/gimpcolorframe.c | 20 ++---
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, 219 insertions(+), 233 deletions(-)
---
diff --git a/app/widgets/gimpcoloreditor.c b/app/widgets/gimpcoloreditor.c
index 49a009a..24ac25b 100644
--- a/app/widgets/gimpcoloreditor.c
+++ b/app/widgets/gimpcoloreditor.c
@@ -65,8 +65,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);
@@ -117,12 +116,12 @@ gimp_color_editor_class_init (GimpColorEditorClass* klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->constructed = gimp_color_editor_constructed;
- 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->constructed = gimp_color_editor_constructed;
+ 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",
@@ -499,12 +498,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 c9da26b..bd8895d 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -61,8 +61,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);
@@ -85,13 +84,13 @@ gimp_color_frame_class_init (GimpColorFrameClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->dispose = gimp_color_frame_dispose;
- 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->dispose = gimp_color_frame_dispose;
+ 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",
@@ -324,12 +323,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);
g_clear_object (&frame->number_layout);
}
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 583ba86..fc0662a 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;
@@ -332,12 +331,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);
g_clear_object (&view->layout);
g_clear_object (&view->cursor_layout);
diff --git a/app/widgets/gimpdataeditor.c b/app/widgets/gimpdataeditor.c
index def0d53..390fae1 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);
@@ -116,14 +115,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",
@@ -276,13 +275,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 44bd0ed..006649f 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -72,8 +72,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,
@@ -139,7 +139,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;
@@ -213,13 +213,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 373f830..f8caa98 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -112,8 +112,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);
@@ -151,7 +150,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;
@@ -183,6 +182,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;
@@ -405,12 +405,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,
@@ -931,8 +930,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 8bec13f..47bdc19 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -87,8 +87,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,
@@ -124,12 +123,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",
@@ -362,13 +361,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);
GimpGuiConfig *config = NULL;
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
if (editor->priv->ui_manager)
config = GIMP_GUI_CONFIG (editor->priv->ui_manager->gimp->config);
diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c
index 4988e13..e06fae1 100644
--- a/app/widgets/gimpitemtreeview.c
+++ b/app/widgets/gimpitemtreeview.c
@@ -105,8 +105,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);
@@ -248,7 +247,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;
@@ -526,8 +525,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;
@@ -607,7 +605,7 @@ gimp_item_tree_view_style_set (GtkWidget *widget,
"icon-name", GIMP_ICON_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 3044ff2..741ca94 100644
--- a/app/widgets/gimpsamplepointeditor.c
+++ b/app/widgets/gimpsamplepointeditor.c
@@ -61,8 +61,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);
@@ -106,7 +105,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;
@@ -233,20 +232,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_spacings (GTK_TABLE (editor->table), content_spacing);
- gtk_table_set_col_spacings (GTK_TABLE (editor->table), content_spacing);
+ gtk_widget_style_get (widget,
+ "content-spacing", &content_spacing,
+ NULL);
+
+ gtk_table_set_row_spacings (GTK_TABLE (editor->table), content_spacing);
+ gtk_table_set_col_spacings (GTK_TABLE (editor->table), content_spacing);
+ }
}
static void
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
index d07844f..f87dca6 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -78,9 +78,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_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel);
@@ -118,7 +116,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;
widget_class->hierarchy_changed = gimp_tool_palette_hierarchy_changed;
gtk_widget_class_install_style_property (widget_class,
@@ -241,15 +239,14 @@ 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;
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 f82815e..0be33bf 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));
@@ -263,41 +262,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 13fa4dc..e20aace 100644
--- a/libgimp/gimpdrawablepreview.c
+++ b/libgimp/gimpdrawablepreview.c
@@ -82,8 +82,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,
@@ -116,16 +115,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));
@@ -268,23 +267,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 468ce0a..33cdba2 100644
--- a/libgimp/gimpzoompreview.c
+++ b/libgimp/gimpzoompreview.c
@@ -90,8 +90,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);
@@ -143,20 +142,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));
@@ -411,46 +410,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]