removable-media-settings: Modernize the "Other Media" window

- Use AdwPreferencesPage, AdwPreferencesGroup
and put the GtkDropDowns inside AdwActionRows;
- Set a minimum window size
This commit is contained in:
Automeris naranja 2024-01-08 18:09:35 -03:00 committed by Felipe Borges
parent faef4a5915
commit c024d79cb8
2 changed files with 21 additions and 48 deletions

View file

@ -58,7 +58,7 @@ struct _CcRemovableMediaSettings
GtkAppChooserButton *dcf_chooser;
GtkAppChooserButton *music_player_chooser;
GtkDialog *other_type_dialog;
GtkLabel *other_action_label;
AdwActionRow *other_action_row;
GtkBox *other_action_box;
GtkComboBox *other_type_combo_box;
GtkListStore *other_type_list_store;
@ -341,7 +341,7 @@ on_other_type_combo_box_changed (CcRemovableMediaSettings *self)
gtk_box_append (self->other_action_box, GTK_WIDGET (self->other_application_chooser));
prepare_chooser (self, self->other_application_chooser, NULL);
gtk_label_set_mnemonic_widget (self->other_action_label, GTK_WIDGET (self->other_application_chooser));
adw_action_row_set_activatable_widget (self->other_action_row, GTK_WIDGET (self->other_application_chooser));
}
static gboolean
@ -553,8 +553,8 @@ cc_removable_media_settings_class_init (CcRemovableMediaSettingsClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, dcf_chooser);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, music_player_chooser);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, other_type_dialog);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, other_action_row);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, other_action_box);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, other_action_label);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, other_type_combo_box);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, other_type_list_store);
gtk_widget_class_bind_template_child (widget_class, CcRemovableMediaSettings, software_chooser);

View file

@ -101,6 +101,10 @@
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="hide-on-close">True</property>
<property name="width-request">360</property>
<property name="height-request">294</property>
<property name="default-width">360</property>
<property name="default-height">294</property>
<signal name="close-request" handler="on_extra_options_dialog_close_request" object="CcRemovableMediaSettings" swapped="yes"/>
<child>
<object class="GtkShortcutController">
@ -119,30 +123,19 @@
<object class="AdwHeaderBar"/>
</child>
<property name="content">
<object class="GtkBox">
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="spacing">10</property>
<property name="orientation">vertical</property>
<object class="AdwPreferencesPage">
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<property name="margin-start">12</property>
<property name="orientation">vertical</property>
<object class="AdwPreferencesGroup">
<child>
<object class="GtkGrid">
<property name="column_spacing">6</property>
<property name="row_spacing">10</property>
<object class="AdwActionRow">
<property name="title" translatable="yes">_Type</property>
<property name="use-underline">True</property>
<property name="activatable-widget">other_type_combo_box</property>
<child>
<object class="GtkComboBox" id="other_type_combo_box">
<property name="model">other_type_list_store</property>
<property name="valign">center</property>
<signal name="changed" handler="on_other_type_combo_box_changed" object="CcRemovableMediaSettings" swapped="yes"/>
<layout>
<property name="column">1</property>
<property name="row">0</property>
</layout>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@ -151,35 +144,15 @@
</child>
</object>
</child>
<child>
<object class="GtkLabel" id="other_action_label">
<property name="xalign">0</property>
<property name="label" translatable="yes">_Action:</property>
<property name="use_underline">True</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
</object>
</child>
<child>
<object class="AdwActionRow" id="other_action_row">
<property name="title" translatable="yes">_Action</property>
<property name="use-underline">True</property>
<child>
<object class="GtkBox" id="other_action_box">
<layout>
<property name="column">1</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="xalign">0</property>
<property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">other_type_combo_box</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
<property name="valign">center</property>
</object>
</child>
</object>