From b5460887fb2b37d1f7aa2edc5dc53b86152cfb2a Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Wed, 22 Oct 2014 15:35:22 +0200 Subject: Bug #700249 - Progress dialog does not wrap --- src/msg.c | 13 ++++++------- src/progress.c | 20 ++++++++++++++++++-- src/zenity.ui | 47 +++++++++++++++++++++++++---------------------- 3 files changed, 49 insertions(+), 31 deletions(-) diff --git a/src/msg.c b/src/msg.c index 49137e38..4132ae98 100644 --- a/src/msg.c +++ b/src/msg.c @@ -149,13 +149,12 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) 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->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); diff --git a/src/progress.c b/src/progress.c index 185da2f2..3fd2c2ef 100644 --- a/src/progress.c +++ b/src/progress.c @@ -262,6 +262,12 @@ zenity_progress_read_info (ZenityProgressData *progress_data) } } +static void +zenity_text_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer data) +{ + gtk_widget_set_size_request (widget, allocation->width/2, -1); +} + void zenity_progress (ZenityData *data, ZenityProgressData *progress_data) { @@ -281,6 +287,8 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data) gtk_builder_connect_signals (builder, NULL); + text = gtk_builder_get_object (builder, "zenity_progress_text"); + dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_progress_dialog")); @@ -295,6 +303,16 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data) 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 { + g_signal_connect_after (G_OBJECT (text), "size-allocate", + G_CALLBACK (zenity_text_size_allocate), data); + g_signal_connect_after (G_OBJECT (progress_bar), "size-allocate", + G_CALLBACK (zenity_text_size_allocate), data); + } + if (data->modal) gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); @@ -312,8 +330,6 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data) gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON)); } - text = gtk_builder_get_object (builder, "zenity_progress_text"); - if (progress_data->dialog_text) gtk_label_set_markup (GTK_LABEL (text), g_strcompress (progress_data->dialog_text)); diff --git a/src/zenity.ui b/src/zenity.ui index 5b40e9e6..32cff725 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -1,7 +1,7 @@ - - + + 100 1 @@ -21,7 +21,7 @@ True False - + True False end @@ -127,7 +127,7 @@ False 2 - + True False end @@ -239,7 +239,7 @@ False 2 - + True False end @@ -370,7 +370,7 @@ False 2 - + True False end @@ -474,7 +474,7 @@ False 14 - + True False end @@ -518,7 +518,7 @@ False 0 gtk-dialog-error - 6 + 6 True @@ -571,7 +571,7 @@ False 2 - + True False end @@ -666,6 +666,12 @@ + + + + + + @@ -707,7 +713,7 @@ False 14 - + True False end @@ -746,7 +752,7 @@ False 0 gtk-dialog-info - 6 + 6 True @@ -795,7 +801,7 @@ False 2 - + True False end @@ -851,6 +857,7 @@ False 0 Running... + True False @@ -885,7 +892,7 @@ False - True + False 1 @@ -909,7 +916,7 @@ False 14 - + True False end @@ -934,7 +941,7 @@ 0 0 gtk-dialog-question - 6 + 6 False @@ -981,7 +988,7 @@ True False - + True False end @@ -1047,15 +1054,11 @@ True True in - True True True True - - - @@ -1092,7 +1095,7 @@ False 14 - + True False end @@ -1133,7 +1136,7 @@ 0 0 gtk-dialog-warning - 6 + 6 False -- cgit