diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-27 16:28:11 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-27 16:38:22 +0800 |
commit | 5ef40a9e35ff8c558d423e1bb5b48d6554f72f31 (patch) | |
tree | df021e799a24f00f879a244fe24759f62c47007d | |
parent | 900cbf83e3373abb5143dda986c1a1bced308948 (diff) | |
download | gsoc2013-empathy-5ef40a9e35ff8c558d423e1bb5b48d6554f72f31.tar.gz gsoc2013-empathy-5ef40a9e35ff8c558d423e1bb5b48d6554f72f31.tar.zst gsoc2013-empathy-5ef40a9e35ff8c558d423e1bb5b48d6554f72f31.zip |
import-widget: request the preferred height of the treeview
We should try to display as much rows as possible.
https://bugzilla.gnome.org/show_bug.cgi?id=672839
-rw-r--r-- | src/empathy-import-dialog.ui | 3 | ||||
-rw-r--r-- | src/empathy-import-widget.c | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/empathy-import-dialog.ui b/src/empathy-import-dialog.ui index ce7a56a74..2cc9207ba 100644 --- a/src/empathy-import-dialog.ui +++ b/src/empathy-import-dialog.ui @@ -6,7 +6,7 @@ <property name="visible">True</property> <property name="spacing">2</property> <child> - <object class="GtkScrolledWindow" id="scrolledwindow17"> + <object class="GtkScrolledWindow" id="scrolledwindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">never</property> @@ -14,7 +14,6 @@ <property name="shadow_type">in</property> <child> <object class="GtkTreeView" id="treeview"> - <property name="height_request">200</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="enable_search">False</property> diff --git a/src/empathy-import-widget.c b/src/empathy-import-widget.c index 40956f9ee..6a2d24a81 100644 --- a/src/empathy-import-widget.c +++ b/src/empathy-import-widget.c @@ -62,6 +62,7 @@ enum { typedef struct { GtkWidget *vbox; GtkWidget *treeview; + GtkWidget *scrolledwindow; GList *accounts; EmpathyImportApplication app_id; @@ -91,6 +92,8 @@ import_widget_account_id_in_list (GList *accounts, return FALSE; } +#define MAX_TREEVIEW_HEIGHT 300 + static void import_widget_add_accounts_to_model (EmpathyImportWidget *self) { @@ -99,6 +102,7 @@ import_widget_add_accounts_to_model (EmpathyImportWidget *self) GtkTreeIter iter; GList *l; EmpathyImportWidgetPriv *priv = GET_PRIV (self); + gint min, natural; manager = tp_account_manager_dup (); @@ -141,6 +145,11 @@ import_widget_add_accounts_to_model (EmpathyImportWidget *self) } + /* Display as much rows as possible */ + gtk_widget_get_preferred_height (priv->treeview, &min, &natural); + gtk_widget_set_size_request (priv->scrolledwindow, -1, + MIN (natural, MAX_TREEVIEW_HEIGHT)); + g_object_unref (manager); } @@ -434,6 +443,7 @@ do_constructed (GObject *obj) gui = empathy_builder_get_file (filename, "widget_vbox", &priv->vbox, "treeview", &priv->treeview, + "scrolledwindow", &priv->scrolledwindow, NULL); g_free (filename); |