summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-04-17 12:18:01 -0700
committerMatthias Clasen <mclasen@redhat.com>2014-04-17 22:55:39 -0400
commitfcba75c2ba695a5e06c1185aee46e9d6b215c710 (patch)
tree773d525d61bcfc0d6aecfe8d381231e2a7512ba7 /examples
parentb718b95aabf5484f7ea5f1679706a50f67bd0271 (diff)
downloadgtk+-fcba75c2ba695a5e06c1185aee46e9d6b215c710.tar.gz
example: Modernize the prefs dialog
We should show the current best practice for this kind of dialog, and use a headerbar with a window close button.
Diffstat (limited to 'examples')
-rw-r--r--examples/application10/exampleappprefs.c10
-rw-r--r--examples/application10/prefs.ui13
-rw-r--r--examples/application6/exampleappprefs.c10
-rw-r--r--examples/application6/prefs.ui13
-rw-r--r--examples/application7/exampleappprefs.c10
-rw-r--r--examples/application7/prefs.ui13
-rw-r--r--examples/application8/exampleappprefs.c10
-rw-r--r--examples/application8/prefs.ui13
-rw-r--r--examples/application9/exampleappprefs.c10
-rw-r--r--examples/application9/prefs.ui13
10 files changed, 5 insertions, 110 deletions
diff --git a/examples/application10/exampleappprefs.c b/examples/application10/exampleappprefs.c
index 8cd5d5e3a3..6a033817bd 100644
--- a/examples/application10/exampleappprefs.c
+++ b/examples/application10/exampleappprefs.c
@@ -26,12 +26,6 @@ struct _ExampleAppPrefsPrivate
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
static void
-preferences_closed (GtkWidget *button)
-{
- gtk_widget_destroy (gtk_widget_get_toplevel (button));
-}
-
-static void
example_app_prefs_init (ExampleAppPrefs *prefs)
{
ExampleAppPrefsPrivate *priv;
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
"/org/gtk/exampleapp/prefs.ui");
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);
-
- gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
}
ExampleAppPrefs *
example_app_prefs_new (ExampleAppWindow *win)
{
- return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
+ return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
}
diff --git a/examples/application10/prefs.ui b/examples/application10/prefs.ui
index 49781d194c..95e1cb8069 100644
--- a/examples/application10/prefs.ui
+++ b/examples/application10/prefs.ui
@@ -64,19 +64,6 @@
</child>
</object>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="action_area">
- <property name="visible">True</property>
- <child>
- <object class="GtkButton" id="close">
- <signal name="clicked" handler="preferences_closed"/>
- <property name="visible">True</property>
- <property name="label">_Close</property>
- <property name="use-underline">True</property>
- </object>
- </child>
- </object>
- </child>
</object>
</child>
</template>
diff --git a/examples/application6/exampleappprefs.c b/examples/application6/exampleappprefs.c
index 8cd5d5e3a3..6a033817bd 100644
--- a/examples/application6/exampleappprefs.c
+++ b/examples/application6/exampleappprefs.c
@@ -26,12 +26,6 @@ struct _ExampleAppPrefsPrivate
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
static void
-preferences_closed (GtkWidget *button)
-{
- gtk_widget_destroy (gtk_widget_get_toplevel (button));
-}
-
-static void
example_app_prefs_init (ExampleAppPrefs *prefs)
{
ExampleAppPrefsPrivate *priv;
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
"/org/gtk/exampleapp/prefs.ui");
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);
-
- gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
}
ExampleAppPrefs *
example_app_prefs_new (ExampleAppWindow *win)
{
- return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
+ return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
}
diff --git a/examples/application6/prefs.ui b/examples/application6/prefs.ui
index 49781d194c..95e1cb8069 100644
--- a/examples/application6/prefs.ui
+++ b/examples/application6/prefs.ui
@@ -64,19 +64,6 @@
</child>
</object>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="action_area">
- <property name="visible">True</property>
- <child>
- <object class="GtkButton" id="close">
- <signal name="clicked" handler="preferences_closed"/>
- <property name="visible">True</property>
- <property name="label">_Close</property>
- <property name="use-underline">True</property>
- </object>
- </child>
- </object>
- </child>
</object>
</child>
</template>
diff --git a/examples/application7/exampleappprefs.c b/examples/application7/exampleappprefs.c
index 8cd5d5e3a3..6a033817bd 100644
--- a/examples/application7/exampleappprefs.c
+++ b/examples/application7/exampleappprefs.c
@@ -26,12 +26,6 @@ struct _ExampleAppPrefsPrivate
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
static void
-preferences_closed (GtkWidget *button)
-{
- gtk_widget_destroy (gtk_widget_get_toplevel (button));
-}
-
-static void
example_app_prefs_init (ExampleAppPrefs *prefs)
{
ExampleAppPrefsPrivate *priv;
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
"/org/gtk/exampleapp/prefs.ui");
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);
-
- gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
}
ExampleAppPrefs *
example_app_prefs_new (ExampleAppWindow *win)
{
- return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
+ return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
}
diff --git a/examples/application7/prefs.ui b/examples/application7/prefs.ui
index 49781d194c..95e1cb8069 100644
--- a/examples/application7/prefs.ui
+++ b/examples/application7/prefs.ui
@@ -64,19 +64,6 @@
</child>
</object>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="action_area">
- <property name="visible">True</property>
- <child>
- <object class="GtkButton" id="close">
- <signal name="clicked" handler="preferences_closed"/>
- <property name="visible">True</property>
- <property name="label">_Close</property>
- <property name="use-underline">True</property>
- </object>
- </child>
- </object>
- </child>
</object>
</child>
</template>
diff --git a/examples/application8/exampleappprefs.c b/examples/application8/exampleappprefs.c
index 8cd5d5e3a3..6a033817bd 100644
--- a/examples/application8/exampleappprefs.c
+++ b/examples/application8/exampleappprefs.c
@@ -26,12 +26,6 @@ struct _ExampleAppPrefsPrivate
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
static void
-preferences_closed (GtkWidget *button)
-{
- gtk_widget_destroy (gtk_widget_get_toplevel (button));
-}
-
-static void
example_app_prefs_init (ExampleAppPrefs *prefs)
{
ExampleAppPrefsPrivate *priv;
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
"/org/gtk/exampleapp/prefs.ui");
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);
-
- gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
}
ExampleAppPrefs *
example_app_prefs_new (ExampleAppWindow *win)
{
- return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
+ return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
}
diff --git a/examples/application8/prefs.ui b/examples/application8/prefs.ui
index 49781d194c..95e1cb8069 100644
--- a/examples/application8/prefs.ui
+++ b/examples/application8/prefs.ui
@@ -64,19 +64,6 @@
</child>
</object>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="action_area">
- <property name="visible">True</property>
- <child>
- <object class="GtkButton" id="close">
- <signal name="clicked" handler="preferences_closed"/>
- <property name="visible">True</property>
- <property name="label">_Close</property>
- <property name="use-underline">True</property>
- </object>
- </child>
- </object>
- </child>
</object>
</child>
</template>
diff --git a/examples/application9/exampleappprefs.c b/examples/application9/exampleappprefs.c
index 8cd5d5e3a3..6a033817bd 100644
--- a/examples/application9/exampleappprefs.c
+++ b/examples/application9/exampleappprefs.c
@@ -26,12 +26,6 @@ struct _ExampleAppPrefsPrivate
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
static void
-preferences_closed (GtkWidget *button)
-{
- gtk_widget_destroy (gtk_widget_get_toplevel (button));
-}
-
-static void
example_app_prefs_init (ExampleAppPrefs *prefs)
{
ExampleAppPrefsPrivate *priv;
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
"/org/gtk/exampleapp/prefs.ui");
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);
-
- gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
}
ExampleAppPrefs *
example_app_prefs_new (ExampleAppWindow *win)
{
- return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
+ return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
}
diff --git a/examples/application9/prefs.ui b/examples/application9/prefs.ui
index 49781d194c..95e1cb8069 100644
--- a/examples/application9/prefs.ui
+++ b/examples/application9/prefs.ui
@@ -64,19 +64,6 @@
</child>
</object>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="action_area">
- <property name="visible">True</property>
- <child>
- <object class="GtkButton" id="close">
- <signal name="clicked" handler="preferences_closed"/>
- <property name="visible">True</property>
- <property name="label">_Close</property>
- <property name="use-underline">True</property>
- </object>
- </child>
- </object>
- </child>
</object>
</child>
</template>