[gtk+] example: Modernize the prefs dialog
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] example: Modernize the prefs dialog
- Date: Fri, 18 Apr 2014 02:57:14 +0000 (UTC)
commit fcba75c2ba695a5e06c1185aee46e9d6b215c710
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Apr 17 12:18:01 2014 -0700
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.
examples/application10/exampleappprefs.c | 10 +---------
examples/application10/prefs.ui | 13 -------------
examples/application6/exampleappprefs.c | 10 +---------
examples/application6/prefs.ui | 13 -------------
examples/application7/exampleappprefs.c | 10 +---------
examples/application7/prefs.ui | 13 -------------
examples/application8/exampleappprefs.c | 10 +---------
examples/application8/prefs.ui | 13 -------------
examples/application9/exampleappprefs.c | 10 +---------
examples/application9/prefs.ui | 13 -------------
10 files changed, 5 insertions(+), 110 deletions(-)
---
diff --git a/examples/application10/exampleappprefs.c b/examples/application10/exampleappprefs.c
index 8cd5d5e..6a03381 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 49781d1..95e1cb8 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 8cd5d5e..6a03381 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 49781d1..95e1cb8 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 8cd5d5e..6a03381 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 49781d1..95e1cb8 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 8cd5d5e..6a03381 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 49781d1..95e1cb8 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 8cd5d5e..6a03381 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 49781d1..95e1cb8 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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]