[gtk+] widget: Emit initial style-set signal in the same situations as GTK2
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Emit initial style-set signal in the same situations as GTK2
- Date: Sat, 26 Mar 2011 23:55:34 +0000 (UTC)
commit fafee4e27645f2b9f819444ad8ce6fe1f67182b8
Author: Benjamin Otte <otte redhat com>
Date: Sat Mar 26 23:34:45 2011 +0100
widget: Emit initial style-set signal in the same situations as GTK2
This ensures that widgets that aren't ported and rely on the style-set
signal being emitted work as well as before. They should not rely on
style-set being emitted however.
Note that this function is a no-op if the initial style has been set
already and is very cheap if it has not been set yet. It only becomes
relevant if the resulting style actually gets used.
https://bugzilla.gnome.org/show_bug.cgi?id=639584
gtk/gtksizerequest.c | 2 ++
gtk/gtkwidget.c | 5 ++++-
2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index adc2187..4b379cc 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -339,6 +339,8 @@ compute_size_for_orientation (GtkWidget *widget,
{
gint adjusted_min, adjusted_natural, adjusted_for_size = for_size;
+ gtk_widget_ensure_style (widget);
+
if (orientation == GTK_SIZE_GROUP_HORIZONTAL)
{
if (for_size < 0)
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4c91548..7a58958 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -9201,6 +9201,8 @@ gtk_widget_render_icon (GtkWidget *widget,
GtkIconSize size,
const gchar *detail)
{
+ gtk_widget_ensure_style (widget);
+
return gtk_widget_render_icon_pixbuf (widget, stock_id, size);
}
@@ -10622,7 +10624,8 @@ gtk_widget_real_destroy (GtkWidget *object)
gtk_grab_remove (widget);
- g_object_unref (priv->style);
+ if (priv->style)
+ g_object_unref (priv->style);
priv->style = gtk_widget_get_default_style ();
g_object_ref (priv->style);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]