[zenity] Better sollution for wrap text
- From: Arx Henrique Pereira da Cruz <arxcruz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [zenity] Better sollution for wrap text
- Date: Wed, 22 Oct 2014 13:17:59 +0000 (UTC)
commit 210b073bcd4ee3d6d7a3c743ac407703cff60185
Author: Arx Cruz <arxcruz gnome org>
Date: Wed Oct 22 15:16:22 2014 +0200
Better sollution for wrap text
This fix is a better sollution for info, error, warning and
question dialog.
Now the dialog wraps the text properly, and don't allocate
a lot of height
src/msg.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/msg.c b/src/msg.c
index f287f25..49137e3 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -146,9 +146,17 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
break;
}
- if (data->width > -1 || data->height > -1)
+ if (data->width > -1 || data->height > -1)
gtk_window_set_default_size (GTK_WINDOW (dialog), data->width, data->height);
+ if (data->width > -1)
+ gtk_widget_set_size_request (GTK_WIDGET (text), data->width, -1);
+ else
+ if (!msg_data->ellipsize)
+ g_signal_connect_after (G_OBJECT (text), "size-allocate",
+ G_CALLBACK (zenity_text_size_allocate), data);
+
+
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
@@ -161,13 +169,10 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
if (msg_data->ellipsize)
gtk_label_set_ellipsize (GTK_LABEL(text), PANGO_ALIGN_RIGHT);
- else
- g_signal_connect_after (G_OBJECT (text), "size-allocate",
- G_CALLBACK (zenity_text_size_allocate), data);
-
+
if (msg_data->dialog_icon)
gtk_image_set_from_icon_name (GTK_IMAGE (image), msg_data->dialog_icon, GTK_ICON_SIZE_DIALOG);
-
+
if (msg_data->no_wrap)
gtk_label_set_line_wrap (GTK_LABEL (text), FALSE);
@@ -185,7 +190,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
static void
zenity_text_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
{
- gtk_widget_set_size_request (widget, allocation->width, -1);
+ gtk_widget_set_size_request (widget, allocation->width/2, -1);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]