[gedit] Adapt to GSettings API break
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Adapt to GSettings API break
- Date: Fri, 4 Jun 2010 12:05:45 +0000 (UTC)
commit e482c7b0ce3bf44ca0bccda93b757a1f56c598bc
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jun 4 11:33:32 2010 +0200
Adapt to GSettings API break
The API for setting and retrieving string arrays was changed, so all
calls to g_settings_set_strv()/g_settings_get_strv() need adjusting.
https://bugzilla.gnome.org/show_bug.cgi?id=620554
gedit/dialogs/gedit-encodings-dialog.c | 9 ++-------
gedit/gedit-document-loader.c | 4 +---
gedit/gedit-encodings-combo-box.c | 4 +---
gedit/gedit-history-entry.c | 14 +++++---------
gedit/gedit-settings.c | 14 +++++++-------
5 files changed, 16 insertions(+), 29 deletions(-)
---
diff --git a/gedit/dialogs/gedit-encodings-dialog.c b/gedit/dialogs/gedit-encodings-dialog.c
index 063ba41..defefba 100644
--- a/gedit/dialogs/gedit-encodings-dialog.c
+++ b/gedit/dialogs/gedit-encodings-dialog.c
@@ -257,13 +257,11 @@ init_shown_in_menu_tree_model (GeditEncodingsDialog *dialog)
{
GtkTreeIter iter;
gchar **enc_strv;
- gsize len;
GSList *list, *tmp;
/* add data to the list store */
enc_strv = g_settings_get_strv (dialog->priv->enc_settings,
- GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU,
- &len);
+ GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU);
list = _gedit_encoding_strv_to_list ((const gchar * const *)enc_strv);
@@ -308,14 +306,11 @@ response_handler (GtkDialog *dialog,
if (response_id == GTK_RESPONSE_OK)
{
gchar **encs;
- gint len;
encs = _gedit_encoding_list_to_strv (dlg->priv->show_in_menu_list);
- len = g_slist_length (dlg->priv->show_in_menu_list);
-
g_settings_set_strv (dlg->priv->enc_settings,
GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU,
- (const gchar * const *)encs, len);
+ (const gchar * const *)encs);
g_strfreev (encs);
}
diff --git a/gedit/gedit-document-loader.c b/gedit/gedit-document-loader.c
index 4dfbc4d..ca52a87 100644
--- a/gedit/gedit-document-loader.c
+++ b/gedit/gedit-document-loader.c
@@ -673,11 +673,9 @@ get_candidate_encodings (GeditDocumentLoader *loader)
const GeditEncoding *metadata;
GSList *encodings;
gchar **enc_strv;
- gsize len;
enc_strv = g_settings_get_strv (loader->priv->enc_settings,
- GEDIT_SETTINGS_ENCODING_AUTO_DETECTED,
- &len);
+ GEDIT_SETTINGS_ENCODING_AUTO_DETECTED);
encodings = _gedit_encoding_strv_to_list ((const gchar * const *)enc_strv);
g_strfreev (enc_strv);
diff --git a/gedit/gedit-encodings-combo-box.c b/gedit/gedit-encodings-combo-box.c
index 11fa081..99d4952 100644
--- a/gedit/gedit-encodings-combo-box.c
+++ b/gedit/gedit-encodings-combo-box.c
@@ -264,7 +264,6 @@ update_menu (GeditEncodingsComboBox *menu)
const GeditEncoding *utf8_encoding;
const GeditEncoding *current_encoding;
gchar **enc_strv;
- gsize len;
store = menu->priv->store;
@@ -330,8 +329,7 @@ update_menu (GeditEncodingsComboBox *menu)
}
enc_strv = g_settings_get_strv (menu->priv->enc_settings,
- GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU,
- &len);
+ GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU);
encodings = _gedit_encoding_strv_to_list ((const gchar * const *)enc_strv);
g_strfreev (enc_strv);
diff --git a/gedit/gedit-history-entry.c b/gedit/gedit-history-entry.c
index c07285b..200563d 100644
--- a/gedit/gedit-history-entry.c
+++ b/gedit/gedit-history-entry.c
@@ -190,8 +190,7 @@ get_history_store (GeditHistoryEntry *entry)
}
static gchar **
-get_history_items (GeditHistoryEntry *entry,
- gsize *len)
+get_history_items (GeditHistoryEntry *entry)
{
GtkListStore *store;
GtkTreeIter iter;
@@ -206,8 +205,7 @@ get_history_items (GeditHistoryEntry *entry,
n_children = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store),
NULL);
- *len = n_children;
- array = g_ptr_array_sized_new (*len + 1);
+ array = g_ptr_array_sized_new (n_children + 1);
while (valid)
{
@@ -233,15 +231,14 @@ static void
gedit_history_entry_save_history (GeditHistoryEntry *entry)
{
gchar **items;
- gsize len;
g_return_if_fail (GEDIT_IS_HISTORY_ENTRY (entry));
- items = get_history_items (entry, &len);
+ items = get_history_items (entry);
g_settings_set_strv (entry->priv->settings,
entry->priv->history_id,
- (const gchar * const *)items, len);
+ (const gchar * const *)items);
g_strfreev (items);
}
@@ -373,8 +370,7 @@ gedit_history_entry_load_history (GeditHistoryEntry *entry)
store = get_history_store (entry);
items = g_settings_get_strv (entry->priv->settings,
- entry->priv->history_id,
- &i);
+ entry->priv->history_id);
i = 0;
gtk_list_store_clear (store);
diff --git a/gedit/gedit-settings.c b/gedit/gedit-settings.c
index 52fe23e..d0eb84e 100644
--- a/gedit/gedit-settings.c
+++ b/gedit/gedit-settings.c
@@ -855,15 +855,15 @@ gedit_settings_get_list (GSettings *settings,
{
GSList *list = NULL;
gchar **values;
- gsize len, i;
+ gsize i;
g_return_val_if_fail (G_IS_SETTINGS (settings), NULL);
g_return_val_if_fail (key != NULL, NULL);
- values = g_settings_get_strv (settings, key, &len);
+ values = g_settings_get_strv (settings, key);
i = 0;
- while (i < len)
+ while (values[i] != NULL)
{
list = g_slist_prepend (list, values[i]);
i++;
@@ -881,25 +881,25 @@ gedit_settings_set_list (GSettings *settings,
{
gchar **values = NULL;
const GSList *l;
- gint len = 0;
g_return_if_fail (G_IS_SETTINGS (settings));
g_return_if_fail (key != NULL);
if (list != NULL)
{
- gint i;
+ gint i, len;
len = g_slist_length ((GSList *)list);
- values = g_new (gchar *, len);
+ values = g_new (gchar *, len + 1);
for (l = list, i = 0; l != NULL; l = g_slist_next (l), i++)
{
values[i] = l->data;
}
+ values[i] = NULL;
}
- g_settings_set_strv (settings, key, (const gchar * const *)values, len);
+ g_settings_set_strv (settings, key, (const gchar * const *)values);
g_free (values);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]