Commit ba948de6b8f1db8c6c97c095830d4c3512405653

Authored by Perry Werneck
1 parent d08ed1d9

Fixing application settings.

src/include/pw3270.h
@@ -61,8 +61,8 @@ @@ -61,8 +61,8 @@
61 GtkWidget * widget; ///< @brief Settings widget. 61 GtkWidget * widget; ///< @brief Settings widget.
62 const gchar * label; ///< @brief Page lagel. 62 const gchar * label; ///< @brief Page lagel.
63 const gchar * title; ///< @brief Page title. 63 const gchar * title; ///< @brief Page title.
64 - void (*load)(Pw3270SettingsPage *, GtkApplication *, GSettings *);  
65 - void (*apply)(Pw3270SettingsPage *, GtkApplication *, GSettings *); 64 + void (*load)(Pw3270SettingsPage *, GtkApplication *);
  65 + void (*apply)(Pw3270SettingsPage *, GtkApplication *);
66 }; 66 };
67 67
68 void gtk_file_chooser_set_pw3270_filters(GtkFileChooser *chooser); 68 void gtk_file_chooser_set_pw3270_filters(GtkFileChooser *chooser);
src/include/pw3270/window.h
@@ -79,6 +79,9 @@ @@ -79,6 +79,9 @@
79 /// @brief Set window sub-title (If enabled). 79 /// @brief Set window sub-title (If enabled).
80 void pw3270_window_set_subtitle(GtkWidget *window, const gchar *subtitle); 80 void pw3270_window_set_subtitle(GtkWidget *window, const gchar *subtitle);
81 81
  82 + /// @brief Get window settings.
  83 + GSettings * pw3270_application_window_settings_new(void);
  84 +
82 G_END_DECLS 85 G_END_DECLS
83 86
84 87
src/objects/application/actions/preferences.c
@@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
57 for(page = settings->pages;page;page = page->next) { 57 for(page = settings->pages;page;page = page->next) {
58 Pw3270SettingsPage * widget = (Pw3270SettingsPage *) page->data; 58 Pw3270SettingsPage * widget = (Pw3270SettingsPage *) page->data;
59 if(widget->apply) { 59 if(widget->apply) {
60 - widget->apply(widget,GTK_APPLICATION(settings->application),pw3270_application_get_settings(settings->application)); 60 + widget->apply(widget,GTK_APPLICATION(settings->application));
61 } 61 }
62 } 62 }
63 63
@@ -172,7 +172,7 @@ @@ -172,7 +172,7 @@
172 for(page = settings->pages;page;page = page->next) { 172 for(page = settings->pages;page;page = page->next) {
173 Pw3270SettingsPage * widget = (Pw3270SettingsPage *) page->data; 173 Pw3270SettingsPage * widget = (Pw3270SettingsPage *) page->data;
174 if(widget->load) { 174 if(widget->load) {
175 - widget->load(widget,GTK_APPLICATION(settings->application),pw3270_application_get_settings(settings->application)); 175 + widget->load(widget,GTK_APPLICATION(settings->application));
176 } 176 }
177 } 177 }
178 178
src/objects/toolbar/settings.c
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 #include "private.h" 30 #include "private.h"
31 #include <pw3270/settings.h> 31 #include <pw3270/settings.h>
32 #include <pw3270/actions.h> 32 #include <pw3270/actions.h>
  33 + #include <pw3270/window.h>
33 34
34 static const struct _comboboxes { 35 static const struct _comboboxes {
35 const gchar * name; 36 const gchar * name;
@@ -57,10 +58,11 @@ @@ -57,10 +58,11 @@
57 58
58 } ToolbarSettingsPage; 59 } ToolbarSettingsPage;
59 60
60 - static void load(Pw3270SettingsPage *pg, GtkApplication *application, GSettings *settings) { 61 + static void load(Pw3270SettingsPage *pg, GtkApplication *application) {
61 62
62 size_t ix; 63 size_t ix;
63 ToolbarSettingsPage * page = (ToolbarSettingsPage *) pg; 64 ToolbarSettingsPage * page = (ToolbarSettingsPage *) pg;
  65 + g_autoptr(GSettings) settings = pw3270_application_window_settings_new();
64 66
65 debug("%s",__FUNCTION__); 67 debug("%s",__FUNCTION__);
66 68
@@ -112,10 +114,11 @@ @@ -112,10 +114,11 @@
112 114
113 } 115 }
114 116
115 - static void apply(Pw3270SettingsPage *pg, GtkApplication G_GNUC_UNUSED(*application), GSettings *settings) { 117 + static void apply(Pw3270SettingsPage *pg, GtkApplication G_GNUC_UNUSED(*application)) {
116 118
117 size_t ix; 119 size_t ix;
118 ToolbarSettingsPage * page = (ToolbarSettingsPage *) pg; 120 ToolbarSettingsPage * page = (ToolbarSettingsPage *) pg;
  121 + g_autoptr(GSettings) settings = pw3270_application_window_settings_new();
119 122
120 debug("%s",__FUNCTION__); 123 debug("%s",__FUNCTION__);
121 124
src/objects/window/window.c
@@ -35,7 +35,6 @@ @@ -35,7 +35,6 @@
35 35
36 static void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); 36 static void get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
37 static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); 37 static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
38 - static GSettings *pw3270_application_window_settings_new(void);  
39 38
40 G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW); 39 G_DEFINE_TYPE(pw3270ApplicationWindow, pw3270ApplicationWindow, GTK_TYPE_APPLICATION_WINDOW);
41 40