diff options
author | Pablo Barciela <[email protected]> | 2019-12-28 22:20:19 +0100 |
---|---|---|
committer | ZenWalker <[email protected]> | 2020-01-11 16:21:20 +0100 |
commit | ead4c3415da8acbbcc61d06365e0c83e8da089fb (patch) | |
tree | 8625fd8deb4c3d1d83a439b47cb6bffb07c200a1 /pluma/pluma-window.c | |
parent | 2738265fa574493db5a7db9f23307742d3ba2ef7 (diff) | |
download | pluma-ead4c3415da8acbbcc61d06365e0c83e8da089fb.tar.bz2 pluma-ead4c3415da8acbbcc61d06365e0c83e8da089fb.tar.xz |
avoid to make new Gsettings variables
use Gsettings 'pluma_prefs_manager' instead
Diffstat (limited to 'pluma/pluma-window.c')
-rw-r--r-- | pluma/pluma-window.c | 27 |
1 files changed, 10 insertions, 17 deletions
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 |