summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pluma/pluma-notebook.c10
-rw-r--r--pluma/pluma-tab.c6
-rw-r--r--pluma/pluma-view.c12
-rw-r--r--pluma/pluma-window.c27
4 files changed, 18 insertions, 37 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c
index fa5024ca..aa995e2d 100644
--- a/pluma/pluma-notebook.c
+++ b/pluma/pluma-notebook.c
@@ -49,6 +49,7 @@
#include "pluma-marshal.h"
#include "pluma-window.h"
#include "pluma-prefs-manager.h"
+#include "pluma-prefs-manager-private.h"
#define AFTER_ALL_TABS -1
#define NOT_IN_APP_WINDOWS -2
@@ -782,15 +783,12 @@ update_tabs_visibility (PlumaNotebook *nb)
{
gboolean show_tabs;
guint num;
- GSettings *settings;
num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
- settings = g_settings_new ("org.mate.pluma");
+ show_tabs = (g_settings_get_boolean (pluma_prefs_manager->settings, "show-single-tab") || num > 1);
- show_tabs = (g_settings_get_boolean (settings, "show-single-tab") || num > 1);
-
- if (g_settings_get_boolean (settings, "show-tabs-with-side-pane"))
+ if (g_settings_get_boolean (pluma_prefs_manager->settings, "show-tabs-with-side-pane"))
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), show_tabs);
else
{
@@ -799,8 +797,6 @@ update_tabs_visibility (PlumaNotebook *nb)
else
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), show_tabs);
}
-
- g_object_unref (settings);
}
static void
diff --git a/pluma/pluma-tab.c b/pluma/pluma-tab.c
index daff4dd0..505b64b7 100644
--- a/pluma/pluma-tab.c
+++ b/pluma/pluma-tab.c
@@ -43,6 +43,7 @@
#include "pluma-progress-message-area.h"
#include "pluma-debug.h"
#include "pluma-prefs-manager-app.h"
+#include "pluma-prefs-manager-private.h"
#include "pluma-enum-types.h"
#define PLUMA_TAB_KEY "PLUMA_TAB_KEY"
@@ -2603,7 +2604,6 @@ _pluma_tab_can_close (PlumaTab *tab)
{
PlumaDocument *doc;
PlumaTabState ts;
- GSettings *settings;
g_return_val_if_fail (PLUMA_IS_TAB (tab), FALSE);
@@ -2611,15 +2611,13 @@ _pluma_tab_can_close (PlumaTab *tab)
doc = pluma_tab_get_document (tab);
- settings = g_settings_new ("org.mate.pluma");
-
/* if we are loading or reverting, the tab can be closed */
if ((ts == PLUMA_TAB_STATE_LOADING) ||
(ts == PLUMA_TAB_STATE_LOADING_ERROR) ||
(ts == PLUMA_TAB_STATE_REVERTING) ||
(ts == PLUMA_TAB_STATE_REVERTING_ERROR) || /* CHECK: I'm not sure this is the right behavior for REVERTING ERROR */
(!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc))) ||
- (!g_settings_get_boolean (settings, "show-save-confirmation")))
+ (!g_settings_get_boolean (pluma_prefs_manager->settings, "show-save-confirmation")))
return TRUE;
/* Do not close tab with saving errors */
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index 0bcbcf5a..6dce6273 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -46,6 +46,7 @@
#include "pluma-debug.h"
#include "pluma-prefs-manager.h"
#include "pluma-prefs-manager-app.h"
+#include "pluma-prefs-manager-private.h"
#include "pluma-marshal.h"
#include "pluma-utils.h"
@@ -761,11 +762,9 @@ pluma_view_scroll_to_cursor (PlumaView *view)
static PangoFontDescription* get_system_font (void)
{
PangoFontDescription *desc = NULL;
- GSettings *settings;
char *name;
- settings = g_settings_new ("org.mate.interface");
- name = g_settings_get_string (settings, "font-name");
+ name = g_settings_get_string (pluma_prefs_manager->interface_settings, "font-name");
if (name)
{
@@ -773,8 +772,6 @@ static PangoFontDescription* get_system_font (void)
g_free (name);
}
- g_object_unref (settings);
-
return desc;
}
@@ -822,12 +819,9 @@ pluma_override_font (const gchar *item,
if (provider == NULL)
{
- static GSettings *settings; /*We need this for the life of the provider and program*/
-
provider = gtk_css_provider_new ();
- settings = g_settings_new ("org.mate.interface");
- g_signal_connect (settings,
+ g_signal_connect (pluma_prefs_manager->interface_settings,
"changed::" "font-name",
G_CALLBACK (system_font_changed_cb), NULL);
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index ddf09e5a..6d26cf89 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -55,6 +55,7 @@
#include "pluma-debug.h"
#include "pluma-language-manager.h"
#include "pluma-prefs-manager-app.h"
+#include "pluma-prefs-manager-private.h"
#include "pluma-panel.h"
#include "pluma-documents-panel.h"
#include "pluma-plugins-engine.h"
@@ -299,13 +300,11 @@ pluma_window_key_press_event (GtkWidget *widget,
if (event->state & GDK_CONTROL_MASK)
{
- GSettings *settings;
gchar *font;
gchar *tempsize;
gint nsize;
- settings = g_settings_new ("org.mate.pluma");
- font = g_settings_get_string (settings, "editor-font");
+ font = g_settings_get_string (pluma_prefs_manager->settings, "editor-font");
tempsize = g_strdup (font);
g_strreverse (tempsize);
@@ -323,10 +322,10 @@ pluma_window_key_press_event (GtkWidget *widget,
nsize = nsize + 1;
sprintf (tempsize, "%d", nsize);
- if (!g_settings_get_boolean (settings, "use-default-font") && (nsize < 73))
+ if (!g_settings_get_boolean (pluma_prefs_manager->settings, "use-default-font") && (nsize < 73))
{
gchar *tmp = g_strconcat (tempfont, tempsize, NULL);
- g_settings_set_string (settings, "editor-font", tmp);
+ g_settings_set_string (pluma_prefs_manager->settings, "editor-font", tmp);
g_free (tmp);
}
}
@@ -335,15 +334,15 @@ pluma_window_key_press_event (GtkWidget *widget,
nsize = nsize - 1;
sprintf (tempsize, "%d", nsize);
- if (!g_settings_get_boolean (settings, "use-default-font") && (nsize > 5))
+ if (!g_settings_get_boolean (pluma_prefs_manager->settings, "use-default-font") && (nsize > 5))
{
gchar *tmp = g_strconcat (tempfont, tempsize, NULL);
- g_settings_set_string (settings, "editor-font", tmp);
+ g_settings_set_string (pluma_prefs_manager->settings, "editor-font", tmp);
g_free (tmp);
}
}
- if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs"))
+ if (g_settings_get_boolean (pluma_prefs_manager->settings, "ctrl-tab-switch-tabs"))
{
GtkNotebook *notebook = GTK_NOTEBOOK (_pluma_window_get_notebook (PLUMA_WINDOW (window)));
@@ -368,7 +367,6 @@ pluma_window_key_press_event (GtkWidget *widget,
handled = TRUE;
}
}
- g_object_unref (settings);
g_free (font);
g_free (tempsize);
}
@@ -3618,24 +3616,21 @@ side_panel_visibility_changed (GtkWidget *side_panel,
{
gboolean visible;
GtkAction *action;
- GSettings *settings;
visible = gtk_widget_get_visible (side_panel);
- settings = g_settings_new ("org.mate.pluma");
-
- if (!g_settings_get_boolean (settings, "show-tabs-with-side-pane"))
+ if (!g_settings_get_boolean (pluma_prefs_manager->settings, "show-tabs-with-side-pane"))
{
if (visible)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook), FALSE);
else
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook),
- g_settings_get_boolean (settings, "show-single-tab") ||
+ g_settings_get_boolean (pluma_prefs_manager->settings, "show-single-tab") ||
(gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) > 1));
}
else
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook),
- g_settings_get_boolean (settings, "show-single-tab") ||
+ g_settings_get_boolean (pluma_prefs_manager->settings, "show-single-tab") ||
(gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook)) > 1));
if (pluma_prefs_manager_side_pane_visible_can_set ())
@@ -3651,8 +3646,6 @@ side_panel_visibility_changed (GtkWidget *side_panel,
if (!visible && window->priv->active_tab != NULL)
gtk_widget_grab_focus (GTK_WIDGET (
pluma_tab_get_view (PLUMA_TAB (window->priv->active_tab))));
-
- g_object_unref (settings);
}
static void