[gnumeric] GUI: Fix drop-down sizing.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Fix drop-down sizing.
- Date: Fri, 25 Oct 2013 21:32:44 +0000 (UTC)
commit 2829b876c7f638336a04c46acde12d84d3379442
Author: Morten Welinder <terra gnome org>
Date: Fri Oct 25 17:31:22 2013 -0400
GUI: Fix drop-down sizing.
When a scrolled window is needed, we fell for a gtk+ ABI break.
Moving sizing into a realize handler fixes things.
NEWS | 1 +
src/widgets/ChangeLog | 5 +++++
src/widgets/gnm-cell-combo-view.c | 36 ++++++++++++++++++++++++++++--------
3 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/NEWS b/NEWS
index acb3b51..435b036 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.12.9
Morten:
* Minor improvement to history dialog.
+ * Fix drop-down sizing (gtk+ regression). [#710749]
Xabier RodrÃguez Calvar:
* Fix dialog button order. [#710378]
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index a7833ab..fe2eb8f 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-25 Morten Welinder <terra gnome org>
+
+ * gnm-cell-combo-view.c (gnm_cell_combo_view_popdown): Move sizing
+ to realize handler. Fixes #710749.
+
2013-10-07 Morten Welinder <terra gnome org>
* Release 1.12.8
diff --git a/src/widgets/gnm-cell-combo-view.c b/src/widgets/gnm-cell-combo-view.c
index 27cf44d..02788b7 100644
--- a/src/widgets/gnm-cell-combo-view.c
+++ b/src/widgets/gnm-cell-combo-view.c
@@ -261,6 +261,23 @@ static void cb_ccombo_button_pressed (SheetObjectView *sov) { gnm_cell_combo_vie
static void cb_ccombo_ok_button (GtkTreeView *list) { ccombo_activate (list, TRUE); }
static void cb_ccombo_cancel_button (GtkWidget *list) { ccombo_popup_destroy (list); }
+static void
+cb_realize_treeview (GtkWidget *list, GtkWidget *sw)
+{
+ GtkRequisition req;
+ GdkRectangle rect;
+ GtkTreePath *clip = g_object_get_data (G_OBJECT (list), "clip");
+
+ gtk_widget_get_preferred_size (GTK_WIDGET (list), &req, NULL);
+
+ gtk_tree_view_get_background_area (GTK_TREE_VIEW (list),
+ clip, NULL, &rect);
+
+ gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), req.width);
+
+ gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), rect.y);
+}
+
/**
* gnm_cell_combo_view_popdown:
* @sov: #SheetObjectView
@@ -280,7 +297,6 @@ gnm_cell_combo_view_popdown (SheetObjectView *sov, guint32 activate_time)
int root_x, root_y;
gboolean make_buttons = FALSE;
GtkTreePath *clip = NULL, *select = NULL;
- GtkRequisition req;
GtkWindow *toplevel = wbcg_toplevel (scg_wbcg (scg));
GdkWindow *popup_window;
GdkDevice *device;
@@ -299,7 +315,6 @@ gnm_cell_combo_view_popdown (SheetObjectView *sov, guint32 activate_time)
list = ccombo_create_list (GNM_CCOMBO_VIEW (sov), so, &clip, &select, &make_buttons);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (list), FALSE);
- gtk_widget_get_preferred_size (GTK_WIDGET (list), &req, NULL);
g_object_set_data (G_OBJECT (list), SOV_ID, sov);
frame = gtk_frame_new (NULL);
@@ -310,20 +325,25 @@ gnm_cell_combo_view_popdown (SheetObjectView *sov, guint32 activate_time)
g_printerr (" : so = %p, view = %p\n", so, view);
#endif
if (clip != NULL) {
- GdkRectangle rect;
GtkWidget *sw = gtk_scrolled_window_new (
gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (list)),
gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (list)));
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS);
- gtk_tree_view_get_background_area (GTK_TREE_VIEW (list),
- clip, NULL, &rect);
- gtk_tree_path_free (clip);
+ g_object_set_data_full (G_OBJECT (list),
+ "clip", clip,
+ (GDestroyNotify)gtk_tree_path_free);
- gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), req.width);
- gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), rect.y);
gtk_container_add (GTK_CONTAINER (sw), list);
+
+ /*
+ * Do the sizing in a realize handler as newer versions of
+ * gtk+ give us zero sizes until then.
+ */
+ g_signal_connect_after (list, "realize",
+ G_CALLBACK (cb_realize_treeview),
+ sw);
container = sw;
} else
container = list;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]