[patch] xfce4-panel add items dialog info label

Adriano Winter Bess awbess at gmail.com
Mon Mar 13 22:44:37 CET 2006


Hi,

I've noticed lately that the info label on xfce4-panel add items dialog seems to
wrap line too "early", please see the following screenshot:

http://www.das.ufsc.br/~adrianob/add-items-dialog.png

Certainly the words "by" and "dragging" should have been displayed on the first
line. The attached patch is a suggestion to fix this; I'm not really sure this
is the best way to do it. Actually I thought GTK was capable of handling this by
itself.

Regards,
Adriano
-- 
Adriano Winter Bess

-------------- next part --------------
Index: panel/panel-dialogs.c
===================================================================
--- panel/panel-dialogs.c	(revis??o 20398)
+++ panel/panel-dialogs.c	(c??pia de trabalho)
@@ -548,13 +548,20 @@
     gtk_dialog_response (GTK_DIALOG (pid->dlg), GTK_RESPONSE_CANCEL);
 }
 
+static void
+info_label_resized (GtkWidget *label, GtkAllocation *alloc, gpointer dummy)
+{
+    gtk_widget_set_size_request (label, alloc->width, -1);
+}
+
 void
 add_items_dialog (GPtrArray *panels, GtkWidget *active_item)
 {
     PanelItemsDialog *pid;
     Panel *panel;
-    GtkWidget *dlg, *header, *vbox, *img, *hbox, *label;
+    GtkWidget *dlg, *header, *vbox, *img, *hbox, *label, *info_label;
     char *markup;
+    gulong signal;
     
     if (items_dialog_widget)
     {
@@ -616,8 +623,11 @@
 
     label = gtk_label_new (_("Drag items from the list to a panel or remove "
                              "them by dragging them back to the list."));
+    info_label = label;
     gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
     gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+    signal = g_signal_connect (label, "size-allocate",
+                               G_CALLBACK (info_label_resized), NULL);
     gtk_widget_show (label);
     gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
     
@@ -638,6 +648,7 @@
 
     xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (dlg));
     gtk_widget_show (dlg);
+    g_signal_handler_disconnect (info_label, signal);
 
     panel_app_register_dialog (dlg);
 }
-------------- 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/20060313/1f86274f/attachment.pgp>


More information about the Xfce4-dev mailing list