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/progress.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/progress.c') 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)); -- cgit