summaryrefslogtreecommitdiffstats
path: root/src/gtk-helpers/autowrapped_label.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-04-23 21:59:50 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2011-04-23 21:59:50 +0200
commit0faa49bfc8378d430a7e7d1c42f078a889762c5b (patch)
tree17120dc4360d8b3baa26f734209ece64db2007d5 /src/gtk-helpers/autowrapped_label.c
parent042d62126a0ca8b6b9d2fb4d417f07691be90536 (diff)
downloadabrt-0faa49bfc8378d430a7e7d1c42f078a889762c5b.tar.gz
abrt-0faa49bfc8378d430a7e7d1c42f078a889762c5b.tar.xz
abrt-0faa49bfc8378d430a7e7d1c42f078a889762c5b.zip
wizard: make all suitably set up labels autowrappable
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/gtk-helpers/autowrapped_label.c')
-rw-r--r--src/gtk-helpers/autowrapped_label.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gtk-helpers/autowrapped_label.c b/src/gtk-helpers/autowrapped_label.c
index 4406be26..b378f29a 100644
--- a/src/gtk-helpers/autowrapped_label.c
+++ b/src/gtk-helpers/autowrapped_label.c
@@ -74,3 +74,34 @@ void make_label_autowrap_on_resize(GtkLabel *label)
// So far, only tested to work on labels which were set up as:
//gtk_box_pack_start(box, label, /*expand*/ false, /*fill*/ false, /*padding*/ 0);
}
+
+static void fixer(GtkWidget *widget, gpointer data_unused)
+{
+ if (GTK_IS_CONTAINER(widget))
+ {
+ gtk_container_foreach((GtkContainer*)widget, fixer, NULL);
+ return;
+ }
+ if (GTK_IS_LABEL(widget))
+ {
+ GtkLabel *label = (GtkLabel*)widget;
+ //const char *txt = gtk_label_get_label(label);
+ GtkMisc *misc = (GtkMisc*)widget;
+ gfloat yalign; //= 1;
+ gint ypad; //= 1;
+ if (gtk_label_get_line_wrap(label)
+ && (gtk_misc_get_alignment(misc, NULL, &yalign), yalign == 0)
+ && (gtk_misc_get_padding(misc, NULL, &ypad), ypad == 0)
+ ) {
+ //log("label '%s' set to wrap", txt);
+ make_label_autowrap_on_resize(label);
+ return;
+ }
+ //log("label '%s' not set to wrap %g %d", txt, yalign, ypad);
+ }
+}
+
+void fix_all_wrapped_labels(GtkWidget *widget)
+{
+ fixer(widget, NULL);
+}