diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/framework.c | 19 | ||||
-rw-r--r-- | src/schemas/Makefile.am | 5 | ||||
-rw-r--r-- | src/schemas/re.chrysalide.framework.gschema.xml | 19 |
4 files changed, 43 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index c4227b8..a1912b0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -145,4 +145,4 @@ rost_LDFLAGS = $(LIBGOBJ_LIBS) -L.libs -lchrysacore # glibext doit être traité en premier, à cause des marshals GLib -SUBDIRS = core glibext $(GTKEXT_SUBDIR) analysis arch format common debug $(GUI_SUBDIR) mangling plugins +SUBDIRS = core glibext $(GTKEXT_SUBDIR) analysis arch format common debug $(GUI_SUBDIR) mangling plugins schemas diff --git a/src/framework.c b/src/framework.c index 47e93a0..dfd0bfa 100644 --- a/src/framework.c +++ b/src/framework.c @@ -38,6 +38,8 @@ struct _GtkChrysalideFramework { GtkApplication parent; /* A laisser en premier */ + GSettings *settings; /* Paramètres globaux */ + GtkApplicationWindow *main_window; /* Fenêtre principale */ }; @@ -125,6 +127,8 @@ static void gtk_chrysalide_framework_class_init(GtkChrysalideFrameworkClass *kla static void gtk_chrysalide_framework_init(GtkChrysalideFramework *app) { + app->settings = NULL; + app->main_window = NULL; } @@ -144,6 +148,8 @@ static void gtk_chrysalide_framework_init(GtkChrysalideFramework *app) static void gtk_chrysalide_framework_dispose(GtkChrysalideFramework *app) { + g_clear_object(&app->settings); + g_clear_object(&app->main_window); G_OBJECT_CLASS(gtk_chrysalide_framework_parent_class)->dispose(G_OBJECT(app)); @@ -217,17 +223,28 @@ GtkChrysalideFramework *gtk_chrysalide_framework_new(void) static void gtk_chrysalide_framework_activate(GApplication *app) { GtkChrysalideFramework *real_app; /* Version réelle de l'instance*/ + GSettings *settings; /* Paramètres globaux */ GtkWindow *window; /* Fenêtre mise en place */ real_app = GTK_CHRYSALIDE_FRAMEWORK(app); + /* Paramètres globaux */ + + settings = g_settings_new("re.chrysalide.framework.mainapp"); + real_app->settings = settings; + + /* Fenêtre principale */ + window = GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(app))); real_app->main_window = GTK_APPLICATION_WINDOW(window); g_object_ref(G_OBJECT(window)); + g_settings_bind(settings, "window-width", G_OBJECT(window), "default-width", G_SETTINGS_BIND_DEFAULT); + g_settings_bind(settings, "window-height", G_OBJECT(window), "default-height", G_SETTINGS_BIND_DEFAULT); + g_settings_bind(settings, "window-maximized", G_OBJECT(window), "maximized", G_SETTINGS_BIND_DEFAULT); + gtk_window_set_title(window, "Chrysalide"); - gtk_window_set_default_size(window, 400, 300); gtk_window_present(window); } diff --git a/src/schemas/Makefile.am b/src/schemas/Makefile.am new file mode 100644 index 0000000..a67aa0b --- /dev/null +++ b/src/schemas/Makefile.am @@ -0,0 +1,5 @@ + +gsettings_SCHEMAS = \ + re.chrysalide.framework.gschema.xml + +@GSETTINGS_RULES@ diff --git a/src/schemas/re.chrysalide.framework.gschema.xml b/src/schemas/re.chrysalide.framework.gschema.xml new file mode 100644 index 0000000..4a16f12 --- /dev/null +++ b/src/schemas/re.chrysalide.framework.gschema.xml @@ -0,0 +1,19 @@ +<schemalist gettext-domain="chrysalide"> + + <schema id="re.chrysalide.framework" path="/re/chrysalide/framework/"> + <child schema="re.chrysalide.framework.mainapp" name="mainapp"/> + </schema> + + <schema id="re.chrysalide.framework.mainapp" path="/re/chrysalide/framework/mainapp/"> + <key name="window-width" type="i"> + <default>600</default> + </key> + <key name="window-height" type="i"> + <default>400</default> + </key> + <key name="window-maximized" type="b"> + <default>false</default> + </key> + </schema> + +</schemalist> |