[gedit] Make gedit-settings inherit from GObject.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Make gedit-settings inherit from GObject.
- Date: Tue, 5 Oct 2010 09:53:49 +0000 (UTC)
commit 7d217810b48e476a26cb3bab1d27fceda979b24e
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Oct 5 11:53:06 2010 +0200
Make gedit-settings inherit from GObject.
We are using direct settings creation so we don't need GeditSettings
to inherit from GSettings anymore.
gedit/dialogs/gedit-preferences-dialog.c | 2 +-
gedit/gedit-app.c | 4 +-
gedit/gedit-app.h | 2 +-
gedit/gedit-settings.c | 33 ++++++-----------------------
gedit/gedit-settings.h | 6 ++--
gedit/gedit-view.c | 4 +-
gedit/gedit-window.c | 2 +-
7 files changed, 17 insertions(+), 36 deletions(-)
---
diff --git a/gedit/dialogs/gedit-preferences-dialog.c b/gedit/dialogs/gedit-preferences-dialog.c
index c459fab..8405925 100644
--- a/gedit/dialogs/gedit-preferences-dialog.c
+++ b/gedit/dialogs/gedit-preferences-dialog.c
@@ -415,7 +415,7 @@ on_use_default_font_changed (GSettings *settings,
static void
setup_font_colors_page_font_section (GeditPreferencesDialog *dlg)
{
- GSettings *settings;
+ GObject *settings;
gboolean use_default_font;
gchar *system_font = NULL;
gchar *label;
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 21b43e1..b43a68b 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -81,7 +81,7 @@ struct _GeditAppPrivate
GtkPageSetup *page_setup;
GtkPrintSettings *print_settings;
- GSettings *settings;
+ GObject *settings;
GSettings *window_settings;
PeasExtensionSet *extensions;
@@ -1124,7 +1124,7 @@ _gedit_app_set_default_print_settings (GeditApp *app,
app->priv->print_settings = g_object_ref (settings);
}
-GSettings *
+GObject *
_gedit_app_get_settings (GeditApp *app)
{
g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
diff --git a/gedit/gedit-app.h b/gedit/gedit-app.h
index 8563490..7efec0f 100644
--- a/gedit/gedit-app.h
+++ b/gedit/gedit-app.h
@@ -163,7 +163,7 @@ 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);
+GObject *_gedit_app_get_settings (GeditApp *app);
G_END_DECLS
diff --git a/gedit/gedit-settings.c b/gedit/gedit-settings.c
index 7f3404b..be5056e 100644
--- a/gedit/gedit-settings.c
+++ b/gedit/gedit-settings.c
@@ -53,7 +53,7 @@ struct _GeditSettingsPrivate
gchar *old_scheme;
};
-G_DEFINE_TYPE (GeditSettings, gedit_settings, G_TYPE_SETTINGS)
+G_DEFINE_TYPE (GeditSettings, gedit_settings, G_TYPE_OBJECT)
static void
gedit_settings_finalize (GObject *object)
@@ -147,7 +147,7 @@ set_font (GeditSettings *gs,
for (l = views; l != NULL; l = g_list_next (l))
{
- /* Note: we use def=FALSE to avoid GeditView to query gconf */
+ /* Note: we use def=FALSE to avoid GeditView to query dconf */
gedit_view_set_font (GEDIT_VIEW (l->data), FALSE, font);
gtk_source_view_set_tab_width (GTK_SOURCE_VIEW (l->data), ts);
@@ -383,8 +383,6 @@ on_tabs_size_changed (GSettings *settings,
g_list_free (views);
}
-/* FIXME: insert_spaces and line_numbers are mostly the same it just changes
- the func called, maybe typedef the func and refactorize? */
static void
on_insert_spaces_changed (GSettings *settings,
const gchar *key,
@@ -647,21 +645,12 @@ gedit_settings_init (GeditSettings *gs)
gs->priv = GEDIT_SETTINGS_GET_PRIVATE (gs);
gs->priv->old_scheme = NULL;
-}
+ gs->priv->editor = g_settings_new ("org.gnome.gedit.preferences.editor");
+ gs->priv->ui = g_settings_new ("org.gnome.gedit.preferences.ui");
-static void
-initialize (GeditSettings *gs)
-{
- GSettings *prefs;
-
- prefs = g_settings_get_child (G_SETTINGS (gs), "preferences");
- gs->priv->editor = g_settings_get_child (prefs, "editor");
- gs->priv->ui = g_settings_get_child (prefs, "ui");
- g_object_unref (prefs);
-
/* Load settings */
gs->priv->lockdown = g_settings_new ("org.gnome.desktop.lockdown");
-
+
g_signal_connect (gs->priv->lockdown,
"changed",
G_CALLBACK (on_lockdown_changed),
@@ -766,18 +755,10 @@ gedit_settings_class_init (GeditSettingsClass *klass)
g_type_class_add_private (object_class, sizeof (GeditSettingsPrivate));
}
-GSettings *
+GObject *
gedit_settings_new ()
{
- GeditSettings *settings;
-
- settings = g_object_new (GEDIT_TYPE_SETTINGS,
- "schema", "org.gnome.gedit",
- NULL);
-
- initialize (settings);
-
- return G_SETTINGS (settings);
+ return g_object_new (GEDIT_TYPE_SETTINGS, NULL);
}
GeditLockdownMask
diff --git a/gedit/gedit-settings.h b/gedit/gedit-settings.h
index d276be4..e18ad15 100644
--- a/gedit/gedit-settings.h
+++ b/gedit/gedit-settings.h
@@ -45,14 +45,14 @@ typedef struct _GeditSettingsPrivate GeditSettingsPrivate;
struct _GeditSettings
{
- GSettings parent;
+ GObject parent;
GeditSettingsPrivate *priv;
};
struct _GeditSettingsClass
{
- GSettingsClass parent_class;
+ GObjectClass parent_class;
};
typedef enum {
@@ -64,7 +64,7 @@ typedef enum {
GType gedit_settings_get_type (void) G_GNUC_CONST;
-GSettings *gedit_settings_new (void);
+GObject *gedit_settings_new (void);
GeditLockdownMask gedit_settings_get_lockdown (GeditSettings *gs);
diff --git a/gedit/gedit-view.c b/gedit/gedit-view.c
index c4b25ad..396b065 100644
--- a/gedit/gedit-view.c
+++ b/gedit/gedit-view.c
@@ -312,7 +312,7 @@ on_notify_buffer_cb (GeditView *view,
static void
gedit_view_init (GeditView *view)
{
- GSettings *gs;
+ GObject *gs;
GtkTargetList *tl;
gboolean use_default_font;
gboolean display_line_numbers;
@@ -681,7 +681,7 @@ gedit_view_set_font (GeditView *view,
if (def)
{
- GSettings *settings;
+ GObject *settings;
gchar *font;
settings = _gedit_app_get_settings (gedit_app_get_default ());
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 56b2156..3f34ebb 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -662,7 +662,7 @@ set_toolbar_style (GeditWindow *window,
/* Set style */
if (origin == NULL)
{
- GSettings *settings;
+ GObject *settings;
settings = _gedit_app_get_settings (gedit_app_get_default ());
style = g_settings_get_enum (window->priv->ui_settings,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]