[gnome-calendar] source-dialog: sort calendars by their display name
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] source-dialog: sort calendars by their display name
- Date: Mon, 25 May 2015 16:57:11 +0000 (UTC)
commit 33d341ff1396222204c91b12a6b100309ca0f1ab
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Apr 9 07:57:51 2015 -0300
source-dialog: sort calendars by their display name
src/gcal-source-dialog.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 9574f7e..097187a 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -115,6 +115,10 @@ static void calendar_listbox_row_activated (GtkListBox *bo
GtkListBoxRow *row,
gpointer user_data);
+static gint calendar_listbox_sort_func (GtkListBoxRow *row1,
+ GtkListBoxRow *row2,
+ gpointer user_data);
+
static void calendar_visible_check_toggled (GObject *object,
GParamSpec *pspec,
gpointer user_data);
@@ -304,6 +308,19 @@ back_button_clicked (GtkButton *button,
}
}
+static gint
+calendar_listbox_sort_func (GtkListBoxRow *row1,
+ GtkListBoxRow *row2,
+ gpointer user_data)
+{
+ ESource *source1, *source2;
+
+ source1 = g_object_get_data (G_OBJECT (row1), "source");
+ source2 = g_object_get_data (G_OBJECT (row2), "source");
+
+ return g_strcmp0 (e_source_get_display_name (source1), e_source_get_display_name (source2));
+}
+
static void
calendar_visible_check_toggled (GObject *object,
GParamSpec *pspec,
@@ -1521,6 +1538,9 @@ gcal_source_dialog_constructed (GObject *object)
// Setup listbox header functions
gtk_list_box_set_header_func (GTK_LIST_BOX (priv->calendars_listbox), display_header_func, NULL, NULL);
+ gtk_list_box_set_sort_func (GTK_LIST_BOX (priv->calendars_listbox), (GtkListBoxSortFunc)
calendar_listbox_sort_func,
+ object, NULL);
+
gtk_list_box_set_header_func (GTK_LIST_BOX (priv->online_accounts_listbox), display_header_func, NULL,
NULL);
// Action group
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]