aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-06-07 21:35:11 +0800
committerJonny Lamb <jonny.lamb@collabora.co.uk>2009-06-07 21:35:11 +0800
commitd440d9ab734b45ffc651750a3d317e299c851821 (patch)
tree493f500033de665dae1e35f5c96ddb798fb198c3
parent396aff97047f039c5bca8f3a0da13b9b295e657b (diff)
parent138ec18cd4c9deafd20d4e0b08c4d3dab07f7c10 (diff)
downloadgsoc2013-empathy-d440d9ab734b45ffc651750a3d317e299c851821.tar
gsoc2013-empathy-d440d9ab734b45ffc651750a3d317e299c851821.tar.gz
gsoc2013-empathy-d440d9ab734b45ffc651750a3d317e299c851821.tar.bz2
gsoc2013-empathy-d440d9ab734b45ffc651750a3d317e299c851821.tar.lz
gsoc2013-empathy-d440d9ab734b45ffc651750a3d317e299c851821.tar.xz
gsoc2013-empathy-d440d9ab734b45ffc651750a3d317e299c851821.tar.zst
gsoc2013-empathy-d440d9ab734b45ffc651750a3d317e299c851821.zip
Merge branch 'profile-chooser'
-rw-r--r--docs/libempathy-gtk/libempathy-gtk.types1
-rw-r--r--libempathy-gtk/empathy-profile-chooser.c425
-rw-r--r--libempathy-gtk/empathy-profile-chooser.h51
-rw-r--r--python/pyempathygtk/pyempathygtk.defs24
-rw-r--r--src/empathy-accounts-dialog.c9
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/test-empathy-profile-chooser.c31
8 files changed, 353 insertions, 193 deletions
diff --git a/docs/libempathy-gtk/libempathy-gtk.types b/docs/libempathy-gtk/libempathy-gtk.types
index 347cbba90..9f3642193 100644
--- a/docs/libempathy-gtk/libempathy-gtk.types
+++ b/docs/libempathy-gtk/libempathy-gtk.types
@@ -21,6 +21,7 @@ empathy_contact_widget_flags_get_type
empathy_gst_video_src_channel_get_type
empathy_sound_get_type
empathy_presence_chooser_get_type
+empathy_profile_chooser_get_type
empathy_smiley_manager_get_type
empathy_status_preset_dialog_get_type
empathy_theme_boxes_get_type
diff --git a/libempathy-gtk/empathy-profile-chooser.c b/libempathy-gtk/empathy-profile-chooser.c
index 14965741c..b3cbf90d0 100644
--- a/libempathy-gtk/empathy-profile-chooser.c
+++ b/libempathy-gtk/empathy-profile-chooser.c
@@ -1,6 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2009 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Xavier Claessens <xclaesse@gmail.com>
+ * Jonny Lamb <jonny.lamb@collabora.co.uk>
*/
#include <config.h>
@@ -27,6 +28,8 @@
#include <libmissioncontrol/mc-profile.h>
#include <libmissioncontrol/mc-protocol.h>
+#include <libempathy/empathy-utils.h>
+
#include "empathy-profile-chooser.h"
#include "empathy-ui-utils.h"
@@ -34,112 +37,277 @@
* SECTION:empathy-profile-chooser
* @title: EmpathyProfileChooser
* @short_description: A widget used to choose from a list of profiles
- * @include: libempathy-gtk/empathy-account-chooser.h
+ * @include: libempathy-gtk/empathy-profile-chooser.h
*
- * #EmpathyProfileChooser is a widget which provides a chooser of available
+ * #EmpathyProfileChooser is a widget which extends #GtkComboBox to provides a
+ * chooser of available profiles.
+ */
+
+/**
+ * EmpathyProfileChooser:
+ * @parent: parent object
+ *
+ * Widget which extends #GtkComboBox to provide a chooser of available
* profiles.
*/
-enum {
- COL_ICON,
- COL_LABEL,
- COL_PROFILE,
- COL_COUNT
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyProfileChooser)
+typedef struct
+{
+ GtkListStore *store;
+ gboolean dispose_run;
+} EmpathyProfileChooserPriv;
+
+enum
+{
+ COL_ICON,
+ COL_LABEL,
+ COL_PROFILE,
+ COL_COUNT
};
+G_DEFINE_TYPE (EmpathyProfileChooser, empathy_profile_chooser,
+ GTK_TYPE_COMBO_BOX);
+
+static gint
+profile_chooser_sort_profile_value (McProfile *profile)
+{
+ guint i;
+ const gchar *profile_name;
+ const gchar *names[] = {
+ "jabber",
+ "salut",
+ "gtalk",
+ NULL
+ };
+
+ profile_name = mc_profile_get_unique_name (profile);
+
+ for (i = 0 ; names[i]; i++)
+ {
+ if (strcmp (profile_name, names[i]) == 0)
+ return i;
+ }
+
+ return i;
+}
+
+static gint
+profile_chooser_sort_func (GtkTreeModel *model,
+ GtkTreeIter *iter_a,
+ GtkTreeIter *iter_b,
+ gpointer user_data)
+{
+ McProfile *profile_a;
+ McProfile *profile_b;
+ gint cmp;
+
+ gtk_tree_model_get (model, iter_a,
+ COL_PROFILE, &profile_a,
+ -1);
+ gtk_tree_model_get (model, iter_b,
+ COL_PROFILE, &profile_b,
+ -1);
+
+ cmp = profile_chooser_sort_profile_value (profile_a);
+ cmp -= profile_chooser_sort_profile_value (profile_b);
+ if (cmp == 0)
+ {
+ cmp = strcmp (mc_profile_get_display_name (profile_a),
+ mc_profile_get_display_name (profile_b));
+ }
+
+ g_object_unref (profile_a);
+ g_object_unref (profile_b);
+
+ return cmp;
+}
+
+static void
+profile_chooser_constructed (GObject *object)
+{
+ EmpathyProfileChooser *profile_chooser;
+ EmpathyProfileChooserPriv *priv;
+
+ GList *profiles, *l, *seen;
+ GtkCellRenderer *renderer;
+ GtkTreeIter iter;
+ gboolean iter_set = FALSE;
+ McManager *btf_cm;
+
+ priv = GET_PRIV (object);
+ profile_chooser = EMPATHY_PROFILE_CHOOSER (object);
+
+ /* set up combo box with new store */
+ priv->store = gtk_list_store_new (COL_COUNT,
+ G_TYPE_STRING, /* Icon name */
+ G_TYPE_STRING, /* Label */
+ MC_TYPE_PROFILE); /* Profile */
+
+ gtk_combo_box_set_model (GTK_COMBO_BOX (object),
+ GTK_TREE_MODEL (priv->store));
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
+ "icon-name", COL_ICON,
+ NULL);
+ g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), renderer,
+ "text", COL_LABEL,
+ NULL);
+
+ btf_cm = mc_manager_lookup ("butterfly");
+ profiles = mc_profiles_list ();
+ seen = NULL;
+ for (l = profiles; l; l = g_list_next (l))
+ {
+ McProfile *profile;
+ McProtocol *protocol;
+ const gchar *unique_name;
+
+ profile = l->data;
+
+ /* Check if the CM is installed, otherwise skip that profile.
+ * Workaround SF bug #1688779 */
+ protocol = mc_profile_get_protocol (profile);
+ if (!protocol)
+ continue;
+
+ g_object_unref (protocol);
+
+ /* Skip MSN-Haze if we have butterfly */
+ unique_name = mc_profile_get_unique_name (profile);
+ if (btf_cm && strcmp (unique_name, "msn-haze") == 0)
+ continue;
+
+ if (g_list_find_custom (seen, unique_name, (GCompareFunc) strcmp))
+ continue;
+
+ seen = g_list_append (seen, (char *) unique_name);
+
+ gtk_list_store_insert_with_values (priv->store, &iter, 0,
+ COL_ICON, mc_profile_get_icon_name (profile),
+ COL_LABEL, mc_profile_get_display_name (profile),
+ COL_PROFILE, profile,
+ -1);
+ iter_set = TRUE;
+ }
+
+ g_list_free (seen);
+
+ if (btf_cm)
+ g_object_unref (btf_cm);
+
+ /* Set the profile sort function */
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
+ COL_PROFILE,
+ profile_chooser_sort_func,
+ NULL, NULL);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
+ COL_PROFILE,
+ GTK_SORT_ASCENDING);
+
+ if (iter_set)
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
+
+ mc_profiles_free_list (profiles);
+
+ if (G_OBJECT_CLASS (empathy_profile_chooser_parent_class)->constructed)
+ G_OBJECT_CLASS (empathy_profile_chooser_parent_class)->constructed (object);
+}
+
+static void
+empathy_profile_chooser_init (EmpathyProfileChooser *profile_chooser)
+{
+ EmpathyProfileChooserPriv *priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (profile_chooser,
+ EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooserPriv);
+
+ priv->dispose_run = FALSE;
+
+ profile_chooser->priv = priv;
+}
+
+static void
+profile_chooser_dispose (GObject *object)
+{
+ EmpathyProfileChooser *profile_chooser = EMPATHY_PROFILE_CHOOSER (object);
+ EmpathyProfileChooserPriv *priv = GET_PRIV (profile_chooser);
+
+ if (priv->dispose_run)
+ return;
+
+ priv->dispose_run = TRUE;
+
+ if (priv->store)
+ {
+ g_object_unref (priv->store);
+ priv->store = NULL;
+ }
+
+ (G_OBJECT_CLASS (empathy_profile_chooser_parent_class)->dispose) (object);
+}
+
+static void
+empathy_profile_chooser_class_init (EmpathyProfileChooserClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructed = profile_chooser_constructed;
+ object_class->dispose = profile_chooser_dispose;
+
+ g_type_class_add_private (object_class, sizeof (EmpathyProfileChooserPriv));
+}
+
/**
* empathy_profile_chooser_dup_selected:
- * @widget: an #EmpathyProfileChooser
+ * @profile_chooser: an #EmpathyProfileChooser
*
- * Returns a new reference to the selected #McProfile in @widget. The returned
- * #McProfile should be unrefed with g_object_unref() when finished with.
+ * Returns a new reference to the selected #McProfile in @profile_chooser. The
+ * returned #McProfile should be unrefed with g_object_unref() when finished
+ * with.
*
* Return value: a new reference to the selected #McProfile
*/
McProfile *
-empathy_profile_chooser_dup_selected (GtkWidget *widget)
+empathy_profile_chooser_dup_selected (EmpathyProfileChooser *profile_chooser)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- McProfile *profile = NULL;
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) {
- gtk_tree_model_get (model, &iter,
- COL_PROFILE, &profile,
- -1);
- }
-
- return profile;
+ EmpathyProfileChooserPriv *priv = GET_PRIV (profile_chooser);
+ GtkTreeIter iter;
+ McProfile *profile = NULL;
+
+ g_return_val_if_fail (EMPATHY_IS_PROFILE_CHOOSER (profile_chooser), NULL);
+
+ if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (profile_chooser), &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+ COL_PROFILE, &profile,
+ -1);
+ }
+
+ return profile;
}
/**
* empathy_profile_chooser_n_profiles:
- * @widget: an #EmpathyProfileChooser
+ * @profile_chooser: an #EmpathyProfileChooser
*
- * Returns the number of profiles in @widget.
+ * Returns the number of profiles in @profile_chooser.
*
- * Return value: the number of profiles in @widget
+ * Return value: the number of profiles in @profile_chooser
*/
gint
-empathy_profile_chooser_n_profiles (GtkWidget *widget)
+empathy_profile_chooser_n_profiles (EmpathyProfileChooser *profile_chooser)
{
- GtkTreeModel *model;
+ EmpathyProfileChooserPriv *priv = GET_PRIV (profile_chooser);
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
-
- return gtk_tree_model_iter_n_children (model, NULL);
-}
+ g_return_val_if_fail (EMPATHY_IS_PROFILE_CHOOSER (profile_chooser), 0);
-static gint
-profile_chooser_sort_profile_value (McProfile *profile)
-{
- guint i;
- const gchar *profile_name;
- const gchar *names[] = {"jabber",
- "salut",
- "gtalk",
- NULL};
-
- profile_name = mc_profile_get_unique_name (profile);
-
- for (i = 0 ; names[i]; i++) {
- if (strcmp (profile_name, names[i]) == 0) {
- return i;
- }
- }
-
- return i;
-}
-
-static gint
-profile_chooser_sort_func (GtkTreeModel *model,
- GtkTreeIter *iter_a,
- GtkTreeIter *iter_b,
- gpointer user_data)
-{
- McProfile *profile_a;
- McProfile *profile_b;
- gint cmp;
-
- gtk_tree_model_get (model, iter_a,
- COL_PROFILE, &profile_a,
- -1);
- gtk_tree_model_get (model, iter_b,
- COL_PROFILE, &profile_b,
- -1);
-
- cmp = profile_chooser_sort_profile_value (profile_a);
- cmp -= profile_chooser_sort_profile_value (profile_b);
- if (cmp == 0) {
- cmp = strcmp (mc_profile_get_display_name (profile_a),
- mc_profile_get_display_name (profile_b));
- }
-
- g_object_unref (profile_a);
- g_object_unref (profile_b);
-
- return cmp;
+ return gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL);
}
/**
@@ -152,94 +320,5 @@ profile_chooser_sort_func (GtkTreeModel *model,
GtkWidget *
empathy_profile_chooser_new (void)
{
- GList *profiles, *l, *seen;
- GtkListStore *store;
- GtkCellRenderer *renderer;
- GtkWidget *combo_box;
- GtkTreeIter iter;
- gboolean iter_set = FALSE;
- McManager *btf_cm;
-
- /* set up combo box with new store */
- store = gtk_list_store_new (COL_COUNT,
- G_TYPE_STRING, /* Icon name */
- G_TYPE_STRING, /* Label */
- MC_TYPE_PROFILE); /* Profile */
- combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
-
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
- "icon-name", COL_ICON,
- NULL);
- g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
- "text", COL_LABEL,
- NULL);
-
- btf_cm = mc_manager_lookup ("butterfly");
- profiles = mc_profiles_list ();
- seen = NULL;
- for (l = profiles; l; l = l->next) {
- McProfile *profile;
- McProtocol *protocol;
- const gchar *unique_name;
-
- profile = l->data;
-
- /* Check if the CM is installed, otherwise skip that profile.
- * Workaround SF bug #1688779 */
- protocol = mc_profile_get_protocol (profile);
- if (!protocol) {
- continue;
- }
- g_object_unref (protocol);
-
- /* Skip MSN-Haze if we have butterfly */
- unique_name = mc_profile_get_unique_name (profile);
- if (btf_cm && strcmp (unique_name, "msn-haze") == 0) {
- continue;
- }
-
- if (g_list_find_custom (seen, unique_name, (GCompareFunc) strcmp)) {
- continue;
- }
- seen = g_list_append (seen, (char *) unique_name);
-
- gtk_list_store_insert_with_values (store, &iter, 0,
- COL_ICON, mc_profile_get_icon_name (profile),
- COL_LABEL, mc_profile_get_display_name (profile),
- COL_PROFILE, profile,
- -1);
- iter_set = TRUE;
- }
-
- g_list_free (seen);
-
- if (btf_cm) {
- g_object_unref (btf_cm);
- }
-
- /* Set the profile sort function */
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
- COL_PROFILE,
- profile_chooser_sort_func,
- NULL, NULL);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
- COL_PROFILE,
- GTK_SORT_ASCENDING);
-
- if (iter_set) {
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
- }
-
- mc_profiles_free_list (profiles);
- g_object_unref (store);
-
- return combo_box;
+ return GTK_WIDGET (g_object_new (EMPATHY_TYPE_PROFILE_CHOOSER, NULL));
}
-
diff --git a/libempathy-gtk/empathy-profile-chooser.h b/libempathy-gtk/empathy-profile-chooser.h
index 74c761cc4..37d7241a9 100644
--- a/libempathy-gtk/empathy-profile-chooser.h
+++ b/libempathy-gtk/empathy-profile-chooser.h
@@ -1,6 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2009 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,18 +17,53 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Xavier Claessens <xclaesse@gmail.com>
+ * Jonny Lamb <jonny.lamb@collabora.co.uk
*/
-#ifndef __EMPATHY_PROTOCOL_CHOOSER_H__
-#define __EMPATHY_PROTOCOL_CHOOSER_H__
+#ifndef __EMPATHY_PROFILE_CHOOSER_H__
+#define __EMPATHY_PROFILE_CHOOSER_H__
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
#include <libmissioncontrol/mc-profile.h>
G_BEGIN_DECLS
-GtkWidget * empathy_profile_chooser_new (void);
-McProfile * empathy_profile_chooser_dup_selected (GtkWidget *widget);
-gint empathy_profile_chooser_n_profiles (GtkWidget *widget);
+#define EMPATHY_TYPE_PROFILE_CHOOSER (empathy_profile_chooser_get_type ())
+#define EMPATHY_PROFILE_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), \
+ EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooser))
+#define EMPATHY_PROFILE_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), \
+ EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooserClass))
+#define EMPATHY_IS_PROFILE_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
+ EMPATHY_TYPE_PROFILE_CHOOSER))
+#define EMPATHY_IS_PROFILE_CHOOSER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), \
+ EMPATHY_TYPE_PROFILE_CHOOSER))
+#define EMPATHY_PROFILE_CHOOSER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \
+ EMPATHY_TYPE_PROFILE_CHOOSER, EmpathyProfileChooserClass))
+
+typedef struct _EmpathyProfileChooser EmpathyProfileChooser;
+typedef struct _EmpathyProfileChooserClass EmpathyProfileChooserClass;
+
+struct _EmpathyProfileChooser
+{
+ GtkComboBox parent;
+
+ /*<private>*/
+ gpointer priv;
+};
+
+struct _EmpathyProfileChooserClass
+{
+ GtkComboBoxClass parent_class;
+};
+
+GType empathy_profile_chooser_get_type (void) G_GNUC_CONST;
+GtkWidget * empathy_profile_chooser_new (void);
+McProfile * empathy_profile_chooser_dup_selected (
+ EmpathyProfileChooser *profile_chooser);
+gint empathy_profile_chooser_n_profiles (
+ EmpathyProfileChooser *profile_chooser);
G_END_DECLS
-#endif /* __EMPATHY_PROTOCOL_CHOOSER_H__ */
+#endif /* __EMPATHY_PROFILE_CHOOSER_H__ */
diff --git a/python/pyempathygtk/pyempathygtk.defs b/python/pyempathygtk/pyempathygtk.defs
index 291e154d8..f174a6887 100644
--- a/python/pyempathygtk/pyempathygtk.defs
+++ b/python/pyempathygtk/pyempathygtk.defs
@@ -118,6 +118,13 @@
(gtype-id "EMPATHY_TYPE_PRESENCE_CHOOSER")
)
+(define-object ProfileChooser
+ (in-module "Empathy")
+ (parent "GtkComboBox")
+ (c-name "EmpathyProfileChooser")
+ (gtype-id "EMPATHY_TYPE_PROFILE_CHOOSER")
+)
+
(define-object SmileyManager
(in-module "Empathy")
(parent "GObject")
@@ -1557,26 +1564,27 @@
;; From empathy-profile-chooser.h
+(define-function profile_chooser_get_type
+ (c-name "empathy_profile_chooser_get_type")
+ (return-type "GType")
+)
+
(define-function profile_chooser_new
(c-name "empathy_profile_chooser_new")
(is-constructor-of "EmpathyProfileChooser")
(return-type "GtkWidget*")
)
-(define-function profile_chooser_dup_selected
+(define-method dup_selected
+ (of-object "EmpathyProfileChooser")
(c-name "empathy_profile_chooser_dup_selected")
(return-type "McProfile*")
- (parameters
- '("GtkWidget*" "widget")
- )
)
-(define-function profile_chooser_n_profiles
+(define-method n_profiles
+ (of-object "EmpathyProfileChooser")
(c-name "empathy_profile_chooser_n_profiles")
(return-type "gint")
- (parameters
- '("GtkWidget*" "widget")
- )
)
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index e311ac637..dcf6bcc96 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -183,7 +183,8 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
accounts_dialog_model_select_first (dialog);
return;
}
- if (empathy_profile_chooser_n_profiles (dialog->combobox_profile) > 0) {
+ if (empathy_profile_chooser_n_profiles (
+ EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile)) > 0) {
/* We have no account configured but we have some
* profiles instsalled. The user obviously wants to add
* an account. Click on the Add button for him. */
@@ -819,7 +820,8 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button,
gchar *str;
McProfileCapabilityFlags cap;
- profile = empathy_profile_chooser_dup_selected (dialog->combobox_profile);
+ profile = empathy_profile_chooser_dup_selected (
+ EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile));
/* Create account */
account = mc_account_create (profile);
@@ -870,7 +872,8 @@ accounts_dialog_profile_changed_cb (GtkWidget *widget,
McProfile *profile;
McProfileCapabilityFlags cap;
- profile = empathy_profile_chooser_dup_selected (dialog->combobox_profile);
+ profile = empathy_profile_chooser_dup_selected (
+ EMPATHY_PROFILE_CHOOSER (dialog->combobox_profile));
cap = mc_profile_get_capabilities (profile);
if (cap & MC_PROFILE_CAPABILITY_REGISTRATION_UI) {
diff --git a/tests/.gitignore b/tests/.gitignore
index a37f3e5a0..eac793465 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -6,3 +6,4 @@ contact-run-until-ready-2
empetit
test-empathy-presence-chooser
test-empathy-status-preset-dialog
+test-empathy-profile-chooser
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7740d1f8b..f96650e79 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,12 +26,14 @@ noinst_PROGRAMS = \
contact-manager \
empetit \
test-empathy-presence-chooser \
- test-empathy-status-preset-dialog
+ test-empathy-status-preset-dialog \
+ test-empathy-profile-chooser
contact_manager_SOURCES = contact-manager.c
empetit_SOURCES = empetit.c
test_empathy_presence_chooser_SOURCES = test-empathy-presence-chooser.c
test_empathy_status_preset_dialog_SOURCES = test-empathy-status-preset-dialog.c
+test_empathy_profile_chooser_SOURCES = test-empathy-profile-chooser.c
check_PROGRAMS = check-main
TESTS = check-main
diff --git a/tests/test-empathy-profile-chooser.c b/tests/test-empathy-profile-chooser.c
new file mode 100644
index 000000000..9078bbde4
--- /dev/null
+++ b/tests/test-empathy-profile-chooser.c
@@ -0,0 +1,31 @@
+#include <config.h>
+
+#include <gtk/gtk.h>
+
+#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy-gtk/empathy-profile-chooser.h>
+
+int
+main (int argc,
+ char **argv)
+{
+ GtkWidget *window;
+ GtkWidget *chooser;
+
+ gtk_init (&argc, &argv);
+ empathy_gtk_init ();
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ chooser = empathy_profile_chooser_new ();
+ gtk_container_add (GTK_CONTAINER (window), chooser);
+
+ /* gtk_window_set_default_size (GTK_WINDOW (window), 150, -1);*/
+ gtk_widget_show_all (window);
+
+ g_signal_connect_swapped (window, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_main ();
+
+ return 0;
+}