Author: rpmcruz
Date: Wed Oct 8 05:14:07 2008
New Revision: 51949
URL: http://svn.opensuse.org/viewcvs/yast?rev=51949&view=rev
Log:
* src/ygtkwizard.c: bug fix 432399: dismiss horizontal SizeGroup when
not enough width is available.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/ygtkwizard.c
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=51949&r1=51948&r2=51949&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Wed Oct 8 05:14:07 2008
@@ -25,6 +25,9 @@
* src/YGDialog.cc: bug fix 428965: enable setSize() code.
+ * src/ygtkwizard.c: bug fix 432399: dismiss horizontal SizeGroup when
+ not enough width is available.
+
2008-10-06 Ricardo Cruz
* src/ygtkwizard.h/.c: collapse all button functions and accept button
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=51949&r1=51948&r2=51949&view=diff
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Wed Oct 8 05:14:07 2008
@@ -425,6 +425,29 @@
static void more_clicked_cb (YGtkWizardHeader *header, YGtkWizard *wizard)
{ ygtk_wizard_popup_help (wizard); }
+/* We must dishonor the size group if the space doesn't afford it. */
+
+static void buttons_size_allocate_cb (GtkWidget *box, GtkAllocation *alloc,
+ GtkSizeGroup *group)
+{
+ GSList *buttons = gtk_size_group_get_widgets (group), *i;
+ int max_width = 0, total = 0;
+ for (i = buttons; i; i = i->next) {
+ if (!GTK_WIDGET_VISIBLE (i->data))
+ continue;
+ GtkRequisition req;
+ gtk_widget_get_child_requisition ((GtkWidget *) i->data, &req);
+ max_width = MAX (max_width, req.width);
+ total++;
+ }
+ int spacing = gtk_box_get_spacing (GTK_BOX (box));
+ int width = max_width*total + (total ? spacing*(total-1) : 0);
+ GtkSizeGroupMode new_mode = width > alloc->width ?
+ GTK_SIZE_GROUP_VERTICAL : GTK_SIZE_GROUP_BOTH;
+ if (gtk_size_group_get_mode (group) != new_mode)
+ gtk_size_group_set_mode (group, new_mode);
+}
+
G_DEFINE_TYPE (YGtkWizard, ygtk_wizard, GTK_TYPE_VBOX)
static void ygtk_wizard_init (YGtkWizard *wizard)
@@ -468,8 +491,9 @@
gtk_size_group_add_widget (buttons_group, wizard->next_button);
gtk_size_group_add_widget (buttons_group, wizard->back_button);
gtk_size_group_add_widget (buttons_group, wizard->abort_button);
- g_object_unref (G_OBJECT (buttons_group));
-
+ g_object_unref (G_OBJECT (buttons_group));
+ g_signal_connect_after (G_OBJECT (wizard->m_buttons), "size-allocate",
+ G_CALLBACK (buttons_size_allocate_cb), buttons_group);
//** The menu and the navigation widgets will be created when requested.
// space for them
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org