2013-11-16 21:09:56 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "exampleapp.h"
|
|
|
|
#include "exampleappwin.h"
|
|
|
|
#include "exampleappprefs.h"
|
|
|
|
|
|
|
|
struct _ExampleAppPrefs
|
|
|
|
{
|
|
|
|
GtkDialog parent;
|
|
|
|
|
|
|
|
GSettings *settings;
|
|
|
|
GtkWidget *font;
|
|
|
|
GtkWidget *transition;
|
|
|
|
};
|
|
|
|
|
2018-05-08 09:04:03 +00:00
|
|
|
G_DEFINE_TYPE (ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
2013-11-16 21:09:56 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
example_app_prefs_init (ExampleAppPrefs *prefs)
|
|
|
|
{
|
|
|
|
gtk_widget_init_template (GTK_WIDGET (prefs));
|
2018-05-08 09:04:03 +00:00
|
|
|
prefs->settings = g_settings_new ("org.gtk.exampleapp");
|
2013-11-16 21:09:56 +00:00
|
|
|
|
2018-05-08 09:04:03 +00:00
|
|
|
g_settings_bind (prefs->settings, "font",
|
|
|
|
prefs->font, "font",
|
2013-11-16 21:09:56 +00:00
|
|
|
G_SETTINGS_BIND_DEFAULT);
|
2018-05-08 09:04:03 +00:00
|
|
|
g_settings_bind (prefs->settings, "transition",
|
|
|
|
prefs->transition, "active-id",
|
2013-11-16 21:09:56 +00:00
|
|
|
G_SETTINGS_BIND_DEFAULT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
example_app_prefs_dispose (GObject *object)
|
|
|
|
{
|
2018-05-08 09:04:03 +00:00
|
|
|
ExampleAppPrefs *prefs;
|
|
|
|
|
|
|
|
prefs = EXAMPLE_APP_PREFS (object);
|
2013-11-16 21:09:56 +00:00
|
|
|
|
2018-05-08 09:04:03 +00:00
|
|
|
g_clear_object (&prefs->settings);
|
2013-11-16 21:09:56 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (example_app_prefs_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (class)->dispose = example_app_prefs_dispose;
|
|
|
|
|
|
|
|
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
|
|
|
"/org/gtk/exampleapp/prefs.ui");
|
2018-05-08 09:04:03 +00:00
|
|
|
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
|
|
|
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
2013-11-16 21:09:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExampleAppPrefs *
|
|
|
|
example_app_prefs_new (ExampleAppWindow *win)
|
|
|
|
{
|
2014-04-17 19:18:01 +00:00
|
|
|
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
|
2013-11-16 21:09:56 +00:00
|
|
|
}
|