[gedit] Remove gedit_style_scheme_manager_list_schemes_sorted
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Remove gedit_style_scheme_manager_list_schemes_sorted
- Date: Sat, 26 Nov 2011 14:40:47 +0000 (UTC)
commit 214b126bbcee35ab3fdd7ad59eae5f46c5727a18
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Nov 26 15:38:48 2011 +0100
Remove gedit_style_scheme_manager_list_schemes_sorted
Rely on GtkSourceView sorting instead.
gedit/dialogs/gedit-preferences-dialog.c | 31 ++++++++++--------------
gedit/gedit-style-scheme-manager.c | 37 ------------------------------
gedit/gedit-style-scheme-manager.h | 4 ---
3 files changed, 13 insertions(+), 59 deletions(-)
---
diff --git a/gedit/dialogs/gedit-preferences-dialog.c b/gedit/dialogs/gedit-preferences-dialog.c
index 88058ab..c488574 100644
--- a/gedit/dialogs/gedit-preferences-dialog.c
+++ b/gedit/dialogs/gedit-preferences-dialog.c
@@ -549,9 +549,10 @@ ensure_color_scheme_id (GeditPreferencesDialog *dlg,
static const gchar *
populate_color_scheme_list (GeditPreferencesDialog *dlg, const gchar *def_id)
{
- GSList *schemes;
- GSList *l;
-
+ GtkSourceStyleSchemeManager *sm;
+ const gchar * const *ids;
+ gint i;
+
gtk_list_store_clear (dlg->priv->schemes_treeview_model);
def_id = ensure_color_scheme_id (dlg, def_id);
@@ -561,45 +562,39 @@ populate_color_scheme_list (GeditPreferencesDialog *dlg, const gchar *def_id)
"Please check your GtkSourceView installation.");
return NULL;
}
-
- schemes = gedit_style_scheme_manager_list_schemes_sorted (gedit_get_style_scheme_manager ());
- l = schemes;
- while (l != NULL)
+
+ sm = gedit_get_style_scheme_manager ();
+ ids = gtk_source_style_scheme_manager_get_scheme_ids (sm);
+ for (i = 0; ids[i] != NULL; i++)
{
GtkSourceStyleScheme *scheme;
- const gchar *id;
const gchar *name;
const gchar *description;
GtkTreeIter iter;
- scheme = GTK_SOURCE_STYLE_SCHEME (l->data);
-
- id = gtk_source_style_scheme_get_id (scheme);
+ scheme = gtk_source_style_scheme_manager_get_scheme (sm, ids[i]);
+
name = gtk_source_style_scheme_get_name (scheme);
description = gtk_source_style_scheme_get_description (scheme);
gtk_list_store_append (dlg->priv->schemes_treeview_model, &iter);
gtk_list_store_set (dlg->priv->schemes_treeview_model,
&iter,
- ID_COLUMN, id,
+ ID_COLUMN, ids[i],
NAME_COLUMN, name,
DESC_COLUMN, description,
-1);
g_return_val_if_fail (def_id != NULL, NULL);
- if (strcmp (id, def_id) == 0)
+ if (strcmp (ids[i], def_id) == 0)
{
GtkTreeSelection *selection;
-
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->priv->schemes_treeview));
gtk_tree_selection_select_iter (selection, &iter);
}
-
- l = g_slist_next (l);
}
- g_slist_free (schemes);
-
return def_id;
}
diff --git a/gedit/gedit-style-scheme-manager.c b/gedit/gedit-style-scheme-manager.c
index 1d8306e..546e715 100644
--- a/gedit/gedit-style-scheme-manager.c
+++ b/gedit/gedit-style-scheme-manager.c
@@ -107,43 +107,6 @@ schemes_compare (gconstpointer a,
return g_utf8_collate (name_a, name_b);
}
-/**
- * gedit_style_scheme_manager_list_schemes_sorted:
- * @manager:
- *
- * Returns the list of style schemes sorted alphabetically.
- *
- * Return value: (element-type GtkSourceStyleScheme) (transfer container):
- * a newly-allocated list of style schemes.
- */
-GSList *
-gedit_style_scheme_manager_list_schemes_sorted (GtkSourceStyleSchemeManager *manager)
-{
- const gchar * const * scheme_ids;
- GSList *schemes = NULL;
-
- g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME_MANAGER (manager), NULL);
-
- scheme_ids = gtk_source_style_scheme_manager_get_scheme_ids (manager);
-
- while (*scheme_ids != NULL)
- {
- GtkSourceStyleScheme *scheme;
-
- scheme = gtk_source_style_scheme_manager_get_scheme (manager,
- *scheme_ids);
-
- schemes = g_slist_prepend (schemes, scheme);
-
- ++scheme_ids;
- }
-
- if (schemes != NULL)
- schemes = g_slist_sort (schemes, (GCompareFunc)schemes_compare);
-
- return schemes;
-}
-
gboolean
_gedit_style_scheme_manager_scheme_is_gedit_user_scheme (GtkSourceStyleSchemeManager *manager,
const gchar *scheme_id)
diff --git a/gedit/gedit-style-scheme-manager.h b/gedit/gedit-style-scheme-manager.h
index ba1eb1d..3be1b2f 100644
--- a/gedit/gedit-style-scheme-manager.h
+++ b/gedit/gedit-style-scheme-manager.h
@@ -32,10 +32,6 @@ G_BEGIN_DECLS
GtkSourceStyleSchemeManager *
gedit_get_style_scheme_manager (void);
-/* Returns a sorted list of style schemes */
-GSList *gedit_style_scheme_manager_list_schemes_sorted
- (GtkSourceStyleSchemeManager *manager);
-
/*
* Non exported functions
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]