[libadwaita] demo: Add examples of entry rows
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita] demo: Add examples of entry rows
- Date: Fri, 22 Apr 2022 15:20:43 +0000 (UTC)
commit 6acd15c2d863469bec47cfee5ca61882442034b2
Author: Maximiliano Sandoval R <msandova protonmail com>
Date: Tue Jul 20 15:33:52 2021 +0200
demo: Add examples of entry rows
demo/adw-demo-window.ui | 4 +++-
demo/pages/lists/adw-demo-page-lists.c | 26 +++++++++++++++++++++
demo/pages/lists/adw-demo-page-lists.ui | 41 +++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+), 1 deletion(-)
---
diff --git a/demo/adw-demo-window.ui b/demo/adw-demo-window.ui
index f2b4339c..4ce61d67 100644
--- a/demo/adw-demo-window.ui
+++ b/demo/adw-demo-window.ui
@@ -138,7 +138,9 @@
<object class="GtkStackPage">
<property name="title" translatable="yes">Lists</property>
<property name="child">
- <object class="AdwDemoPageLists"/>
+ <object class="AdwDemoPageLists">
+ <signal name="add-toast" handler="adw_toast_overlay_add_toast"
object="toast_overlay" swapped="yes"/>
+ </object>
</property>
</object>
</child>
diff --git a/demo/pages/lists/adw-demo-page-lists.c b/demo/pages/lists/adw-demo-page-lists.c
index 594fa2ca..b3a782f0 100644
--- a/demo/pages/lists/adw-demo-page-lists.c
+++ b/demo/pages/lists/adw-demo-page-lists.c
@@ -7,14 +7,40 @@ struct _AdwDemoPageLists
AdwBin parent_instance;
};
+enum {
+ SIGNAL_ADD_TOAST,
+ SIGNAL_LAST_SIGNAL,
+};
+
+static guint signals[SIGNAL_LAST_SIGNAL];
+
G_DEFINE_TYPE (AdwDemoPageLists, adw_demo_page_lists, ADW_TYPE_BIN)
+static void
+entry_apply_cb (AdwDemoPageLists *self)
+{
+ AdwToast *toast = adw_toast_new ("Changes applied");
+
+ g_signal_emit (self, signals[SIGNAL_ADD_TOAST], 0, toast);
+}
+
static void
adw_demo_page_lists_class_init (AdwDemoPageListsClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ signals[SIGNAL_ADD_TOAST] =
+ g_signal_new ("add-toast",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 1,
+ ADW_TYPE_TOAST);
+
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/Adwaita1/Demo/ui/pages/lists/adw-demo-page-lists.ui");
+
+ gtk_widget_class_bind_template_callback (widget_class, entry_apply_cb);
}
static void
diff --git a/demo/pages/lists/adw-demo-page-lists.ui b/demo/pages/lists/adw-demo-page-lists.ui
index 3286dbe7..03780e56 100644
--- a/demo/pages/lists/adw-demo-page-lists.ui
+++ b/demo/pages/lists/adw-demo-page-lists.ui
@@ -66,6 +66,47 @@
</child>
</object>
</child>
+ <child>
+ <object class="AdwPreferencesGroup">
+ <property name="title" translatable="yes">Entry Rows</property>
+ <child>
+ <object class="AdwEntryRow">
+ <property name="title" translatable="yes">Entry Row</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="AdwPreferencesGroup">
+ <child>
+ <object class="AdwEntryRow">
+ <property name="title" translatable="yes">Entry With Confirmation</property>
+ <property name="show-apply-button">True</property>
+ <signal name="apply" handler="entry_apply_cb" swapped="yes"/>
+ </object>
+ </child>
+ <child>
+ <object class="AdwEntryRow">
+ <property name="title" translatable="yes">Entry With Suffix</property>
+ <child>
+ <object class="GtkButton">
+ <property name="valign">center</property>
+ <property name="icon_name">edit-copy-symbolic</property>
+ <style>
+ <class name="flat"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="AdwPasswordEntryRow">
+ <property name="title" translatable="yes">Password Entry</property>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Combo Rows</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]