[nautilus/wip/oholy/encrypted-archives: 38/43] compress-dialog: Use HdyPreferencesGroup and HdyActionRow
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/oholy/encrypted-archives: 38/43] compress-dialog: Use HdyPreferencesGroup and HdyActionRow
- Date: Wed, 28 Jul 2021 15:26:11 +0000 (UTC)
commit 14d785a214a9f53c87cda4e6394fa47e0365afe6
Author: Ondrej Holy <oholy redhat com>
Date: Mon Jun 21 11:48:11 2021 +0200
compress-dialog: Use HdyPreferencesGroup and HdyActionRow
Use HdyPreferencesGroup and HdyActionRow for archive formats and their
descriptions as per the mockup for the encrypted archives support.
https://gitlab.gnome.org/GNOME/nautilus/-/issues/822
GtkListBox respective HdyPreferencesGroup and HdyActionRow
src/nautilus-compress-dialog-controller.c | 11 ---
src/resources/ui/nautilus-compress-dialog.ui | 122 +++++++++------------------
2 files changed, 38 insertions(+), 95 deletions(-)
---
diff --git a/src/nautilus-compress-dialog-controller.c b/src/nautilus-compress-dialog-controller.c
index d8aa792ee..6377ffd17 100644
--- a/src/nautilus-compress-dialog-controller.c
+++ b/src/nautilus-compress-dialog-controller.c
@@ -31,7 +31,6 @@ struct _NautilusCompressDialogController
NautilusFileNameWidgetController parent_instance;
GtkWidget *compress_dialog;
- GtkWidget *description_stack;
GtkWidget *name_entry;
GtkWidget *zip_radio_button;
GtkWidget *tar_xz_radio_button;
@@ -135,7 +134,6 @@ update_selected_format (NautilusCompressDialogController *self,
NautilusCompressionFormat format)
{
const char *extension;
- const char *description_label_name;
GtkWidget *active_button;
switch (format)
@@ -143,7 +141,6 @@ update_selected_format (NautilusCompressDialogController *self,
case NAUTILUS_COMPRESSION_ZIP:
{
extension = ".zip";
- description_label_name = "zip-description-label";
active_button = self->zip_radio_button;
}
break;
@@ -151,7 +148,6 @@ update_selected_format (NautilusCompressDialogController *self,
case NAUTILUS_COMPRESSION_TAR_XZ:
{
extension = ".tar.xz";
- description_label_name = "tar-xz-description-label";
active_button = self->tar_xz_radio_button;
}
break;
@@ -159,7 +155,6 @@ update_selected_format (NautilusCompressDialogController *self,
case NAUTILUS_COMPRESSION_7ZIP:
{
extension = ".7z";
- description_label_name = "seven-zip-description-label";
active_button = self->seven_zip_radio_button;
}
break;
@@ -173,9 +168,6 @@ update_selected_format (NautilusCompressDialogController *self,
self->extension = extension;
- gtk_stack_set_visible_child_name (GTK_STACK (self->description_stack),
- description_label_name);
-
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_button),
TRUE);
@@ -251,7 +243,6 @@ nautilus_compress_dialog_controller_new (GtkWindow *parent_window,
GtkWidget *error_label;
GtkWidget *name_entry;
GtkWidget *activate_button;
- GtkWidget *description_stack;
GtkWidget *zip_radio_button;
GtkWidget *tar_xz_radio_button;
GtkWidget *seven_zip_radio_button;
@@ -266,7 +257,6 @@ nautilus_compress_dialog_controller_new (GtkWindow *parent_window,
zip_radio_button = GTK_WIDGET (gtk_builder_get_object (builder, "zip_radio_button"));
tar_xz_radio_button = GTK_WIDGET (gtk_builder_get_object (builder, "tar_xz_radio_button"));
seven_zip_radio_button = GTK_WIDGET (gtk_builder_get_object (builder, "seven_zip_radio_button"));
- description_stack = GTK_WIDGET (gtk_builder_get_object (builder, "description_stack"));
gtk_window_set_transient_for (GTK_WINDOW (compress_dialog),
parent_window);
@@ -282,7 +272,6 @@ nautilus_compress_dialog_controller_new (GtkWindow *parent_window,
self->zip_radio_button = zip_radio_button;
self->tar_xz_radio_button = tar_xz_radio_button;
self->seven_zip_radio_button = seven_zip_radio_button;
- self->description_stack = description_stack;
self->name_entry = name_entry;
self->response_handler_id = g_signal_connect (compress_dialog,
diff --git a/src/resources/ui/nautilus-compress-dialog.ui b/src/resources/ui/nautilus-compress-dialog.ui
index ba7ce4e29..3aba59c62 100644
--- a/src/resources/ui/nautilus-compress-dialog.ui
+++ b/src/resources/ui/nautilus-compress-dialog.ui
@@ -61,47 +61,52 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="hbox">
- <property name="orientation">horizontal</property>
- <property name="homogeneous">True</property>
- <property name="spacing">0</property>
+ <object class="HdyPreferencesGroup">
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
<child>
- <object class="GtkRadioButton" id="zip_radio_button">
- <property name="label" translatable="no">.zip</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="zip_radio_button_on_toggled"/>
+ <object class="HdyActionRow">
+ <property name="title" translatable="no">.zip</property>
+ <property name="subtitle" translatable="yes">Compatible with all operating
systems.</property>
+ <property name="activatable-widget">zip_radio_button</property>
+ <child type="prefix">
+ <object class="GtkRadioButton" id="zip_radio_button">
+ <property name="draw-indicator">True</property>
+ <property name="can-focus">False</property>
+ <signal name="toggled" handler="zip_radio_button_on_toggled"/>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
- <object class="GtkRadioButton" id="tar_xz_radio_button">
- <property name="label" translatable="no">.tar.xz</property>
- <property name="group">zip_radio_button</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="tar_xz_radio_button_on_toggled"/>
+ <object class="HdyActionRow">
+ <property name="title" translatable="no">.tar.xz</property>
+ <property name="subtitle" translatable="yes">Smaller archives but Linux and Mac
only.</property>
+ <property name="activatable-widget">tar_xz_radio_button</property>
+ <child type="prefix">
+ <object class="GtkRadioButton" id="tar_xz_radio_button">
+ <property name="draw-indicator">True</property>
+ <property name="can-focus">False</property>
+ <property name="group">zip_radio_button</property>
+ <signal name="toggled" handler="tar_xz_radio_button_on_toggled"/>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
- <object class="GtkRadioButton" id="seven_zip_radio_button">
- <property name="label" translatable="no">.7z</property>
- <property name="group">zip_radio_button</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="seven_zip_radio_button_on_toggled"/>
+ <object class="HdyActionRow">
+ <property name="title" translatable="no">.7z</property>
+ <property name="subtitle" translatable="yes">Smaller archives but must be installed on
Windows and Mac.</property>
+ <property name="activatable-widget">seven_zip_radio_button</property>
+ <child type="prefix">
+ <object class="GtkRadioButton" id="seven_zip_radio_button">
+ <property name="draw-indicator">True</property>
+ <property name="can-focus">False</property>
+ <property name="group">zip_radio_button</property>
+ <signal name="toggled" handler="seven_zip_radio_button_on_toggled"/>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
<packing>
@@ -110,57 +115,6 @@
<property name="position">4</property>
</packing>
</child>
- <child>
- <object class="GtkStack" id="description_stack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">True</property>
- <child>
- <object class="GtkLabel" id="zip_description_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Compatible with all operating systems.</property>
- <property name="xalign">0</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="name">zip-description-label</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="tar_xz_description_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Smaller archives but Linux and Mac only.</property>
- <property name="xalign">0</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="name">tar-xz-description-label</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="seven_zip_description_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Smaller archives but must be installed on Windows
and Mac.</property>
- <property name="xalign">0</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="name">seven-zip-description-label</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">5</property>
- </packing>
- </child>
</object>
</child>
<child type="action">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]