[gimp/gtk3-port: 129/249] app: don't connect to "size-requst" because that's deprecated
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 129/249] app: don't connect to "size-requst" because that's deprecated
- Date: Mon, 21 Mar 2011 20:46:49 +0000 (UTC)
commit 073f883d05938ff153ed4f0542089ac850592736
Author: Michael Natterer <mitch gimp org>
Date: Fri Nov 19 14:00:33 2010 +0100
app: don't connect to "size-requst" because that's deprecated
Instead, connect to "style-set" and calculate the widget's size
request there. Also fix the label's offsets after whatever GTK+ text
drawing changes.
app/display/gimpstatusbar.c | 50 +++++++++++++++++++++++++------------------
1 files changed, 29 insertions(+), 21 deletions(-)
---
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index abf4c40..f6a8d40 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -73,8 +73,8 @@ static void gimp_statusbar_progress_iface_init (GimpProgressInterface *iface
static void gimp_statusbar_dispose (GObject *object);
static void gimp_statusbar_finalize (GObject *object);
-static void gimp_statusbar_hbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition,
+static void gimp_statusbar_hbox_style_set (GtkWidget *widget,
+ GtkStyle *prev_style,
GimpStatusbar *statusbar);
static GimpProgress *
@@ -186,9 +186,9 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
gtk_container_remove (GTK_CONTAINER (hbox), statusbar->label);
- g_signal_connect (hbox, "size-request",
- G_CALLBACK (gimp_statusbar_hbox_size_request),
- statusbar);
+ g_signal_connect_after (hbox, "style-set",
+ G_CALLBACK (gimp_statusbar_hbox_style_set),
+ statusbar);
statusbar->cursor_label = gtk_label_new ("8888, 8888");
gtk_misc_set_alignment (GTK_MISC (statusbar->cursor_label), 0.5, 0.5);
@@ -296,44 +296,47 @@ gimp_statusbar_finalize (GObject *object)
}
static void
-gimp_statusbar_hbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition,
- GimpStatusbar *statusbar)
+gimp_statusbar_hbox_style_set (GtkWidget *widget,
+ GtkStyle *prev_style,
+ GimpStatusbar *statusbar)
{
- GtkRequisition child_requisition;
- gint width = 0;
+ GtkRequisition requisition;
+ GtkRequisition child_requisition;
+ gint width = 0;
+ gint height;
+
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
+
+ height = requisition.height;
/* also consider the children which can be invisible */
gtk_widget_get_preferred_size (statusbar->cursor_label,
&child_requisition, NULL);
width += child_requisition.width;
- requisition->height = MAX (requisition->height,
- child_requisition.height);
+ height = MAX (height, child_requisition.height);
gtk_widget_get_preferred_size (statusbar->unit_combo,
&child_requisition, NULL);
width += child_requisition.width;
- requisition->height = MAX (requisition->height,
- child_requisition.height);
+ height = MAX (height, child_requisition.height);
gtk_widget_get_preferred_size (statusbar->scale_combo,
&child_requisition, NULL);
width += child_requisition.width;
- requisition->height = MAX (requisition->height,
- child_requisition.height);
+ height = MAX (height, child_requisition.height);
gtk_widget_get_preferred_size (statusbar->progressbar,
&child_requisition, NULL);
- requisition->height = MAX (requisition->height,
- child_requisition.height);
+ height = MAX (height, child_requisition.height);
gtk_widget_get_preferred_size (statusbar->cancel_button,
&child_requisition, NULL);
- requisition->height = MAX (requisition->height,
- child_requisition.height);
+ height = MAX (height, child_requisition.height);
+
+ width = MAX (requisition.width, width + 32);
- requisition->width = MAX (requisition->width, width + 32);
+ gtk_widget_set_size_request (widget, width, height);
}
static GimpProgress *
@@ -1327,10 +1330,15 @@ gimp_statusbar_label_draw (GtkWidget *widget,
if (statusbar->icon)
{
PangoRectangle rect;
+ GtkAllocation allocation;
gint x, y;
gtk_label_get_layout_offsets (GTK_LABEL (widget), &x, &y);
+ gtk_widget_get_allocation (widget, &allocation);
+ x -= allocation.x;
+ y -= allocation.y;
+
pango_layout_index_to_pos (gtk_label_get_layout (GTK_LABEL (widget)), 0,
&rect);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]