summaryrefslogtreecommitdiff
path: root/src/progress.c
diff options
context:
space:
mode:
authorArx Cruz <arxcruz@gnome.org>2014-10-22 15:35:22 +0200
committerArx Cruz <arxcruz@gnome.org>2014-10-22 15:35:22 +0200
commitb5460887fb2b37d1f7aa2edc5dc53b86152cfb2a (patch)
treed4cba40ad82b0cd3d68edae2ee397a7b96a366dd /src/progress.c
parentBetter sollution for wrap text (diff)
downloadzenity-b5460887fb2b37d1f7aa2edc5dc53b86152cfb2a.tar.gz
zenity-b5460887fb2b37d1f7aa2edc5dc53b86152cfb2a.tar.bz2
zenity-b5460887fb2b37d1f7aa2edc5dc53b86152cfb2a.zip
Bug #700249 - Progress dialog does not wrap
Diffstat (limited to 'src/progress.c')
-rw-r--r--src/progress.c20
1 files changed, 18 insertions, 2 deletions
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));
bgstack15