[patch] Re: mcs-manager dialog too wide

Adriano Winter Bess awbess at gmail.com
Tue Apr 4 03:21:00 CEST 2006


Hi,

I worked a bit on the xfce-mcs-manager settings dialog and I hope this time I
have a better solution, please see the patch attached. I'd like to ask you
please to test it against latest SVN and see if it works fine for your locale,
since I just can't test it against every possible existing locale.

Just to remember, this is how it looked like before the patch (in the pt_BR
locale):

http://www.das.ufsc.br/~adrianob/mcs-manager-dialog/pt_BR_before_patch.png

and this is how it looks like after applying the patch:

http://www.das.ufsc.br/~adrianob/mcs-manager-dialog/pt_BR.png

I've also made some screenshots using the patch for some other locales I have
installed on my machine:

fr:	http://www.das.ufsc.br/~adrianob/mcs-manager-dialog/fr.png
en:	http://www.das.ufsc.br/~adrianob/mcs-manager-dialog/en.png
ja:	http://www.das.ufsc.br/~adrianob/mcs-manager-dialog/ja.png

If we can agree on this patch for other locales too, I would like to ask devs to
consider reviewing and commiting it, since we are now closer to a release cycle
(betas, rcs, etc.) and in spite of being just aesthetic, it wouldn't be nice to
have such a wide dialog, which is a real concern for locales such as pt_BR.

Regards,
Adriano
-- 
Adriano Winter Bess

-------------- next part --------------
Index: xfce-mcs-manager/xfce-mcs-dialog.c
===================================================================
--- xfce-mcs-manager/xfce-mcs-dialog.c	(revis??o 20740)
+++ xfce-mcs-manager/xfce-mcs-dialog.c	(c??pia de trabalho)
@@ -54,6 +54,8 @@
 
 #define MAX_COLUMNS 4
 
+#define MAX_WIDTH_FACTOR 2
+
 /*
  * To improve the responsiveness of the UI
  */
@@ -94,6 +96,7 @@
 create_settings_button (GdkPixbuf *pb, const char *text)
 {
     GtkWidget *button, *vbox, *image, *label;
+    GtkRequisition imgreq, labreq;
 
     g_return_val_if_fail (text != NULL, NULL);
     
@@ -107,14 +110,21 @@
     if (pb && (image = gtk_image_new_from_pixbuf (pb)))
     {
 	gtk_widget_show (image);
-	gtk_box_pack_start (GTK_BOX (vbox), image, TRUE, TRUE, 0);
+	gtk_widget_size_request (image, &imgreq);
+	gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
     }
 
     label = gtk_label_new (text);
     gtk_widget_show (label);
-    gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-    gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+    gtk_widget_size_request (label, &labreq);
+    gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
 
+    if (labreq.width > MAX_WIDTH_FACTOR*(labreq.height+imgreq.height)) {
+	gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
+	gtk_widget_set_size_request (label, MAX_WIDTH_FACTOR*(labreq.height+imgreq.height), -1);
+    }
+
     return button;
 }
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20060403/e1721d6b/attachment.pgp>


More information about the Xfce4-dev mailing list