Port main program to GSettings.

Switch from gconf to gsettings to manange the configuration.
This patch only ports the main program.
Some help has been provided by Vincent Untz.
parent 838a2c79
......@@ -51,7 +51,7 @@ dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
dnl active plugins for gedit.schemas
ACTIVE_PLUGINS="docinfo,modelines,filebrowser,spell,time"
ACTIVE_PLUGINS="'docinfo', 'modelines', 'filebrowser', 'spell', 'time'"
AC_SUBST(ACTIVE_PLUGINS)
dnl toolbar style for gedit schemas
......@@ -63,7 +63,7 @@ AC_MSG_CHECKING([for Win32 platform])
case "$host" in
*-*-mingw*|*-*-cygwin*)
platform_win32=yes
TOOLBAR_STYLE="GEDIT_TOOLBAR_ICONS"
TOOLBAR_STYLE="'GEDIT_TOOLBAR_ICONS'"
;;
*)
platform_win32=no
......@@ -77,7 +77,7 @@ case "$host" in
*-*-mingw*)
os_win32=yes
AC_CHECK_TOOL(WINDRES, windres)
ACTIVE_PLUGINS="${ACTIVE_PLUGINS},checkupdate"
ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
;;
*)
os_win32=no
......@@ -105,7 +105,7 @@ gdk_windowing=`$PKG_CONFIG --variable=target gdk-2.0`
AC_MSG_CHECKING([for native Mac OS X])
if test "$gdk_windowing" = "quartz"; then
os_osx=yes
ACTIVE_PLUGINS="${ACTIVE_PLUGINS},checkupdate"
ACTIVE_PLUGINS="${ACTIVE_PLUGINS}, 'checkupdate'"
else
os_osx=no
fi
......@@ -273,7 +273,7 @@ PKG_CHECK_MODULES(GEDIT, [
libxml-2.0 >= 2.5.0
glib-2.0 >= 2.22.0
gthread-2.0 >= 2.13.0
gio-2.0 >= 2.23.1
gio-2.0 >= 2.25.4
gtk+-2.0 >= 2.16.0
gtksourceview-2.0 >= 2.9.7
gconf-2.0 >= 1.1.11
......@@ -332,10 +332,10 @@ AC_SUBST(EGG_SMCLIENT_CFLAGS)
AC_SUBST(EGG_SMCLIENT_LIBS)
dnl ================================================================
dnl GConf related settings
dnl GSettings stuff
dnl ================================================================
AM_GCONF_SOURCE_2
GLIB_GSETTINGS
dnl ================================================================
dnl Python
......@@ -516,7 +516,7 @@ Makefile
data/gedit.desktop.in
data/gedit-bugreport.sh
data/gedit.pc
data/gedit.schemas.in
data/org.gnome.gedit.gschema.in
data/Makefile
docs/Makefile
docs/reference/Makefile
......
......@@ -3,10 +3,10 @@ desktop_in_files = gedit.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
schemasdir = $(GCONF_SCHEMA_FILE_DIR)
schemas_in_files = gedit.schemas.in
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
@INTLTOOL_SCHEMAS_RULE@
gsettingsschema_in_files = org.gnome.gedit.gschema.in
gsettingsschema_DATA = $(gsettingsschema_in_files:.gschema.in=.gschema.xml)
org.gnome.gedit.gschema.xml: org.gnome.gedit.gschema.in
gsettings-schema-convert -f $< -o $@
man_MANS = gedit.1
......@@ -19,28 +19,20 @@ gedit-@GEDIT_API_VERSION@.pc: gedit.pc
bugreportdir = $(libexecdir)/gedit-2
bugreport_SCRIPTS = gedit-bugreport.sh
if GCONF_SCHEMAS_INSTALL
install-data-local:
if test -z "$(DESTDIR)" ; then \
for p in $(schemas_DATA) ; do \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/data/$$p ; \
done \
fi
else
install-data-local:
if GSETTINGS_SCHEMAS_INSTALL
install-data-hook:
$(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
endif
EXTRA_DIST = \
$(desktop_in_files) \
$(schemas_in_files) \
gedit.schemas.in.in \
$(man_MANS) \
gedit.pc.in \
gedit-bugreport.sh.in
gedit-bugreport.sh.in \
$(gsettingsschema_DATA)
CLEANFILES = \
$(desktop_DATA) \
$(schemas_DATA) \
$(pkgconfig_DATA)
......
This diff is collapsed.
schema org.gnome.gedit:
path /apps/gedit/
child preferences:
child editor:
key use-default-font = @b true
key editor-font = @s 'Monospace 12'
key scheme = @s 'classic'
key create-backup-copy = @b true
key auto-save = @b false
key auto-save-interval = @u 10
key undo-actions-limit = @u 25
key max-undo-actions = @u 2000
key wrap-mode = @s 'GTK_WRAP_WORD'
key tabs-size = @u 8
key insert-spaces = @b false
key auto-indent = @b false
key display-line-numbers = @b false
key highlight-current-line = @b false
key bracket-matching = @b false
key display-right-margin = @b false
key right-margin-position = @u 80
key smart-home-end = @s 'after'
key writable-vfs-schemes = @as ['dav', 'davs', 'ftp', 'sftp', 'smb', 'ssh']
key restore-cursor-position = @b true
key syntax-highlighting = @b true
key search-highlighting = @b true
child ui:
key toolbar-visible = @b true
key toolbar-buttons-style = @s '@TOOLBAR_STYLE@'
key statusbar-visible = @b true
key side-pane-visible = @b false
key bottom-pane-visible = @b false
key max-recents = @u 5
child print:
key print-syntax-highlighting = @b true
key print-header = @b true
key print-wrap-mode = @s 'GTK_WRAP_WORD'
key print-line-numbers = @u 0
key print-font-body-pango = @s 'Monospace 9'
key print-font-header-pango = @s 'Sans 11'
key print-font-numbers-pango = @s 'Sans 8'
child encodings:
key auto-detected = @as ['UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']
key shown-in-menu = @as ['ISO-8859-15']
child state:
child window:
key state = @i 0
key size = @(ii) (650, 500)
key side-panel-size = @i 200
key side-panel-active-page = @i 0
key bottom-panel-size = @i 140
key bottom-panel-active-page = @i 0
child file-filter:
key filter-id = @i 0
child history-entry:
key search-for-entry = @as ['']
key replace-with-entry = @as ['']
child plugins:
key active-plugins = @as [@ACTIVE_PLUGINS@]
schema org.gnome.Desktop.Lockdown:
path /desktop/gnome/lockdown/
key disable-command-line = @b false
key disable-printing = @b false
key disable-print-setup = @b false
key disable-save-to-disk = @b false
schema org.gnome.Desktop.Interface:
path /desktop/gnome/interface/
key monospace-font-name = @s 'Monospace 10'
......@@ -107,10 +107,10 @@ 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 \
gedit-settings.h \
gedit-smart-charset-converter.h \
gedit-style-scheme-manager.h \
gedit-tab-label.h \
......@@ -133,8 +133,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 \
......@@ -189,13 +187,11 @@ libgedit_la_SOURCES = \
gedit-plugin-loader.c \
gedit-plugin-manager.c \
gedit-plugins-engine.c \
gedit-prefs-manager-app.c \
gedit-prefs-manager.c \
gedit-prefs-manager-private.h \
gedit-print-job.c \
gedit-print-preview.c \
gedit-progress-message-area.c \
gedit-session.c \
gedit-settings.c \
gedit-smart-charset-converter.c \
gedit-statusbar.c \
gedit-status-combo-box.c \
......
......@@ -40,10 +40,10 @@
#include "gedit-encodings-dialog.h"
#include "gedit-encodings.h"
#include "gedit-prefs-manager.h"
#include "gedit-utils.h"
#include "gedit-debug.h"
#include "gedit-dirs.h"
#include "gedit-settings.h"
#define GEDIT_ENCODINGS_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
GEDIT_TYPE_ENCODINGS_DIALOG, \
......@@ -51,6 +51,8 @@
struct _GeditEncodingsDialogPrivate
{
GSettings *enc_settings;
GtkListStore *available_liststore;
GtkListStore *displayed_liststore;
GtkWidget *available_treeview;
......@@ -73,12 +75,27 @@ gedit_encodings_dialog_finalize (GObject *object)
G_OBJECT_CLASS (gedit_encodings_dialog_parent_class)->finalize (object);
}
static void
gedit_encodings_dialog_dispose (GObject *object)
{
GeditEncodingsDialogPrivate *priv = GEDIT_ENCODINGS_DIALOG (object)->priv;
if (priv->enc_settings != NULL)
{
g_object_unref (priv->enc_settings);
priv->enc_settings = NULL;
}
G_OBJECT_CLASS (gedit_encodings_dialog_parent_class)->dispose (object);
}
static void
gedit_encodings_dialog_class_init (GeditEncodingsDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gedit_encodings_dialog_finalize;
object_class->dispose = gedit_encodings_dialog_dispose;
g_type_class_add_private (object_class, sizeof (GeditEncodingsDialogPrivate));
}
......@@ -237,14 +254,18 @@ static void
init_shown_in_menu_tree_model (GeditEncodingsDialog *dialog)
{
GtkTreeIter iter;
gchar **enc_strv;
gsize len;
GSList *list, *tmp;
/* add data to the list store */
list = gedit_prefs_manager_get_shown_in_menu_encodings ();
enc_strv = g_settings_get_strv (dialog->priv->enc_settings,
GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU,
&len);
tmp = list;
list = _gedit_encoding_strv_to_list ((const gchar * const *)enc_strv);
while (tmp != NULL)
for (tmp = list; tmp != NULL; tmp = g_slist_next (tmp))
{
const GeditEncoding *enc;
......@@ -261,8 +282,6 @@ init_shown_in_menu_tree_model (GeditEncodingsDialog *dialog)
gedit_encoding_get_charset (enc),
COLUMN_NAME,
gedit_encoding_get_name (enc), -1);
tmp = g_slist_next (tmp);
}
g_slist_free (list);
......@@ -286,8 +305,17 @@ response_handler (GtkDialog *dialog,
if (response_id == GTK_RESPONSE_OK)
{
g_return_if_fail (gedit_prefs_manager_shown_in_menu_encodings_can_set ());
gedit_prefs_manager_set_shown_in_menu_encodings (dlg->priv->show_in_menu_list);
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);
g_strfreev (encs);
}
}
......@@ -312,6 +340,8 @@ gedit_encodings_dialog_init (GeditEncodingsDialog *dlg)
dlg->priv = GEDIT_ENCODINGS_DIALOG_GET_PRIVATE (dlg);
dlg->priv->enc_settings = g_settings_new ("org.gnome.gedit.preferences.encodings");
gtk_dialog_add_buttons (GTK_DIALOG (dlg),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
......
This diff is collapsed.
......@@ -375,7 +375,7 @@ gedit_search_dialog_init (GeditSearchDialog *dlg)
return;
}
dlg->priv->search_entry = gedit_history_entry_new ("gedit2_search_for_entry",
dlg->priv->search_entry = gedit_history_entry_new ("search-for-entry",
TRUE);
gtk_widget_set_size_request (dlg->priv->search_entry, 300, -1);
gedit_history_entry_set_escape_func
......@@ -391,7 +391,7 @@ gedit_search_dialog_init (GeditSearchDialog *dlg)
dlg->priv->search_entry,
1, 2, 0, 1);
dlg->priv->replace_entry = gedit_history_entry_new ("gedit2_replace_with_entry",
dlg->priv->replace_entry = gedit_history_entry_new ("replace-with-entry",
TRUE);
gedit_history_entry_set_escape_func
(GEDIT_HISTORY_ENTRY (dlg->priv->replace_entry),
......
......@@ -38,7 +38,6 @@
#include <glib/gi18n.h>
#include "gedit-app.h"
#include "gedit-prefs-manager-app.h"
#include "gedit-commands.h"
#include "gedit-notebook.h"
#include "gedit-debug.h"
......@@ -46,6 +45,7 @@
#include "gedit-enum-types.h"
#include "gedit-dirs.h"
#include "gseal-gtk-compat.h"
#include "gedit-settings.h"
#ifdef OS_OSX
#include "gedit-app-osx.h"
......@@ -78,6 +78,9 @@ struct _GeditAppPrivate
GtkPageSetup *page_setup;
GtkPrintSettings *print_settings;
GSettings *settings;
GSettings *window_settings;
};
G_DEFINE_ABSTRACT_TYPE(GeditApp, gedit_app, G_TYPE_INITIALLY_UNOWNED)
......@@ -97,6 +100,26 @@ gedit_app_finalize (GObject *object)
G_OBJECT_CLASS (gedit_app_parent_class)->finalize (object);
}
static void
gedit_app_dispose (GObject *object)
{
GeditApp *app = GEDIT_APP (object);
if (app->priv->window_settings != NULL)
{
g_object_unref (app->priv->window_settings);
app->priv->window_settings = NULL;
}
if (app->priv->settings != NULL)
{
g_object_unref (app->priv->settings);
app->priv->settings = NULL;
}
G_OBJECT_CLASS (gedit_app_parent_class)->dispose (object);
}
static void
gedit_app_get_property (GObject *object,
guint prop_id,
......@@ -229,6 +252,7 @@ gedit_app_class_init (GeditAppClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gedit_app_finalize;
object_class->dispose = gedit_app_dispose;
object_class->get_property = gedit_app_get_property;
object_class->constructor = gedit_app_constructor;
......@@ -456,9 +480,13 @@ gedit_app_init (GeditApp *app)
app->priv = GEDIT_APP_GET_PRIVATE (app);
load_accels ();
/* Load settings */
app->priv->settings = gedit_settings_new ();
app->priv->window_settings = g_settings_new ("org.gnome.gedit.state.window");
/* initial lockdown state */
app->priv->lockdown = gedit_prefs_manager_get_lockdown ();
app->priv->lockdown = gedit_settings_get_lockdown (GEDIT_SETTINGS (app->priv->settings));
}
/**
......@@ -644,17 +672,20 @@ gedit_app_create_window_real (GeditApp *app,
GdkWindowState state;
gint w, h;
state = gedit_prefs_manager_get_window_state ();
state = g_settings_get_int (app->priv->window_settings,
GEDIT_SETTINGS_WINDOW_STATE);
if ((state & GDK_WINDOW_STATE_MAXIMIZED) != 0)
{
gedit_prefs_manager_get_default_window_size (&w, &h);
_gedit_window_get_default_size (&w, &h);
gtk_window_set_default_size (GTK_WINDOW (window), w, h);
gtk_window_maximize (GTK_WINDOW (window));
}
else
{
gedit_prefs_manager_get_window_size (&w, &h);
g_settings_get (app->priv->window_settings,
GEDIT_SETTINGS_WINDOW_SIZE,
"(ii)", &w, &h);
gtk_window_set_default_size (GTK_WINDOW (window), w, h);
gtk_window_unmaximize (GTK_WINDOW (window));
}
......@@ -1043,4 +1074,12 @@ _gedit_app_set_default_print_settings (GeditApp *app,
app->priv->print_settings = g_object_ref (settings);
}
GSettings *
_gedit_app_get_settings (GeditApp *app)
{
g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
return app->priv->settings;
}
/* ex:ts=8:noet: */
......@@ -161,6 +161,8 @@ GtkPrintSettings *_gedit_app_get_default_print_settings (GeditApp *app);
void _gedit_app_set_default_print_settings (GeditApp *app,
GtkPrintSettings *settings);
GSettings *_gedit_app_get_settings (GeditApp *app);
G_END_DECLS
#endif /* __GEDIT_APP_H__ */
......
......@@ -41,12 +41,12 @@
#include "gedit-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-metadata-manager.h"
#include "gedit-utils.h"
#include "gedit-marshal.h"
#include "gedit-enum-types.h"
#include "gedit-settings.h"
#ifndef ENABLE_GVFS_METADATA
#include "gedit-metadata-manager.h"
......@@ -97,7 +97,10 @@ enum
static void open_async_read (AsyncData *async);
struct _GeditDocumentLoaderPrivate
{ GeditDocument *document;
{
GSettings *enc_settings;
GeditDocument *document;
gboolean used;
/* Info on the current file */
......@@ -230,6 +233,12 @@ gedit_document_loader_dispose (GObject *object)
g_object_unref (priv->location);
priv->location = NULL;
}
if (priv->enc_settings != NULL)
{
g_object_unref (priv->enc_settings);
priv->enc_settings = NULL;
}
G_OBJECT_CLASS (gedit_document_loader_parent_class)->dispose (object);
}
......@@ -306,6 +315,7 @@ gedit_document_loader_init (GeditDocumentLoader *loader)
loader->priv->auto_detected_newline_type = GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT;
loader->priv->converter = NULL;
loader->priv->error = NULL;
loader->priv->enc_settings = g_settings_new ("org.gnome.gedit.preferences.encodings");
}
GeditDocumentLoader *
......@@ -585,9 +595,16 @@ static GSList *
get_candidate_encodings (GeditDocumentLoader *loader)
{
const GeditEncoding *metadata;
GSList *encodings = NULL;
GSList *encodings;
gchar **enc_strv;
gsize len;
enc_strv = g_settings_get_strv (loader->priv->enc_settings,
GEDIT_SETTINGS_ENCODING_AUTO_DETECTED,
&len);
encodings = gedit_prefs_manager_get_auto_detected_encodings ();
encodings = _gedit_encoding_strv_to_list ((const gchar * const *)enc_strv);
g_strfreev (enc_strv);
metadata = get_metadata_encoding (loader);
if (metadata != NULL)
......
......@@ -39,11 +39,11 @@
#include "gedit-document-saver.h"
#include "gedit-document-input-stream.h"
#include "gedit-prefs-manager.h"
#include "gedit-debug.h"
#include "gedit-marshal.h"
#include "gedit-utils.h"
#include "gedit-enum-types.h"
#include "gedit-settings.h"
#define WRITE_CHUNK_SIZE 8192
......@@ -89,6 +89,8 @@ static void check_modified_async (AsyncData *async);
struct _GeditDocumentSaverPrivate
{
GSettings *editor_settings;
GFileInfo *info;
GeditDocument *document;
gboolean used;
......@@ -222,6 +224,12 @@ gedit_document_saver_dispose (GObject *object)
priv->location = NULL;
}
if (priv->editor_settings != NULL)
{
g_object_unref (priv->editor_settings);
priv->editor_settings = NULL;
}
G_OBJECT_CLASS (gedit_document_saver_parent_class)->dispose (object);
}
......@@ -340,6 +348,7 @@ gedit_document_saver_init (GeditDocumentSaver *saver)
saver->priv->cancellable = g_cancellable_new ();
saver->priv->error = NULL;
saver->priv->used = FALSE;
saver->priv->editor_settings = g_settings_new ("org.gnome.gedit.preferences.editor");
}
GeditDocumentSaver *
......@@ -942,7 +951,8 @@ gedit_document_saver_save (GeditDocumentSaver *saver,
if ((saver->priv->flags & GEDIT_DOCUMENT_SAVE_PRESERVE_BACKUP) != 0)
saver->priv->keep_backup = FALSE;
else
saver->priv->keep_backup = gedit_prefs_manager_get_create_backup_copy ();
saver->priv->keep_backup = g_settings_get_boolean (saver->priv->editor_settings,
GEDIT_SETTINGS_CREATE_BACKUP_COPY);
saver->priv->old_mtime = *old_mtime;
......
......@@ -40,7 +40,7 @@
#include <glib/gi18n.h>
#include <gtksourceview/gtksourceiter.h>
#include "gedit-prefs-manager-app.h"
#include "gedit-settings.h"
#include "gedit-document.h"
#include "gedit-debug.h"
#include "gedit-utils.h"
......@@ -103,7 +103,10 @@ static void delete_range_cb (GeditDocument *doc,
struct _GeditDocumentPrivate
{
GSettings *editor_settings;
GFile *location;
gint untitled_number;
gchar *short_name;
......@@ -288,6 +291,12 @@ gedit_document_dispose (GObject *object)
g_object_unref (doc->priv->loader);
doc->priv->loader = NULL;
}
if (doc->priv->editor_settings)
{
g_object_unref (doc->priv->editor_settings);
doc->priv->editor_settings = NULL;
}
if (doc->priv->metadata_info != NULL)
{
......@@ -689,8 +698,15 @@ set_language (GeditDocument *doc,
gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (doc), lang);
if (lang != NULL)
{
gboolean syntax_hl;
syntax_hl = g_settings_get_boolean (doc->priv->editor_settings,
GEDIT_SETTINGS_SYNTAX_HIGHLIGHTING);
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc),
gedit_prefs_manager_get_enable_syntax_highlighting ());
syntax_hl);
}
else
gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (doc),
FALSE);
......@@ -733,14 +749,14 @@ set_encoding (GeditDocument *doc,
}
static GtkSourceStyleScheme *
get_default_style_scheme (void)
get_default_style_scheme (GSettings *editor_settings)
{
gchar *scheme_id;
GtkSourceStyleScheme *def_style;
GtkSourceStyleSchemeManager *manager;
manager = gedit_get_style_scheme_manager ();
scheme_id = gedit_prefs_manager_get_source_style_scheme ();
scheme_id = g_settings_get_string (editor_settings, GEDIT_SETTINGS_SCHEME);
def_style = gtk_source_style_scheme_manager_get_scheme (manager,
scheme_id);
......@@ -887,10 +903,15 @@ static void
gedit_document_init (GeditDocument *doc)
{
GtkSourceStyleScheme *style_scheme;
gint undo_actions;
gboolean bracket_matching;
gboolean search_hl;
gedit_debug (DEBUG_DOCUMENT);
doc->priv = GEDIT_DOCUMENT_GET_PRIVATE (doc);
doc->priv->editor_settings = g_settings_new ("org.gnome.gedit.preferences.editor");
doc->priv->location = NULL;
doc->priv->untitled_number = get_untitled_number ();
......@@ -917,16 +938,23 @@ gedit_document_init (GeditDocument *doc)
doc->priv->newline_type = GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT;
g_settings_get (doc->priv->editor_settings, GEDIT_SETTINGS_MAX_UNDO_ACTIONS,
"u", &undo_actions);
bracket_matching = g_settings_get_boolean (doc->priv->editor_settings,
GEDIT_SETTINGS_BRACKET_MATCHING);
search_hl = g_settings_get_boolean (doc->priv->editor_settings,
GEDIT_SETTINGS_SEARCH_HIGHLIGHTING);
gtk_source_buffer_set_max_undo_levels (GTK_SOURCE_BUFFER (doc),
gedit_prefs_manager_get_undo_actions_limit ());
undo_actions);
gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (doc),
gedit_prefs_manager_get_bracket_matching ());
bracket_matching);
gedit_document_set_enable_search_highlighting (doc,
gedit_prefs_manager_get_enable_search_highlighting ());
search_hl);
style_scheme = get_default_style_scheme ();
style_scheme = get_default_style_scheme (doc->priv->editor_settings);
if (style_scheme != NULL)
gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (doc),
style_scheme);
......@@ -1256,6 +1284,7 @@ document_loader_loaded (GeditDocumentLoader *loader,
{
GtkTextIter iter;
GFileInfo *info;
gboolean restore_cursor;
const gchar *content_type = NULL;
gboolean read_only = FALSE;
GTimeVal mtime = {0, 0};
......@@ -1291,6 +1320,9 @@ document_loader_loaded (GeditDocumentLoader *loader,
set_newline_type (doc,
gedit_document_loader_get_newline_type (loader));
restore_cursor = g_settings_get_boolean (doc->priv->editor_settings,
GEDIT_SETTINGS_RESTORE_CURSOR_POSITION);
/* move the cursor at the requested line if any */
if (doc->priv->requested_line_pos > 0)
{
......@@ -1305,7 +1337,7 @@ document_loader_loaded (GeditDocumentLoader *loader,
column);
}
/* else, if enabled, to the position stored in the metadata */
else if (gedit_prefs_manager_get_restore_cursor_position ())
else if (restore_cursor)
{
gchar *pos;
gint offset;
......
......@@ -37,8 +37,9 @@
#include <gtk/gtk.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"
#include "gseal-gtk-compat.h"
......@@ -50,6 +51,8 @@
struct _GeditEncodingsComboBoxPrivate
{
GSettings *enc_settings;
GtkListStore *store;
glong changed_id;
......@@ -255,6 +258,8 @@ update_menu (GeditEncodingsComboBox *menu)
gchar *str;
const GeditEncoding *utf8_encoding;
const GeditEncoding *current_encoding;
gchar **enc_strv;
gsize len;