Bug #700249 - Progress dialog does not wrap

This commit is contained in:
Arx Cruz 2014-10-22 15:35:22 +02:00
parent 210b073bcd
commit b5460887fb
3 changed files with 49 additions and 31 deletions

View File

@ -156,7 +156,6 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
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);

View File

@ -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));

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100</property>
<property name="step_increment">1</property>
@ -21,7 +21,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area11">
<object class="GtkHButtonBox" id="dialog-action_area11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -127,7 +127,7 @@
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area5">
<object class="GtkHButtonBox" id="dialog-action_area5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -239,7 +239,7 @@
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area2">
<object class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -370,7 +370,7 @@
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area4">
<object class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -474,7 +474,7 @@
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area7">
<object class="GtkHButtonBox" id="dialog-action_area7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -518,7 +518,7 @@
<property name="can_focus">False</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-error</property>
<property name="icon_size">6</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="expand">True</property>
@ -571,7 +571,7 @@
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area12">
<object class="GtkHButtonBox" id="dialog-action_area12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -666,6 +666,12 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
@ -707,7 +713,7 @@
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area3">
<object class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -746,7 +752,7 @@
<property name="can_focus">False</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-info</property>
<property name="icon_size">6</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="expand">True</property>
@ -795,7 +801,7 @@
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area6">
<object class="GtkHButtonBox" id="dialog-action_area6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -851,6 +857,7 @@
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Running...</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -885,7 +892,7 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@ -909,7 +916,7 @@
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="zenity_question_button_box">
<object class="GtkHButtonBox" id="zenity_question_button_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -934,7 +941,7 @@
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-question</property>
<property name="icon_size">6</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="expand">False</property>
@ -981,7 +988,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area8">
<object class="GtkHButtonBox" id="dialog-action_area8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -1047,15 +1054,11 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="expand">True</property>
<child>
<object class="GtkTreeView" id="zenity_tree_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child>
</object>
@ -1092,7 +1095,7 @@
<property name="can_focus">False</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkVButtonBox" id="dialog-action_area1">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
@ -1133,7 +1136,7 @@
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">6</property>
<property name="icon-size">6</property>
</object>
<packing>
<property name="expand">False</property>