/* empathy-import-widget.c */
-#include <config.h>
-
-#include "empathy-import-dialog.h"
+#include "config.h"
#include "empathy-import-widget.h"
-#include "empathy-import-pidgin.h"
-
-#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
-#include <libempathy/empathy-debug.h>
-#include <libempathy/empathy-connection-managers.h>
-#include <libempathy/empathy-utils.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
+#include <glib/gi18n-lib.h>
-#include <telepathy-glib/account-manager.h>
-#include <telepathy-glib/util.h>
+#include "empathy-import-dialog.h"
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
-#include <glib/gi18n-lib.h>
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
G_DEFINE_TYPE (EmpathyImportWidget, empathy_import_widget, G_TYPE_OBJECT)
typedef struct {
GtkWidget *vbox;
GtkWidget *treeview;
+ GtkWidget *scrolledwindow;
GList *accounts;
EmpathyImportApplication app_id;
return FALSE;
}
+#define MAX_TREEVIEW_HEIGHT 300
+
static void
import_widget_add_accounts_to_model (EmpathyImportWidget *self)
{
TpAccountManager *manager;
GtkTreeModel *model;
- GtkTreeIter iter;
GList *l;
EmpathyImportWidgetPriv *priv = GET_PRIV (self);
+ gint min, natural;
manager = tp_account_manager_dup ();
value = g_hash_table_lookup (data->settings, "account");
- accounts = tp_account_manager_get_valid_accounts (manager);
+ accounts = tp_account_manager_dup_valid_accounts (manager);
/* Only set the "Import" cell to be active if there isn't already an
* account set up with the same account id. */
import = !import_widget_account_id_in_list (accounts,
g_value_get_string (value));
- g_list_free (accounts);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ g_list_free_full (accounts, g_object_unref);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, -1,
COL_IMPORT, import,
COL_PROTOCOL, data->protocol,
COL_NAME, g_value_get_string (value),
}
+ /* 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);
}
gui = empathy_builder_get_file (filename,
"widget_vbox", &priv->vbox,
"treeview", &priv->treeview,
+ "scrolledwindow", &priv->scrolledwindow,
NULL);
g_free (filename);