[gedit/gsettings: 5/7] Port the missing parts added with the master rebase.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/gsettings: 5/7] Port the missing parts added with the master rebase.
- Date: Thu, 22 Apr 2010 15:40:52 +0000 (UTC)
commit b84ae94cbc8799ce58a5daf702ddbea97ce35734
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Apr 22 16:03:51 2010 +0200
Port the missing parts added with the master rebase.
gedit/Makefile.am | 3 --
gedit/gedit-document-saver.c | 1 -
gedit/gedit-encodings-combo-box.c | 47 ++++++++++++++++++++++--------------
gedit/gedit-gio-document-loader.c | 19 ++++++++++++--
4 files changed, 45 insertions(+), 25 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index c9ce29c..dd8c5c8 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -81,7 +81,6 @@ NOINST_H_FILES = \
gedit-plugin-loader.h \
gedit-plugin-manager.h \
gedit-plugins-engine.h \
- gedit-prefs-manager-private.h \
gedit-print-job.h \
gedit-print-preview.h \
gedit-session.h \
@@ -108,8 +107,6 @@ INST_H_FILES = \
gedit-notebook.h \
gedit-panel.h \
gedit-plugin.h \
- gedit-prefs-manager-app.h \
- gedit-prefs-manager.h \
gedit-progress-message-area.h \
gedit-statusbar.h \
gedit-status-combo-box.h \
diff --git a/gedit/gedit-document-saver.c b/gedit/gedit-document-saver.c
index 78ecc15..b72681c 100644
--- a/gedit/gedit-document-saver.c
+++ b/gedit/gedit-document-saver.c
@@ -39,7 +39,6 @@
#include "gedit-document-saver.h"
#include "gedit-debug.h"
-#include "gedit-prefs-manager.h"
#include "gedit-marshal.h"
#include "gedit-utils.h"
#include "gedit-enum-types.h"
diff --git a/gedit/gedit-encodings-combo-box.c b/gedit/gedit-encodings-combo-box.c
index 1626bb9..2e32c50 100644
--- a/gedit/gedit-encodings-combo-box.c
+++ b/gedit/gedit-encodings-combo-box.c
@@ -36,9 +36,11 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include "gedit-app.h"
#include <gedit/gedit-encodings-combo-box.h>
-#include <gedit/gedit-prefs-manager.h>
#include <gedit/dialogs/gedit-encodings-dialog.h>
+#include "gedit-settings.h"
+#include "gedit-utils.h"
#define ENCODING_KEY "Enconding"
@@ -48,6 +50,8 @@
struct _GeditEncodingsComboBoxPrivate
{
+ GSettings *enc_settings;
+
GtkListStore *store;
glong changed_id;
@@ -317,7 +321,13 @@ update_menu (GeditEncodingsComboBox *menu)
g_free (str);
}
- encodings = gedit_prefs_manager_get_shown_in_menu_encodings ();
+ l = gedit_utils_get_list_from_settings (menu->priv->enc_settings,
+ GS_ENCODING_SHOW_IN_MENU);
+
+ encodings = gedit_utils_get_encodings_from_list_str (l);
+
+ g_slist_foreach (l, (GFunc) g_free, NULL);
+ g_slist_free (l);
for (l = encodings; l != NULL; l = g_slist_next (l))
{
@@ -342,23 +352,20 @@ update_menu (GeditEncodingsComboBox *menu)
g_slist_free (encodings);
- if (gedit_prefs_manager_shown_in_menu_encodings_can_set ())
- {
- gtk_list_store_append (store, &iter);
- /* separator */
- gtk_list_store_set (store, &iter,
- NAME_COLUMN, "",
- ENCODING_COLUMN, NULL,
- ADD_COLUMN, FALSE,
- -1);
+ gtk_list_store_append (store, &iter);
+ /* separator */
+ gtk_list_store_set (store, &iter,
+ NAME_COLUMN, "",
+ ENCODING_COLUMN, NULL,
+ ADD_COLUMN, FALSE,
+ -1);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- NAME_COLUMN, _("Add or Remove..."),
- ENCODING_COLUMN, NULL,
- ADD_COLUMN, TRUE,
- -1);
- }
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ NAME_COLUMN, _("Add or Remove..."),
+ ENCODING_COLUMN, NULL,
+ ADD_COLUMN, TRUE,
+ -1);
/* set the model back */
gtk_combo_box_set_model (GTK_COMBO_BOX (menu),
@@ -375,6 +382,10 @@ gedit_encodings_combo_box_init (GeditEncodingsComboBox *menu)
menu->priv = GEDIT_ENCODINGS_COMBO_BOX_GET_PRIVATE (menu);
+ menu->priv->enc_settings = gedit_app_get_settings (gedit_app_get_default (),
+ "preferences", "encodings",
+ NULL);
+
menu->priv->store = gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING,
G_TYPE_POINTER,
diff --git a/gedit/gedit-gio-document-loader.c b/gedit/gedit-gio-document-loader.c
index a4ad128..ae3df4d 100644
--- a/gedit/gedit-gio-document-loader.c
+++ b/gedit/gedit-gio-document-loader.c
@@ -38,12 +38,13 @@
#include <glib/gstdio.h>
#include <gio/gio.h>
+#include "gedit-app.h"
#include "gedit-gio-document-loader.h"
#include "gedit-document-output-stream.h"
#include "gedit-smart-charset-converter.h"
-#include "gedit-prefs-manager.h"
#include "gedit-debug.h"
#include "gedit-utils.h"
+#include "gedit-settings.h"
typedef struct
{
@@ -75,6 +76,8 @@ static void open_async_read (AsyncData *async);
struct _GeditGioDocumentLoaderPrivate
{
+ GSettings *enc_settings;
+
/* Info on the current file */
GFile *gfile;
@@ -162,6 +165,10 @@ gedit_gio_document_loader_init (GeditGioDocumentLoader *gvloader)
gvloader->priv->converter = NULL;
gvloader->priv->error = NULL;
+
+ gvloader->priv->enc_settings = gedit_app_get_settings (gedit_app_get_default (),
+ "preferences", "encodings",
+ NULL);
}
static AsyncData *
@@ -433,9 +440,15 @@ static GSList *
get_candidate_encodings (GeditGioDocumentLoader *gvloader)
{
const GeditEncoding *metadata;
- GSList *encodings = NULL;
+ GSList *encodings, *l;
+
+ l = gedit_utils_get_list_from_settings (gvloader->priv->enc_settings,
+ GS_ENCODING_AUTO_DETECTED);
+
+ encodings = gedit_utils_get_encodings_from_list_str (l);
- encodings = gedit_prefs_manager_get_auto_detected_encodings ();
+ g_slist_foreach (l, (GFunc) g_free, NULL);
+ g_slist_free (l);
metadata = get_metadata_encoding (GEDIT_DOCUMENT_LOADER (gvloader));
if (metadata != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]