app-chooser: Simplify setting title and subtitle

eac32fcad6 changed the bottom row to use
AdwActionRow which provides for a much easier way of setting the title
and subtitle
This commit is contained in:
Corey Berla 2022-08-08 10:52:41 -07:00
parent 39066e8a4e
commit 038d16ef66
2 changed files with 8 additions and 31 deletions

View file

@ -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);

View file

@ -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>