Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "exampleapp.h"
|
|
|
|
#include "exampleappwin.h"
|
|
|
|
#include "exampleappprefs.h"
|
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
struct _ExampleAppPrefs
|
|
|
|
{
|
|
|
|
GtkDialog parent;
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
};
|
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
struct _ExampleAppPrefsClass
|
|
|
|
{
|
|
|
|
GtkDialogClass parent_class;
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
};
|
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
|
|
|
|
|
|
|
|
struct _ExampleAppPrefsPrivate
|
|
|
|
{
|
|
|
|
GSettings *settings;
|
|
|
|
GtkWidget *font;
|
|
|
|
GtkWidget *transition;
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
|
|
|
|
2013-07-28 00:33:08 +00:00
|
|
|
static void
|
|
|
|
preferences_closed (GtkWidget *button)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (gtk_widget_get_toplevel (button));
|
|
|
|
}
|
|
|
|
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
static void
|
|
|
|
example_app_prefs_init (ExampleAppPrefs *prefs)
|
|
|
|
{
|
2013-07-23 23:04:12 +00:00
|
|
|
ExampleAppPrefsPrivate *priv;
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
priv = example_app_prefs_get_instance_private (prefs);
|
|
|
|
gtk_widget_init_template (GTK_WIDGET (prefs));
|
|
|
|
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
g_settings_bind (priv->settings, "font",
|
|
|
|
priv->font, "font",
|
|
|
|
G_SETTINGS_BIND_DEFAULT);
|
|
|
|
g_settings_bind (priv->settings, "transition",
|
|
|
|
priv->transition, "active-id",
|
|
|
|
G_SETTINGS_BIND_DEFAULT);
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
example_app_prefs_dispose (GObject *object)
|
|
|
|
{
|
2013-07-23 23:04:12 +00:00
|
|
|
ExampleAppPrefsPrivate *priv;
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
priv = example_app_prefs_get_instance_private (EXAMPLE_APP_PREFS (object));
|
|
|
|
g_clear_object (&priv->settings);
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
G_OBJECT_CLASS (example_app_prefs_parent_class)->dispose (object);
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
|
|
|
{
|
2013-07-23 23:04:12 +00:00
|
|
|
G_OBJECT_CLASS (class)->dispose = example_app_prefs_dispose;
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
|
2013-07-23 23:04:12 +00:00
|
|
|
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
|
|
|
"/org/gtk/exampleapp/prefs.ui");
|
2013-07-26 20:29:12 +00:00
|
|
|
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
|
|
|
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
2013-07-28 00:33:08 +00:00
|
|
|
|
|
|
|
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ExampleAppPrefs *
|
|
|
|
example_app_prefs_new (ExampleAppWindow *win)
|
|
|
|
{
|
2013-07-23 23:04:12 +00:00
|
|
|
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
|
Add a new example app
Add a new example to the getting started part of the docs. The focus
of this example is on 'new stuff': GtkApplication, templates, settings,
gmenu, gaction, GtkStack, GtkHeaderBar, GtkSearchBar, GtkRevealer,
GtkListBox, GtkMenuButton, etc.
It is being developed in several steps. Each step is put in a separate
directory below examples/: application1, ..., application8. This is a
little repetitive, but lets us use the code of all examples in the
documentation.
2013-07-20 04:21:48 +00:00
|
|
|
}
|