[nautilus/wip/coreyberla/app-chooser-fixes: 7/9] app-chooser: Simplify setting title and subtitle
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/coreyberla/app-chooser-fixes: 7/9] app-chooser: Simplify setting title and subtitle
- Date: Mon, 8 Aug 2022 21:24:02 +0000 (UTC)
commit 728284a3be0d5118c54f1162ac67146ffcf1fcd1
Author: Corey Berla <corey berla me>
Date: Mon Aug 8 10:52:41 2022 -0700
app-chooser: Simplify setting title and subtitle
eac32fcad6dc829a6388a7cc78a189dc83844a85 changed the bottom row to use
AdwActionRow which provides for a much easier way of setting the title
and subtitle
src/nautilus-app-chooser.c | 10 +++++++---
src/resources/ui/nautilus-app-chooser.ui | 29 +----------------------------
2 files changed, 8 insertions(+), 31 deletions(-)
---
diff --git a/src/nautilus-app-chooser.c b/src/nautilus-app-chooser.c
index 3c9367f78..af9b127d0 100644
--- a/src/nautilus-app-chooser.c
+++ b/src/nautilus-app-chooser.c
@@ -22,7 +22,7 @@ struct _NautilusAppChooser
GtkWidget *app_chooser_widget_box;
GtkWidget *label_description;
- GtkWidget *label_content_type_description;
+ GtkWidget *set_default_row;
GtkWidget *set_as_default_switch;
GtkWidget *set_default_box;
@@ -216,7 +216,11 @@ nautilus_app_chooser_constructed (GObject *object)
if (self->single_content_type && !content_type_is_folder (self))
{
content_type_description = g_content_type_get_description (self->content_type);
- gtk_label_set_label (GTK_LABEL (self->label_content_type_description), content_type_description);
+ if (content_type_description != NULL)
+ {
+ content_type_description[0] = g_ascii_toupper (content_type_description[0]);
+ adw_action_row_set_subtitle (ADW_ACTION_ROW (self->set_default_row), content_type_description);
+ }
}
else
{
@@ -250,7 +254,7 @@ nautilus_app_chooser_class_init (NautilusAppChooserClass *klass)
gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, app_chooser_widget_box);
gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, set_as_default_switch);
gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, label_description);
- gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, label_content_type_description);
+ gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, set_default_row);
gtk_widget_class_bind_template_child (widget_class, NautilusAppChooser, set_default_box);
gtk_widget_class_bind_template_callback (widget_class, open_cb);
diff --git a/src/resources/ui/nautilus-app-chooser.ui b/src/resources/ui/nautilus-app-chooser.ui
index 5d1b838e5..b31a40b92 100644
--- a/src/resources/ui/nautilus-app-chooser.ui
+++ b/src/resources/ui/nautilus-app-chooser.ui
@@ -72,34 +72,7 @@
<property name="hexpand">true</property>
<property name="selectable">false</property>
<property name="activatable-widget">set_as_default_switch</property>
- <child type="prefix">
- <object class="GtkBox">
- <property name="orientation">vertical</property>
- <property name="spacing">3</property>
- <property name="hexpand">true</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">Always use for this file
type</property>
- <property name="halign">start</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="label_content_type_description">
- <property name="halign">start</property>
- <attributes>
- <attribute name="text-transform"
- value="PANGO_TEXT_TRANSFORM_UPPERCASE"
- start="0" end="1"/>
- </attributes>
- <style>
- <class name="caption"/>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- </object>
- </child>
+ <property name="title" translatable="yes">Always use for this file
type</property>
<child>
<object class="GtkSwitch" id="set_as_default_switch">
<property name="halign">end</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]