aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-09-26 21:45:25 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-09-26 21:45:25 +0800
commit8d377a95ed24080b068ceffc3cb2d6d12ccb15e4 (patch)
tree907b269adcdde6d57486589a57d3c988abba7835
parent710a731e3bdff1948d18aef1e4fd1727454bb357 (diff)
downloadgsoc2013-empathy-8d377a95ed24080b068ceffc3cb2d6d12ccb15e4.tar
gsoc2013-empathy-8d377a95ed24080b068ceffc3cb2d6d12ccb15e4.tar.gz
gsoc2013-empathy-8d377a95ed24080b068ceffc3cb2d6d12ccb15e4.tar.bz2
gsoc2013-empathy-8d377a95ed24080b068ceffc3cb2d6d12ccb15e4.tar.lz
gsoc2013-empathy-8d377a95ed24080b068ceffc3cb2d6d12ccb15e4.tar.xz
gsoc2013-empathy-8d377a95ed24080b068ceffc3cb2d6d12ccb15e4.tar.zst
gsoc2013-empathy-8d377a95ed24080b068ceffc3cb2d6d12ccb15e4.zip
Fix warning when sort criterium is NULL and when there is no profile.
2007-09-26 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-profile-chooser.c: * libempathy-gtk/empathy-main-window.c: Fix warning when sort criterium is NULL and when there is no profile. Fixes bug #479786 (Christian Persch, Xavier Claessens). svn path=/trunk/; revision=318
-rw-r--r--ChangeLog7
-rw-r--r--libempathy-gtk/empathy-main-window.c6
-rw-r--r--libempathy-gtk/empathy-profile-chooser.c35
3 files changed, 29 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 4717a3b73..8a615f7ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-26 Xavier Claessens <xclaesse@gmail.com>
+
+ * libempathy-gtk/empathy-profile-chooser.c:
+ * libempathy-gtk/empathy-main-window.c: Fix warning when sort criterium
+ is NULL and when there is no profile. Fixes bug #479786
+ (Christian Persch, Xavier Claessens).
+
2007-09-21 Xavier Claessens <xclaesse@gmail.com>
* libempathy/empathy-log-manager.c: Ignore log files that don't have a
diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c
index c021df7dd..7867b949c 100644
--- a/libempathy-gtk/empathy-main-window.c
+++ b/libempathy-gtk/empathy-main-window.c
@@ -897,13 +897,13 @@ main_window_notify_compact_contact_list_cb (EmpathyConf *conf,
}
static void
-main_window_notify_sort_criterium_cb (EmpathyConf *conf,
+main_window_notify_sort_criterium_cb (EmpathyConf *conf,
const gchar *key,
EmpathyMainWindow *window)
{
gchar *str = NULL;
- if (empathy_conf_get_string (conf, key, &str)) {
+ if (empathy_conf_get_string (conf, key, &str) && str) {
GType type;
GEnumClass *enum_class;
GEnumValue *enum_value;
@@ -915,7 +915,7 @@ main_window_notify_sort_criterium_cb (EmpathyConf *conf,
if (enum_value) {
empathy_contact_list_store_set_sort_criterium (window->list_store,
- enum_value->value);
+ enum_value->value);
}
}
}
diff --git a/libempathy-gtk/empathy-profile-chooser.c b/libempathy-gtk/empathy-profile-chooser.c
index 4bc1d6c95..62c3b0f83 100644
--- a/libempathy-gtk/empathy-profile-chooser.c
+++ b/libempathy-gtk/empathy-profile-chooser.c
@@ -114,6 +114,7 @@ empathy_profile_chooser_new (void)
GtkCellRenderer *renderer;
GtkWidget *combo_box;
GtkTreeIter iter;
+ gboolean iter_set = FALSE;
/* set up combo box with new store */
store = gtk_list_store_new (COL_COUNT,
@@ -136,15 +137,6 @@ empathy_profile_chooser_new (void)
"text", COL_LABEL,
NULL);
- /* Set the profile sort function */
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
- COL_PROFILE,
- GTK_SORT_ASCENDING);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
- COL_PROFILE,
- profile_chooser_sort_func,
- NULL, NULL);
-
profiles = mc_profiles_list ();
for (l = profiles; l; l = l->next) {
McProfile *profile;
@@ -160,15 +152,26 @@ empathy_profile_chooser_new (void)
}
g_object_unref (protocol);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- COL_ICON, mc_profile_get_icon_name (profile),
- COL_LABEL, mc_profile_get_display_name (profile),
- COL_PROFILE, profile,
- -1);
+ 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;
}
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
+ /* Set the profile sort function */
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+ COL_PROFILE,
+ GTK_SORT_ASCENDING);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
+ COL_PROFILE,
+ profile_chooser_sort_func,
+ NULL, NULL);
+
+ if (iter_set) {
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
+ }
mc_profiles_free_list (profiles);
g_object_unref (store);