summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2022-08-08 10:52:41 -0700
committerCorey Berla <corey@berla.me>2022-08-08 21:37:53 +0000
commit038d16ef66869559bb83ece13bbca1a2dda86e91 (patch)
tree35a3a39ec3b8c747459c0749c436a52274ef62f2
parent39066e8a4ea09d0f37a88b5a702c135ef4acde91 (diff)
downloadnautilus-038d16ef66869559bb83ece13bbca1a2dda86e91.tar.gz
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
-rw-r--r--src/nautilus-app-chooser.c10
-rw-r--r--src/resources/ui/nautilus-app-chooser.ui29
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>