[Xfce4-commits] [apps/mousepad] 25/45: Re-write MousepadSettings to use multiple child schemas

noreply at xfce.org noreply at xfce.org
Fri Jul 11 13:03:30 CEST 2014


This is an automated email from the git hooks/post-receive script.

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit d80b40b95542d8a55c75293e0e1a4bc6ba730877
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Mon Jul 7 01:39:50 2014 -0700

    Re-write MousepadSettings to use multiple child schemas
    
    For view settings, window settings, search state, and window state.
    MousepadSettings no longer is a GSettings subclass but rather contains
    a GSettings instance for each of the new child schemas.
    
    Also add constants MOUSEPAD_SETTING_* and MOUSEPAD_STATE_* to use
    in code in order to reduce changes of a typo slipping by unnoticed.
---
 mousepad/mousepad-application.c        |    6 -
 mousepad/mousepad-document.c           |    3 +-
 mousepad/mousepad-private.h            |   17 ++-
 mousepad/mousepad-replace-dialog.c     |   29 +++--
 mousepad/mousepad-search-bar.c         |    8 +-
 mousepad/mousepad-settings.c           |  218 ++++++++++++++++++++++++++------
 mousepad/mousepad-settings.h           |  106 ++++++++++++----
 mousepad/mousepad-view.c               |   39 +++---
 mousepad/mousepad-window.c             |  110 ++++++++++------
 mousepad/org.xfce.Mousepad.gschema.xml |  216 +++++++++++++++----------------
 10 files changed, 494 insertions(+), 258 deletions(-)

diff --git a/mousepad/mousepad-application.c b/mousepad/mousepad-application.c
index 24c9e64..cf0ee44 100644
--- a/mousepad/mousepad-application.c
+++ b/mousepad/mousepad-application.c
@@ -86,9 +86,6 @@ mousepad_application_init (MousepadApplication *application)
       /* cleanup */
       g_free (filename);
     }
-
-    /* Initialize the MousepadSettings singleton if not already initialized */
-    MOUSEPAD_GSETTINGS_ONCE_INIT ();
 }
 
 
@@ -126,9 +123,6 @@ mousepad_application_finalize (GObject *object)
   /* cleanup the list of windows */
   g_slist_free (application->windows);
 
-  /* Flush GSettings to disk */
-  MOUSEPAD_GSETTINGS_SYNC ();
-
   (*G_OBJECT_CLASS (mousepad_application_parent_class)->finalize) (object);
 }
 
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index d363ce7..0d2819e 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -260,7 +260,8 @@ mousepad_document_notify_cursor_position (GtkTextBuffer    *buffer,
   line = gtk_text_iter_get_line (&iter) + 1;
 
   /* get the tab size */
-  tab_size = mousepad_settings_get_int ("view-tab-width");
+  tab_size = mousepad_settings_get_int (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                        MOUSEPAD_SETTING_TAB_WIDTH);
 
   /* get the column */
   column = mousepad_util_get_real_line_offset (&iter, tab_size);
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 28bcf84..5fddbd1 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -122,10 +122,19 @@ enum
 #define mousepad_widget_set_tooltip_text(widget,text) (mousepad_util_set_tooltip (widget, text))
 #endif
 
-/* settings */
-#define MOUSEPAD_GSETTINGS (G_SETTINGS (mousepad_settings_get_default ()))
-#define MOUSEPAD_GSETTINGS_ONCE_INIT() do { (void) MOUSEPAD_GSETTINGS; } while (0)
-#define MOUSEPAD_GSETTINGS_SYNC() do { g_settings_sync (); } while (0)
+/* Access to the various GSettings instances */
+#define MOUSEPAD_VIEW_SETTINGS \
+  (mousepad_settings_get_from_schema (mousepad_settings_get_default (), \
+                                      MOUSEPAD_SCHEMA_VIEW_SETTINGS))
+#define MOUSEPAD_WINDOW_SETTINGS \
+  (mousepad_settings_get_from_schema (mousepad_settings_get_default (), \
+                                      MOUSEPAD_SCHEMA_WINDOW_SETTINGS))
+#define MOUSEPAD_SEARCH_STATE_SETTINGS \
+  (mousepad_settings_get_from_schema (mousepad_settings_get_default (), \
+                                      MOUSEPAD_SCHEMA_SEARCH_STATE))
+#define MOUSEPAD_WINDOW_STATE_SETTINGS \
+  (mousepad_settings_get_from_schema (mousepad_settings_get_default (), \
+                                      MOUSEPAD_SCHEMA_WINDOW_STATE))
 
 G_END_DECLS
 
diff --git a/mousepad/mousepad-replace-dialog.c b/mousepad/mousepad-replace-dialog.c
index 17c8139..bac000f 100644
--- a/mousepad/mousepad-replace-dialog.c
+++ b/mousepad/mousepad-replace-dialog.c
@@ -126,11 +126,13 @@ mousepad_replace_dialog_bind_setting (MousepadReplaceDialog *dialog,
 {
   gchar *signal_name;
 
-  mousepad_settings_bind (key, object, property, G_SETTINGS_BIND_DEFAULT);
+  mousepad_settings_bind (MOUSEPAD_SCHEMA_SEARCH_STATE, key,
+                          object, property,
+                          G_SETTINGS_BIND_DEFAULT);
 
   signal_name = g_strdup_printf ("changed::%s", key);
 
-  g_signal_connect_swapped (MOUSEPAD_GSETTINGS,
+  g_signal_connect_swapped (MOUSEPAD_SEARCH_STATE_SETTINGS,
                             signal_name,
                             G_CALLBACK (mousepad_replace_dialog_settings_changed),
                             dialog);
@@ -227,7 +229,7 @@ mousepad_replace_dialog_init (MousepadReplaceDialog *dialog)
   gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Both"));
   gtk_widget_show (combo);
 
-  mousepad_replace_dialog_bind_setting (dialog, "search-direction", combo, "active");
+  mousepad_replace_dialog_bind_setting (dialog, MOUSEPAD_STATE_SEARCH_DIRECTION, combo, "active");
 
   /* release size group */
   g_object_unref (G_OBJECT (size_group));
@@ -237,14 +239,14 @@ mousepad_replace_dialog_init (MousepadReplaceDialog *dialog)
   gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
   gtk_widget_show (check);
 
-  mousepad_replace_dialog_bind_setting (dialog, "search-match-case", check, "active");
+  mousepad_replace_dialog_bind_setting (dialog, MOUSEPAD_STATE_SEARCH_MATCH_CASE, check, "active");
 
   /* match whole word */
   check = gtk_check_button_new_with_mnemonic (_("_Match whole word"));
   gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
   gtk_widget_show (check);
 
-  mousepad_replace_dialog_bind_setting (dialog, "search-match-whole-word", check, "active");
+  mousepad_replace_dialog_bind_setting (dialog, MOUSEPAD_STATE_SEARCH_MATCH_WHOLE_WORD, check, "active");
 
   /* horizontal box for the replace all options */
   hbox = gtk_hbox_new (FALSE, 8);
@@ -255,7 +257,7 @@ mousepad_replace_dialog_init (MousepadReplaceDialog *dialog)
   gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
   gtk_widget_show (check);
 
-  mousepad_replace_dialog_bind_setting (dialog, "search-replace-all", check, "active");
+  mousepad_replace_dialog_bind_setting (dialog, MOUSEPAD_STATE_SEARCH_REPLACE_ALL, check, "active");
 
   combo = dialog->search_location_combo = gtk_combo_box_new_text ();
   gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
@@ -265,7 +267,7 @@ mousepad_replace_dialog_init (MousepadReplaceDialog *dialog)
   gtk_widget_set_sensitive (combo, FALSE);
   gtk_widget_show (combo);
 
-  mousepad_replace_dialog_bind_setting (dialog, "search-replace-all-location", combo, "active");
+  mousepad_replace_dialog_bind_setting (dialog, MOUSEPAD_STATE_SEARCH_REPLACE_ALL_LOCATION, combo, "active");
 
   label = dialog->hits_label = gtk_label_new (NULL);
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -320,11 +322,11 @@ mousepad_replace_dialog_response (GtkWidget *widget,
   gboolean               match_case, match_whole_word, replace_all;
 
   /* read the search settings */
-  search_direction = mousepad_settings_get_int ("search-direction");
-  replace_all_location = mousepad_settings_get_int ("search-replace-all-location");
-  match_case = mousepad_settings_get_boolean ("search-match-case");
-  match_whole_word = mousepad_settings_get_boolean ("search-match-whole-word");
-  replace_all = mousepad_settings_get_boolean ("search-replace-all");
+  search_direction = mousepad_settings_get_int (MOUSEPAD_SCHEMA_SEARCH_STATE, MOUSEPAD_STATE_SEARCH_DIRECTION);
+  replace_all_location = mousepad_settings_get_int (MOUSEPAD_SCHEMA_SEARCH_STATE, MOUSEPAD_STATE_SEARCH_REPLACE_ALL_LOCATION);
+  match_case = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_SEARCH_STATE, MOUSEPAD_STATE_SEARCH_MATCH_CASE);
+  match_whole_word = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_SEARCH_STATE, MOUSEPAD_STATE_SEARCH_MATCH_WHOLE_WORD);
+  replace_all = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_SEARCH_STATE, MOUSEPAD_STATE_SEARCH_REPLACE_ALL);
 
   /* close dialog */
   if (response_id == MOUSEPAD_RESPONSE_CLOSE)
@@ -446,7 +448,8 @@ mousepad_replace_dialog_changed (MousepadReplaceDialog *dialog)
   gboolean     sensitive;
   gboolean     replace_all;
 
-  replace_all = mousepad_settings_get_boolean ("search-replace-all");
+  replace_all = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_SEARCH_STATE,
+                                               MOUSEPAD_STATE_SEARCH_REPLACE_ALL);
 
   /* set the sensitivity of some dialog widgets */
   gtk_widget_set_sensitive (dialog->search_location_combo, replace_all);
diff --git a/mousepad/mousepad-search-bar.c b/mousepad/mousepad-search-bar.c
index f01d36d..6654a13 100644
--- a/mousepad/mousepad-search-bar.c
+++ b/mousepad/mousepad-search-bar.c
@@ -160,7 +160,8 @@ mousepad_search_bar_init (MousepadSearchBar *bar)
   gboolean     match_case;
 
   /* load some preferences */
-  match_case = mousepad_settings_get_boolean ("search-match-case");
+  match_case = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_SEARCH_STATE,
+                                              MOUSEPAD_STATE_SEARCH_MATCH_CASE);
 
   /* init variables */
   bar->highlight_id = 0;
@@ -240,7 +241,10 @@ mousepad_search_bar_init (MousepadSearchBar *bar)
   gtk_widget_show (check);
 
   /* keep the widgets in sync with the GSettings */
-  mousepad_settings_bind ("search-match-case", check, "active", G_SETTINGS_BIND_DEFAULT);
+  mousepad_settings_bind (MOUSEPAD_SCHEMA_SEARCH_STATE,
+                          MOUSEPAD_STATE_SEARCH_MATCH_CASE,
+                          check, "active",
+                          G_SETTINGS_BIND_DEFAULT);
 
   /* overflow menu item for when window is too narrow to show the tool bar item */
   bar->match_case_entry = menuitem = gtk_check_menu_item_new_with_mnemonic (_("Mat_ch Case"));
diff --git a/mousepad/mousepad-settings.c b/mousepad/mousepad-settings.c
index 526a77c..183bb96 100644
--- a/mousepad/mousepad-settings.c
+++ b/mousepad/mousepad-settings.c
@@ -11,14 +11,15 @@
 
 struct MousepadSettings_
 {
-  GSettings parent;
+  GObject parent;
+  GSettings *settings[MOUSEPAD_NUM_SCHEMAS];
 };
 
 
 
 struct MousepadSettingsClass_
 {
-  GSettingsClass parent_class;
+  GObjectClass parent_class;
 };
 
 
@@ -27,15 +28,46 @@ static void mousepad_settings_finalize (GObject *object);
 
 
 
-G_DEFINE_TYPE (MousepadSettings, mousepad_settings, G_TYPE_SETTINGS)
+G_DEFINE_TYPE (MousepadSettings, mousepad_settings, G_TYPE_OBJECT)
 
 
 
-/* Global GSettings subclass instance, accessed by mousepad_settings_get_default() */
+/* Global instance, accessed by mousepad_settings_get_default() */
 static MousepadSettings *default_settings = NULL;
 
 
 
+static const gchar *mousepad_schema_ids[MOUSEPAD_NUM_SCHEMAS] =
+{
+  "org.xfce.mousepad.preferences.view",
+  "org.xfce.mousepad.preferences.window",
+  "org.xfce.mousepad.state.search",
+  "org.xfce.mousepad.state.window"
+};
+
+
+
+GType
+mousepad_schema_get_type (void)
+{
+  static GType type = 0;
+  if (G_UNLIKELY (type == 0))
+    {
+      static const GEnumValue values[] =
+      {
+        { MOUSEPAD_SCHEMA_VIEW_SETTINGS,   "MOUSEPAD_SCHEMA_VIEW_SETTINGS",   "view-settings" },
+        { MOUSEPAD_SCHEMA_WINDOW_SETTINGS, "MOUSEPAD_SCHEMA_WINDOW_SETTINGS", "window-settings" },
+        { MOUSEPAD_SCHEMA_SEARCH_STATE,    "MOUSEPAD_SCHEMA_SEARCH_STATE",    "search-state" },
+        { MOUSEPAD_SCHEMA_WINDOW_STATE,    "MOUSEPAD_SCHEMA_WINDOW_STATE",    "window-state" },
+        { 0, NULL, NULL }
+      };
+     type = g_enum_register_static ("MousepadSchema", values);
+    }
+  return type;
+}
+
+
+
 static void
 mousepad_settings_class_init (MousepadSettingsClass *klass)
 {
@@ -50,14 +82,19 @@ mousepad_settings_class_init (MousepadSettingsClass *klass)
 
 static void
 mousepad_settings_finalize (GObject *object)
-{/*
-  MousepadSettings *self;
-
-  g_return_if_fail (MOUSEPAD_IS_SETTINGS (object));
+{
+  gint i;
+  MousepadSettings *self = MOUSEPAD_SETTINGS (object);
 
-  self = MOUSEPAD_SETTINGS (object);
-*/
   G_OBJECT_CLASS (mousepad_settings_parent_class)->finalize (object);
+
+  g_settings_sync ();
+
+  for (i = 0; i < MOUSEPAD_NUM_SCHEMAS; i++)
+    {
+      if (G_IS_SETTINGS (self->settings[i]))
+        g_object_unref (self->settings[i]);
+    }
 }
 
 
@@ -65,6 +102,34 @@ mousepad_settings_finalize (GObject *object)
 static void
 mousepad_settings_init (MousepadSettings *self)
 {
+  gint i;
+
+#ifdef MOUSEPAD_SETTINGS_KEYFILE_BACKEND
+  GSettingsBackend *backend;
+  gchar *conf_file;
+
+  /* Path inside user's config directory */
+  conf_file = g_build_filename (g_get_user_config_dir (),
+                                "Mousepad",
+                                "settings.conf",
+                                NULL);
+
+  /* Create a keyfile backend */
+  backend = g_keyfile_settings_backend_new (conf_file, "/", NULL);
+  g_free (conf_file);
+
+  for (i = 0; i < MOUSEPAD_NUM_SCHEMAS; i++)
+    {
+      self->settings[i] = g_object_new (G_TYPE_SETTINGS,
+                                        "backend", backend,
+                                        "schema-id", mousepad_schema_ids[i],
+                                        NULL);
+      /* TODO: need to cleanup backend reference? */
+    }
+#else
+  for (i = 0; i < MOUSEPAD_NUM_SCHEMAS; i++)
+    self->settings[i] = g_settings_new (mousepad_schema_ids[i]);
+#endif
 }
 
 
@@ -73,9 +138,6 @@ mousepad_settings_init (MousepadSettings *self)
 static void
 mousepad_settings_cleanup_default (void)
 {
-  /* last-ditch attempt to save settings to disk */
-  MOUSEPAD_GSETTINGS_SYNC ();
-
   /* cleanup the singleton settings instance */
   if (MOUSEPAD_IS_SETTINGS (default_settings))
     {
@@ -126,33 +188,7 @@ mousepad_settings_get_default (void)
        * the schema so enforce this with the relevant environment variable. */
       mousepad_settings_update_gsettings_schema_dir ();
 
-#ifdef MOUSEPAD_SETTINGS_KEYFILE_BACKEND
-{
-      GSettingsBackend *backend;
-      gchar *conf_file;
-
-      /* Path inside user's config directory */
-      conf_file = g_build_filename (g_get_user_config_dir (),
-                                    "Mousepad",
-                                    "settings.conf",
-                                    NULL);
-
-      /* Create a keyfile backend */
-      backend = g_keyfile_settings_backend_new (conf_file, "/", NULL);
-      g_free (conf_file);
-
-      /* Construct the singleton instance with the keyfile backend */
-      default_settings = g_object_new (MOUSEPAD_TYPE_SETTINGS,
-                                       "backend", backend /* give ref to settings object */,
-                                       "schema-id", "org.xfce.Mousepad",
-                                       NULL);
-}
-#else
-      /* Use the default GSettings backend (eg. registry, dconf, user-defaults, etc) */
-      default_settings = g_object_new (MOUSEPAD_TYPE_SETTINGS,
-                                       "schema-id", "org.xfce.Mousepad",
-                                       NULL);
-#endif
+      default_settings = g_object_new (MOUSEPAD_TYPE_SETTINGS, NULL);
 
       /* Auto-cleanup at exit */
       atexit (mousepad_settings_cleanup_default);
@@ -165,3 +201,105 @@ mousepad_settings_get_default (void)
 
   return default_settings;
 }
+
+
+
+GSettings *
+mousepad_settings_get_from_schema (MousepadSettings *settings,
+                                   MousepadSchema    schema)
+{
+  g_return_val_if_fail (MOUSEPAD_IS_SETTINGS (settings), NULL);
+  g_return_val_if_fail (schema < MOUSEPAD_NUM_SCHEMAS, NULL);
+
+  return settings->settings[schema];
+}
+
+
+
+void
+mousepad_settings_bind (MousepadSchema     schema,
+                        const gchar       *key,
+                        gpointer           object,
+                        const gchar       *prop,
+                        GSettingsBindFlags flags)
+{
+  MousepadSettings *settings;
+  g_return_if_fail (schema < MOUSEPAD_NUM_SCHEMAS);
+  settings = mousepad_settings_get_default ();
+  g_settings_bind (settings->settings[schema], key, object, prop, flags);
+}
+
+
+
+gboolean
+mousepad_settings_get_boolean (MousepadSchema  schema,
+                               const gchar    *key)
+{
+  MousepadSettings *settings;
+  g_return_val_if_fail (schema < MOUSEPAD_NUM_SCHEMAS, FALSE);
+  settings = mousepad_settings_get_default ();
+  return g_settings_get_boolean (settings->settings[schema], key);
+}
+
+
+
+void
+mousepad_settings_set_boolean (MousepadSchema  schema,
+                               const gchar    *key,
+                               gboolean        value)
+{
+  MousepadSettings *settings;
+  g_return_if_fail (schema < MOUSEPAD_NUM_SCHEMAS);
+  settings = mousepad_settings_get_default ();
+  g_settings_set_boolean (settings->settings[schema], key, value);
+}
+
+
+
+gint
+mousepad_settings_get_int (MousepadSchema  schema,
+                           const gchar    *key)
+{
+  MousepadSettings *settings;
+  g_return_val_if_fail (schema < MOUSEPAD_NUM_SCHEMAS, FALSE);
+  settings = mousepad_settings_get_default ();
+  return g_settings_get_int (settings->settings[schema], key);
+}
+
+
+
+void
+mousepad_settings_set_int (MousepadSchema  schema,
+                           const gchar    *key,
+                           gint            value)
+{
+  MousepadSettings *settings;
+  g_return_if_fail (schema < MOUSEPAD_NUM_SCHEMAS);
+  settings = mousepad_settings_get_default ();
+  g_settings_set_int (settings->settings[schema], key, value);
+}
+
+
+
+gchar *
+mousepad_settings_get_string (MousepadSchema  schema,
+                              const gchar    *key)
+{
+  MousepadSettings *settings;
+  g_return_val_if_fail (schema < MOUSEPAD_NUM_SCHEMAS, FALSE);
+  settings = mousepad_settings_get_default ();
+  return g_settings_get_string (settings->settings[schema], key);
+}
+
+
+
+void
+mousepad_settings_set_string (MousepadSchema  schema,
+                              const gchar    *key,
+                              const gchar    *value)
+{
+  MousepadSettings *settings;
+  g_return_if_fail (schema < MOUSEPAD_NUM_SCHEMAS);
+  settings = mousepad_settings_get_default ();
+  g_settings_set_string (settings->settings[schema], key, value);
+}
diff --git a/mousepad/mousepad-settings.h b/mousepad/mousepad-settings.h
index 736680d..ac25be7 100644
--- a/mousepad/mousepad-settings.h
+++ b/mousepad/mousepad-settings.h
@@ -5,6 +5,19 @@
 
 G_BEGIN_DECLS
 
+typedef enum
+{
+  MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+  MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+  MOUSEPAD_SCHEMA_SEARCH_STATE,
+  MOUSEPAD_SCHEMA_WINDOW_STATE,
+  MOUSEPAD_NUM_SCHEMAS
+}
+MousepadSchema;
+
+GType mousepad_schema_get_type (void);
+#define MOUSEPAD_TYPE_SCHEMA (mousepad_schema_get_type ())
+
 #define MOUSEPAD_TYPE_SETTINGS            (mousepad_settings_get_type ())
 #define MOUSEPAD_SETTINGS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOUSEPAD_TYPE_SETTINGS, MousepadSettings))
 #define MOUSEPAD_SETTINGS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MOUSEPAD_TYPE_SETTINGS, MousepadSettingsClass))
@@ -15,32 +28,73 @@ G_BEGIN_DECLS
 typedef struct MousepadSettings_      MousepadSettings;
 typedef struct MousepadSettingsClass_ MousepadSettingsClass;
 
-GType             mousepad_settings_get_type (void);
-
-MousepadSettings *mousepad_settings_get_default (void);
-
-/* convenience wrappers for using the singleton settings */
-
-#define mousepad_settings_bind(key, object, prop, flags) \
-  g_settings_bind (G_SETTINGS (mousepad_settings_get_default ()), (key), (object), (prop), (flags))
-
-#define mousepad_settings_get_boolean(key) \
-  g_settings_get_boolean (G_SETTINGS (mousepad_settings_get_default ()), (key))
-
-#define mousepad_settings_set_boolean(key, value) \
-  g_settings_set_boolean (G_SETTINGS (mousepad_settings_get_default ()), (key), (value))
-
-#define mousepad_settings_get_int(key) \
-  g_settings_get_int (G_SETTINGS (mousepad_settings_get_default ()), (key))
-
-#define mousepad_settings_set_int(key, value) \
-  g_settings_set_int (G_SETTINGS (mousepad_settings_get_default ()), (key), (value))
-
-#define mousepad_settings_get_string(key) \
-  g_settings_get_string (G_SETTINGS (mousepad_settings_get_default ()), (key))
-
-#define mousepad_settings_set_string(key, value) \
-  g_settings_set_string (G_SETTINGS (mousepad_settings_get_default ()), (key), (value))
+GType             mousepad_settings_get_type        (void);
+
+MousepadSettings *mousepad_settings_get_default     (void);
+
+GSettings        *mousepad_settings_get_from_schema (MousepadSettings  *settings,
+                                                     MousepadSchema     schema);
+
+void              mousepad_settings_bind            (MousepadSchema     schema,
+                                                     const gchar       *key,
+                                                     gpointer           object,
+                                                     const gchar       *prop,
+                                                     GSettingsBindFlags flags);
+
+gboolean          mousepad_settings_get_boolean     (MousepadSchema     schema,
+                                                     const gchar       *key);
+
+void              mousepad_settings_set_boolean     (MousepadSchema     schema,
+                                                     const gchar       *key,
+                                                     gboolean           value);
+
+gint              mousepad_settings_get_int         (MousepadSchema     schema,
+                                                     const gchar       *key);
+
+void              mousepad_settings_set_int         (MousepadSchema     schema,
+                                                     const gchar       *key,
+                                                     gint               value);
+
+gchar            *mousepad_settings_get_string      (MousepadSchema     schema,
+                                                     const gchar       *key);
+
+void              mousepad_settings_set_string      (MousepadSchema     schema,
+                                                     const gchar       *key,
+                                                     const gchar       *value);
+
+/* Setting names */
+#define MOUSEPAD_SETTING_AUTO_INDENT            "auto-indent"
+#define MOUSEPAD_SETTING_FONT_NAME              "font-name"
+#define MOUSEPAD_SETTING_SHOW_WHITESPACE        "show-whitespace"
+#define MOUSEPAD_SETTING_SHOW_LINE_ENDINGS      "show-line-endings"
+#define MOUSEPAD_SETTING_HIGHLIGHT_CURRENT_LINE "highlight-current-line"
+#define MOUSEPAD_SETTING_INDENT_ON_TAB          "indent-on-tab"
+#define MOUSEPAD_SETTING_INDENT_WIDTH           "indent-width"
+#define MOUSEPAD_SETTING_INSERT_SPACES          "insert-spaces"
+#define MOUSEPAD_SETTING_RIGHT_MARGIN_POSITION  "right-margin-position"
+#define MOUSEPAD_SETTING_SHOW_LINE_MARKS        "show-line-marks"
+#define MOUSEPAD_SETTING_SHOW_LINE_NUMBERS      "show-line-numbers"
+#define MOUSEPAD_SETTING_SHOW_RIGHT_MARGIN      "show-right-margin"
+#define MOUSEPAD_SETTING_SMART_HOME_END         "smart-home-end"
+#define MOUSEPAD_SETTING_TAB_WIDTH              "tab-width"
+#define MOUSEPAD_SETTING_WORD_WRAP              "word-wrap"
+#define MOUSEPAD_SETTING_COLOR_SCHEME           "color-scheme"
+#define MOUSEPAD_SETTING_STATUSBAR_VISIBLE      "statusbar-visible"
+#define MOUSEPAD_SETTING_ALWAYS_SHOW_TABS       "always-show-tabs"
+#define MOUSEPAD_SETTING_CYCLE_TABS             "cycle-tabs"
+#define MOUSEPAD_SETTING_DEFAULT_TAB_SIZES      "default-tab-sizes"
+#define MOUSEPAD_SETTING_PATH_IN_TITLE          "path-in-title"
+#define MOUSEPAD_SETTING_RECENT_MENU_ITEMS      "recent-menu-items"
+#define MOUSEPAD_SETTING_REMEMBER_GEOMETRY      "remember-geometry"
+
+/* State setting names */
+#define MOUSEPAD_STATE_SEARCH_DIRECTION            "direction"
+#define MOUSEPAD_STATE_SEARCH_MATCH_CASE           "match-case"
+#define MOUSEPAD_STATE_SEARCH_MATCH_WHOLE_WORD     "match-whole-word"
+#define MOUSEPAD_STATE_SEARCH_REPLACE_ALL          "replace-all"
+#define MOUSEPAD_STATE_SEARCH_REPLACE_ALL_LOCATION "replace-all-location"
+#define MOUSEPAD_STATE_WINDOW_HEIGHT               "height"
+#define MOUSEPAD_STATE_WINDOW_WIDTH                "width"
 
 G_END_DECLS
 
diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index f5508f1..244f7a1 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -233,22 +233,29 @@ mousepad_view_init (MousepadView *view)
                     G_CALLBACK (mousepad_view_commit_handler), view);
 
   /* bind Gsettings */
-  mousepad_settings_bind ("view-auto-indent", view, "auto-indent", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-font-name", view, "font-name", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-show-whitespace", view, "show-whitespace", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-show-line-endings", view, "show-line-endings", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-highlight-current-line", view, "highlight-current-line", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-indent-on-tab", view, "indent-on-tab", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-indent-width", view, "indent-width", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-insert-spaces", view, "insert-spaces-instead-of-tabs", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-right-margin-position", view, "right-margin-position", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-show-line-marks", view, "show-line-marks", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-show-line-numbers", view, "show-line-numbers", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-show-right-margin", view, "show-right-margin", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-smart-home-end", view, "smart-home-end", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-tab-width", view, "tab-width", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-color-scheme", view, "color-scheme", G_SETTINGS_BIND_DEFAULT);
-  mousepad_settings_bind ("view-word-wrap", view, "word-wrap", G_SETTINGS_BIND_DEFAULT);
+#define BIND_(setting, prop) \
+  mousepad_settings_bind (MOUSEPAD_SCHEMA_VIEW_SETTINGS, \
+                          MOUSEPAD_SETTING_##setting, view, prop, \
+                          G_SETTINGS_BIND_DEFAULT)
+
+  BIND_ (AUTO_INDENT,            "auto-indent");
+  BIND_ (FONT_NAME,              "font-name");
+  BIND_ (SHOW_WHITESPACE,        "show-whitespace");
+  BIND_ (SHOW_LINE_ENDINGS,      "show-line-endings");
+  BIND_ (HIGHLIGHT_CURRENT_LINE, "highlight-current-line");
+  BIND_ (INDENT_ON_TAB,          "indent-on-tab");
+  BIND_ (INDENT_WIDTH,           "indent-width");
+  BIND_ (INSERT_SPACES,          "insert-spaces-instead-of-tabs");
+  BIND_ (RIGHT_MARGIN_POSITION,  "right-margin-position");
+  BIND_ (SHOW_LINE_MARKS,        "show-line-marks");
+  BIND_ (SHOW_LINE_NUMBERS,      "show-line-numbers");
+  BIND_ (SHOW_RIGHT_MARGIN,      "show-right-margin");
+  BIND_ (SMART_HOME_END,         "smart-home-end");
+  BIND_ (TAB_WIDTH,              "tab-width");
+  BIND_ (COLOR_SCHEME,           "color-scheme");
+  BIND_ (WORD_WRAP,              "word-wrap");
+
+#undef BIND_
 }
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 11d258b..5ac4085 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -572,8 +572,14 @@ mousepad_window_update_tabs (MousepadWindow   *window,
                              gchar            *key,
                              MousepadSettings *settings)
 {
-  gint     n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook));
-  gboolean always_show = mousepad_settings_get_boolean ("window-always-show-tabs");
+  gint     n_pages;
+  gboolean always_show;
+  
+  always_show = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+                                               MOUSEPAD_SETTING_ALWAYS_SHOW_TABS);
+
+  n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook));
+
   gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->notebook),
                               (n_pages > 1 || always_show) ? TRUE : FALSE);
 }
@@ -630,8 +636,8 @@ mousepad_window_init (MousepadWindow *window)
   g_closure_sink (window->menu_item_deselected_closure);
 
   /* read settings from the preferences */
-  width = mousepad_settings_get_int ("window-width");
-  height = mousepad_settings_get_int ("window-height");
+  width = mousepad_settings_get_int (MOUSEPAD_SCHEMA_WINDOW_STATE, MOUSEPAD_STATE_WINDOW_WIDTH);
+  height = mousepad_settings_get_int (MOUSEPAD_SCHEMA_WINDOW_STATE, MOUSEPAD_STATE_WINDOW_HEIGHT);
 
   /* set the default window size */
   gtk_window_set_default_size (GTK_WINDOW (window), width, height);
@@ -746,30 +752,30 @@ mousepad_window_init (MousepadWindow *window)
   g_signal_connect (G_OBJECT (window), "drag-data-received", G_CALLBACK (mousepad_window_drag_data_received), window);
 
   /* update the statusbar with certain settings */
-  g_signal_connect_swapped (MOUSEPAD_GSETTINGS,
-                            "changed::view-tab-width",
+  g_signal_connect_swapped (MOUSEPAD_VIEW_SETTINGS,
+                            "changed::" MOUSEPAD_SETTING_TAB_WIDTH,
                             G_CALLBACK (mousepad_window_update_statusbar_settings),
                             window);
-  g_signal_connect_swapped (MOUSEPAD_GSETTINGS,
-                            "changed::view-insert-spaces",
+  g_signal_connect_swapped (MOUSEPAD_VIEW_SETTINGS,
+                            "changed::" MOUSEPAD_SETTING_INSERT_SPACES,
                             G_CALLBACK (mousepad_window_update_statusbar_settings),
                             window);
 
   /* update the window title when 'path-in-title' setting changes */
-  g_signal_connect_swapped (MOUSEPAD_GSETTINGS,
-                            "changed::window-path-in-title",
+  g_signal_connect_swapped (MOUSEPAD_WINDOW_SETTINGS,
+                            "changed::" MOUSEPAD_SETTING_PATH_IN_TITLE,
                             G_CALLBACK (mousepad_window_update_window_title),
                             window);
 
   /* update the tabs when 'always-show-tabs' setting changes */
-  g_signal_connect_swapped (MOUSEPAD_GSETTINGS,
-                            "changed::window-always-show-tabs",
+  g_signal_connect_swapped (MOUSEPAD_WINDOW_SETTINGS,
+                            "changed::" MOUSEPAD_SETTING_ALWAYS_SHOW_TABS,
                             G_CALLBACK (mousepad_window_update_tabs),
                             window);
 
   /* update the recent items menu when 'window-recent-menu-items' setting changes */
-  g_signal_connect_swapped (MOUSEPAD_GSETTINGS,
-                            "changed::window-recent-menu-items",
+  g_signal_connect_swapped (MOUSEPAD_WINDOW_SETTINGS,
+                            "changed::" MOUSEPAD_SETTING_RECENT_MENU_ITEMS,
                             G_CALLBACK (mousepad_window_update_recent_menu),
                             window);
 }
@@ -967,7 +973,8 @@ mousepad_window_save_geometry_timer (gpointer user_data)
   GDK_THREADS_ENTER ();
 
   /* check if we should remember the window geometry */
-  remember_geometry = mousepad_settings_get_boolean ("window-remember-geometry");
+  remember_geometry = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+                                                     MOUSEPAD_SETTING_REMEMBER_GEOMETRY);
   if (G_LIKELY (remember_geometry))
     {
       /* check if the window is still visible */
@@ -983,8 +990,8 @@ mousepad_window_save_geometry_timer (gpointer user_data)
               gtk_window_get_size (GTK_WINDOW (window), &width, &height);
 
               /* ...and remember them as default for new windows */
-              mousepad_settings_set_int ("window-width", width);
-              mousepad_settings_set_int ("window-height", height);
+              mousepad_settings_set_int (MOUSEPAD_SCHEMA_WINDOW_STATE, MOUSEPAD_STATE_WINDOW_WIDTH, width);
+              mousepad_settings_set_int (MOUSEPAD_SCHEMA_WINDOW_STATE, MOUSEPAD_STATE_WINDOW_HEIGHT, height);
             }
         }
     }
@@ -1343,7 +1350,8 @@ mousepad_window_set_title (MousepadWindow *window)
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
 
   /* whether to show the full path */
-  show_full_path = mousepad_settings_get_boolean ("window-path-in-title");
+  show_full_path = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+                                                  MOUSEPAD_SETTING_PATH_IN_TITLE);
 
   /* name we display in the title */
   if (G_UNLIKELY (show_full_path && mousepad_document_get_filename (document)))
@@ -2088,7 +2096,8 @@ mousepad_window_menu_tab_sizes (MousepadWindow *window)
   lock_menu_updates++;
 
   /* get the default tab sizes and active tab size */
-  tmp = mousepad_settings_get_string ("window-default-tab-sizes");
+  tmp = mousepad_settings_get_string (MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+                                      MOUSEPAD_SETTING_DEFAULT_TAB_SIZES);
 
   /* get sizes array and free the temp string */
   tab_sizes = g_strsplit (tmp, ",", -1);
@@ -2161,7 +2170,8 @@ mousepad_window_menu_tab_sizes_update (MousepadWindow *window)
   lock_menu_updates++;
 
   /* get tab size of active document */
-  tab_size = mousepad_settings_get_int ("view-tab-width");
+  tab_size = mousepad_settings_get_int (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                        MOUSEPAD_SETTING_TAB_WIDTH);
 
   /* check if there is a default item with this number */
   name = g_strdup_printf ("tab-size_%d", tab_size);
@@ -2271,7 +2281,8 @@ mousepad_window_update_actions (MousepadWindow *window)
       page_num = gtk_notebook_page_num (notebook, GTK_WIDGET (document));
 
       /* whether we cycle tabs */
-      cycle_tabs = mousepad_settings_get_boolean ("window-cycle-tabs");
+      cycle_tabs = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+                                                  MOUSEPAD_SETTING_CYCLE_TABS);
 
       /* set the sensitivity of the back and forward buttons in the go menu */
       action = gtk_action_group_get_action (window->action_group, "back");
@@ -2309,22 +2320,26 @@ mousepad_window_update_actions (MousepadWindow *window)
       gtk_action_set_sensitive (action, sensitive);
 
       /* toggle the document settings */
-      active = mousepad_settings_get_boolean ("view-word-wrap");
+      active = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                              MOUSEPAD_SETTING_WORD_WRAP);
       action = gtk_action_group_get_action (window->action_group, "word-wrap");
       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
 
-      active = mousepad_settings_get_boolean ("view-show-line-numbers");
+      active = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                              MOUSEPAD_SETTING_SHOW_LINE_NUMBERS);
       action = gtk_action_group_get_action (window->action_group, "line-numbers");
       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
 
-      active = mousepad_settings_get_boolean ("view-auto-indent");
+      active = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                              MOUSEPAD_SETTING_AUTO_INDENT);
       action = gtk_action_group_get_action (window->action_group, "auto-indent");
       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
 
       /* update the tabs size menu */
       mousepad_window_menu_tab_sizes_update (window);
 
-      active = mousepad_settings_get_boolean ("view-insert-spaces");
+      active = mousepad_settings_get_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                              MOUSEPAD_SETTING_INSERT_SPACES);
       action = gtk_action_group_get_action (window->action_group, "insert-spaces");
       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
 
@@ -2601,7 +2616,8 @@ mousepad_window_recent_menu_idle (gpointer user_data)
     }
 
   /* get the recent menu limit number */
-  n = mousepad_settings_get_int ("window-recent-menu-items");
+  n = mousepad_settings_get_int (MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+                                 MOUSEPAD_SETTING_RECENT_MENU_ITEMS);
 
   /* append the items to the menu */
   for (li = filtered, i = 1; n > 0 && li != NULL; li = li->next)
@@ -3255,7 +3271,8 @@ mousepad_window_menu_color_schemes (MousepadWindow *window)
   lock_menu_updates++;
 
   /* get the previously saved colour scheme name */
-  selected_color_scheme = mousepad_settings_get_string ("view-color-scheme");
+  selected_color_scheme = mousepad_settings_get_string (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                                        MOUSEPAD_SETTING_COLOR_SCHEME);
 
   /* get list of schemes */
   schemes = mousepad_util_color_schemes_get_sorted ();
@@ -3478,7 +3495,10 @@ mousepad_window_create_statusbar (MousepadWindow *window)
 
   /* bind the GSetting to the GtkAction that controls the statusbar */
   action = gtk_action_group_get_action (window->action_group, "statusbar");
-  mousepad_settings_bind ("window-statusbar-visible", action, "active", G_SETTINGS_BIND_DEFAULT);
+  mousepad_settings_bind (MOUSEPAD_SCHEMA_WINDOW_SETTINGS,
+                          MOUSEPAD_SETTING_STATUSBAR_VISIBLE,
+                          action, "active",
+                          G_SETTINGS_BIND_DEFAULT);
 
   /* pack the statusbar into the window UI */
   gtk_box_pack_end (GTK_BOX (window->box), window->statusbar, FALSE, FALSE, 0);
@@ -4502,7 +4522,8 @@ mousepad_window_action_select_font (GtkAction      *action,
   gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
 
   /* set the current font name */
-  font_name = mousepad_settings_get_string ("view-font-name");
+  font_name = mousepad_settings_get_string (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                            MOUSEPAD_SETTING_FONT_NAME);
   if (G_LIKELY (font_name))
     {
       gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (dialog), font_name);
@@ -4516,7 +4537,9 @@ mousepad_window_action_select_font (GtkAction      *action,
       font_name = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (dialog));
 
       /* store the font in the preferences */
-      mousepad_settings_set_string ("view-font-name", font_name);
+      mousepad_settings_set_string (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                    MOUSEPAD_SETTING_FONT_NAME,
+                                    font_name);
 
       /* cleanup */
       g_free (font_name);
@@ -4562,7 +4585,8 @@ mousepad_window_action_color_scheme (GtkToggleAction *action,
         }
 
       /* store as last used value */
-      mousepad_settings_set_string ("view-color-scheme",
+      mousepad_settings_set_string (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                    MOUSEPAD_SETTING_COLOR_SCHEME,
                                     (scheme != NULL) ?
                                     gtk_source_style_scheme_get_id (scheme) :
                                     "none");
@@ -4584,7 +4608,9 @@ mousepad_window_action_line_numbers (GtkToggleAction *action,
   active = gtk_toggle_action_get_active (action);
 
   /* save as the last used line number setting */
-  mousepad_settings_set_boolean ("view-show-line-numbers", active);
+  mousepad_settings_set_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                 MOUSEPAD_SETTING_SHOW_LINE_NUMBERS,
+                                 active);
 }
 
 
@@ -4801,7 +4827,9 @@ mousepad_window_action_auto_indent (GtkToggleAction *action,
   active = gtk_toggle_action_get_active (action);
 
   /* save as the last auto indent mode */
-  mousepad_settings_set_boolean ("view-auto-indent", active);
+  mousepad_settings_set_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                 MOUSEPAD_SETTING_AUTO_INDENT,
+                                 active);
 }
 
 
@@ -4854,14 +4882,17 @@ mousepad_window_action_tab_size (GtkToggleAction *action,
       if (tab_size == 0)
         {
           /* get tab size from document */
-          tab_size = mousepad_settings_get_int ("view-tab-width");
+          tab_size = mousepad_settings_get_int (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                                MOUSEPAD_SETTING_TAB_WIDTH);
 
           /* select other size in dialog */
           tab_size = mousepad_dialogs_other_tab_size (GTK_WINDOW (window), tab_size);
         }
 
       /* store as last used value */
-      mousepad_settings_set_int ("view-tab-width", tab_size);
+      mousepad_settings_set_int (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                 MOUSEPAD_SETTING_TAB_WIDTH,
+                                 tab_size);
 
       /* update menu */
       mousepad_window_menu_tab_sizes_update (window);
@@ -4886,7 +4917,9 @@ mousepad_window_action_word_wrap (GtkToggleAction *action,
       active = gtk_toggle_action_get_active (action);
 
       /* store this as the last used wrap mode */
-      mousepad_settings_set_boolean ("view-word-wrap", active);
+      mousepad_settings_set_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                     MOUSEPAD_SETTING_WORD_WRAP,
+                                     active);
     }
 }
 
@@ -4969,13 +5002,14 @@ mousepad_window_action_insert_spaces (GtkToggleAction *action,
       insert_spaces = gtk_toggle_action_get_active (action);
 
       /* save as the last auto indent mode */
-      mousepad_settings_set_boolean ("view-insert-spaces", insert_spaces);
+      mousepad_settings_set_boolean (MOUSEPAD_SCHEMA_VIEW_SETTINGS,
+                                     MOUSEPAD_SETTING_INSERT_SPACES,
+                                     insert_spaces);
     }
 }
 
 
 
-
 static void
 mousepad_window_action_prev_tab (GtkAction      *action,
                                  MousepadWindow *window)
diff --git a/mousepad/org.xfce.Mousepad.gschema.xml b/mousepad/org.xfce.Mousepad.gschema.xml
index 724ab44..bf93dac 100644
--- a/mousepad/org.xfce.Mousepad.gschema.xml
+++ b/mousepad/org.xfce.Mousepad.gschema.xml
@@ -1,78 +1,39 @@
 <schemalist>
 
   <!-- Enums and flags -->
-  
-  <enum id="org.xfce.Mousepad.SmartHomeEnd">
+
+  <enum id="org.xfce.mousepad.SmartHomeEnd">
     <value nick="disabled" value="0"/>
     <value nick="before" value="1"/>
     <value nick="after" value="2"/>
     <value nick="always" value="3"/>
   </enum>
 
-  <schema id="org.xfce.Mousepad" path="/org/xfce/Mousepad/" gettext-domain="mousepad">
-
-    <!-- Search preferences -->
-
-    <key name="search-direction" type="i">
-      <range min="0" max="2"/>
-      <default>1</default>
-      <summary>Search direction</summary>
-      <description>
-        When 0 the search direction is backwards/upwards, when 1 the search
-        direction is forwards/downwards, when 2 the search will wrap around.
-      </description>
-    </key>
-
-    <key name="search-match-case" type="b">
-      <default>false</default>
-      <summary>Match case</summary>
-      <description>
-        When true searches will be case-sensitive, when false they will
-        be case-insensitive.
-      </description>
-    </key>
-
-    <key name="search-match-whole-word" type="b">
-      <default>false</default>
-      <summary>Match whole word</summary>
-      <description>
-        When true searches must match an entire word (using default word
-        boundary characters), when false matches can occur anywhere, even
-        within a larger word.
-      </description>
-    </key>
-
-    <key name="search-replace-all" type="b">
-      <default>false</default>
-      <summary>Replace all</summary>
-      <description>
-        When true the Replace search dialog is in "replace-all" mode, when
-        false the dialog is in "replace-one-at-a-time" mode.
-      </description>
-    </key>
+  <schema id="org.xfce.mousepad" path="/org/xfce/mousepad/" gettext-domain="mousepad">
+    <child name="preferences" schema="org.xfce.mousepad.preferences"/>
+    <child name="state" schema="org.xfce.mousepad.state"/>
+  </schema>
 
-    <key name="search-replace-all-location" type="i">
-      <range min="0" max="2"/>
-      <default>1</default>
-      <summary>Replace-all location</summary>
-      <description>
-        When 0 the replace-all is performed within the current selection, when
-        1 the replace-all is performed in the current document, and when 2
-        the replace-all is performed in all currently open documents.
-      </description>
-    </key>
+  <schema id="org.xfce.mousepad.preferences" path="/org/xfce/mousepad/preferences/" gettext-domain="mousepad">
+    <child name="view" schema="org.xfce.mousepad.preferences.view"/>
+    <child name="window" schema="org.xfce.mousepad.preferences.window"/>
+  </schema>
 
-    <!-- Textview preferences -->
+  <schema id="org.xfce.mousepad.state" path="/org/xfce/mousepad/state/" gettext-domain="mousepad">
+    <child name="search" schema="org.xfce.mousepad.state.search"/>
+    <child name="window" schema="org.xfce.mousepad.state.window"/>
+  </schema>
 
-    <key name="view-auto-indent" type="b">
+  <!-- Textview preferences -->
+  <schema id="org.xfce.mousepad.preferences.view" path="/org/xfce/mousepad/preferences/view/" gettext-domain="mousepad">
+    <key name="auto-indent" type="b">
       <default>false</default>
       <summary>Auto-indentation</summary>
       <description>
         When true auto-indentation is enabled, when false it is not.
       </description>
     </key>
-
-    <key name="view-font-name" type="s">
+    <key name="font-name" type="s">
       <default>'Monospace'</default>
       <summary>Font name</summary>
       <description>
@@ -80,8 +41,7 @@
         font description syntax for greater control.
       </description>
     </key>
-
-    <key name="view-show-whitespace" type="b">
+    <key name="show-whitespace" type="b">
       <default>false</default>
       <summary>Show whitespace</summary>
       <description>
@@ -89,8 +49,7 @@
         See also 'view-show-line-endings'.
       </description>
     </key>
-
-    <key name="view-show-line-endings" type="b">
+    <key name="show-line-endings" type="b">
       <default>false</default>
       <summary>Show line endings</summary>
       <description>
@@ -98,8 +57,7 @@
         See also 'view-show-whitespace'.
       </description>
     </key>
-
-    <key name="view-highlight-current-line" type="b">
+    <key name="highlight-current-line" type="b">
       <default>true</default>
       <summary>Highlight current line</summary>
       <description>
@@ -107,8 +65,7 @@
         provide no such indication.
       </description>
     </key>
-
-    <key name="view-indent-on-tab" type="b">
+    <key name="indent-on-tab" type="b">
       <default>true</default>
       <summary>Indent on tab</summary>
       <description>
@@ -116,8 +73,7 @@
         don't indent on tab.
       </description>
     </key>
-
-    <key name="view-indent-width" type="i">
+    <key name="indent-width" type="i">
       <range min="-1" max="32"/>
       <default>-1</default>
       <summary>Indentation width</summary>
@@ -125,8 +81,7 @@
         Width of an indentation step expressed in number of spaces.
       </description>
     </key>
-
-    <key name="view-insert-spaces" type="b">
+    <key name="insert-spaces" type="b">
       <default>false</default>
       <summary>Insert spaces instead of tabs</summary>
       <description>
@@ -134,8 +89,7 @@
         of tab characters, when false tab characters will be inserted.
       </description>
     </key>
-    
-    <key name="view-right-margin-position" type="i">
+    <key name="right-margin-position" type="i">
       <range min="1" max="1000"/>
       <default>80</default>
       <summary>Right margin position</summary>
@@ -144,14 +98,12 @@
         of the view).
       </description>
     </key>
-    
-    <key name="view-show-line-marks" type="b">
+    <key name="show-line-marks" type="b">
       <default>false</default>
       <summary>Show line marks</summary>
       <description>Whether to display line mark pixbufs.</description>
     </key>
-
-    <key name="view-show-line-numbers" type="b">
+    <key name="show-line-numbers" type="b">
       <default>false</default>
       <summary>Show line numbers</summary>
       <description>
@@ -159,8 +111,7 @@
         it will not be visible.
       </description>
     </key>
-
-    <key name="view-show-right-margin" type="b">
+    <key name="show-right-margin" type="b">
       <default>false</default>
       <summary>Show right margin</summary>
       <description>
@@ -168,14 +119,12 @@
         'view-right-margin-position', when false it is not drawn.
       </description>
     </key>
-    
-    <key name="view-smart-home-end" enum="org.xfce.Mousepad.SmartHomeEnd">
+    <key name="smart-home-end" enum="org.xfce.mousepad.SmartHomeEnd">
       <default>'disabled'</default>
       <summary>Smart home end type</summary>
       <description>Sets the behaviour of the HOME and END keys.</description>
     </key>
-
-    <key name="view-tab-width" type="i">
+    <key name="tab-width" type="i">
       <range min="1" max="32"/>
       <default>8</default>
       <summary>Tab width</summary>
@@ -183,8 +132,7 @@
         The number of characters wide that a tab character appears as.
       </description>
     </key>
-
-    <key name="view-word-wrap" type="b">
+    <key name="word-wrap" type="b">
       <default>false</default>
       <summary>Word wrapping</summary>
       <description>
@@ -192,8 +140,7 @@
         the text view, when false long lines will extend out of view.
       </description>
     </key>
-
-    <key name="view-color-scheme" type="s">
+    <key name="color-scheme" type="s">
       <default>'none'</default>
       <summary>Color scheme</summary>
       <description>
@@ -201,18 +148,18 @@
         no syntax highlighting.
       </description>
     </key>
+  </schema>
 
-    <!-- Window preferences -->
-
-    <key name="window-statusbar-visible" type="b">
+  <!-- window preferences -->
+  <schema id="org.xfce.mousepad.preferences.window" path="/org/xfce/mousepad/preferences/window/" gettext-domain="mousepad">
+    <key name="statusbar-visible" type="b">
       <default>true</default>
       <summary>Statusbar visible</summary>
       <description>
         When true the statusbar is visible, when false it is not visible.
       </description>
     </key>
-
-    <key name="window-always-show-tabs" type="b">
+    <key name="always-show-tabs" type="b">
       <default>false</default>
       <summary>Always show tabs</summary>
       <description>
@@ -220,8 +167,7 @@
         false the tabs will be hidden when there is only one document open.
       </description>
     </key>
-
-    <key name="window-cycle-tabs" type="b">
+    <key name="cycle-tabs" type="b">
       <default>false</default>
       <summary>Cycle tabs</summary>
       <description>
@@ -229,8 +175,7 @@
         reached, when false do nothing at the last tab.
       </description>
     </key>
-
-    <key name="window-default-tab-sizes" type="s">
+    <key name="default-tab-sizes" type="s">
       <default>'2,3,4,8'</default>
       <summary>Default tab sizes</summary>
       <description>
@@ -238,8 +183,7 @@
         user-interface for selecting tab width.
       </description>
     </key>
-
-    <key name="window-path-in-title" type="b">
+    <key name="path-in-title" type="b">
       <default>false</default>
       <summary>Show path in window title</summary>
       <description>
@@ -247,8 +191,7 @@
         titlebar, when false only the basename will be shown.
       </description>
     </key>
-
-    <key name="window-recent-menu-items" type="i">
+    <key name="recent-menu-items" type="i">
       <range min="1" max="100"/>
       <default>10</default>
       <summary>Number of recent documents</summary>
@@ -256,26 +199,75 @@
         The number of recent documents to track and show in the user interace.
       </description>
     </key>
-
-    <key name="window-height" type="i">
-      <default>480</default>
-      <summary>Window height</summary>
-      <description>The height of window in pixels.</description>
-    </key>
-
-    <key name="window-width" type="i">
-      <default>640</default>
-      <summary>Window width</summary>
-      <description>The width of windows in pixels.</description>
-    </key>
-
-    <key name="window-remember-geometry" type="b">
+    <key name="remember-geometry" type="b">
       <default>true</default>
       <summary>Remember window geometry</summary>
       <description>
         When true the size of the window will be saved and restored.
       </description>
     </key>
+  </schema>
 
+  <!-- search state -->
+  <schema id="org.xfce.mousepad.state.search" path="/org/xfce/mousepad/state/search/" gettext-domain="mousepad">
+    <key name="direction" type="i">
+      <range min="0" max="2"/>
+      <default>1</default>
+      <summary>search direction</summary>
+      <description>
+        When 0 the search direction is backwards/upwards, when 1 the search
+        direction is forwards/downwards, when 2 the search will wrap around.
+      </description>
+    </key>
+    <key name="match-case" type="b">
+      <default>false</default>
+      <summary>Match case</summary>
+      <description>
+        When true searches will be case-sensitive, when false they will
+        be case-insensitive.
+      </description>
+    </key>
+    <key name="match-whole-word" type="b">
+      <default>false</default>
+      <summary>Match whole word</summary>
+      <description>
+        When true searches must match an entire word (using default word
+        boundary characters), when false matches can occur anywhere, even
+        within a larger word.
+      </description>
+    </key>
+    <key name="replace-all" type="b">
+      <default>false</default>
+      <summary>Replace all</summary>
+      <description>
+        When true the Replace search dialog is in "replace-all" mode, when
+        false the dialog is in "replace-one-at-a-time" mode.
+      </description>
+    </key>
+    <key name="replace-all-location" type="i">
+      <range min="0" max="2"/>
+      <default>1</default>
+      <summary>Replace-all location</summary>
+      <description>
+        When 0 the replace-all is performed within the current selection, when
+        1 the replace-all is performed in the current document, and when 2
+        the replace-all is performed in all currently open documents.
+      </description>
+    </key>
   </schema>
+
+  <!-- window state -->
+  <schema id="org.xfce.mousepad.state.window" path="/org/xfce/mousepad/state/window/" gettext-domain="mousepad">
+    <key name="height" type="i">
+      <default>480</default>
+      <summary>window height</summary>
+      <description>The height of window in pixels.</description>
+    </key>
+    <key name="width" type="i">
+      <default>640</default>
+      <summary>window width</summary>
+      <description>The width of windows in pixels.</description>
+    </key>
+  </schema>
+
 </schemalist>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list