[file-roller/wip/gtk4: 15/54] gtk4: progress dialog: fixed spacing and other style issues




commit 914487c3731f843f7a4eca588a7f5fb363ea7309
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Sep 30 08:00:15 2022 +0200

    gtk4: progress dialog: fixed spacing and other style issues

 src/fr-window.c           | 19 ++++++-------------
 src/gtk-utils.c           | 15 +++++++++++++++
 src/gtk-utils.h           |  2 ++
 src/ui/progress-dialog.ui |  9 ++++++---
 4 files changed, 29 insertions(+), 16 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index dfb08f32..2362b867 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -56,9 +56,8 @@
 #define ACTIVITY_PULSE_STEP (0.033)
 #define MAX_MESSAGE_LENGTH 50
 
-#define PROGRESS_DIALOG_DEFAULT_WIDTH 500
+#define PROGRESS_DIALOG_DEFAULT_WIDTH 600
 #define PROGRESS_TIMEOUT_MSECS 1000
-#define PROGRESS_BAR_HEIGHT 10
 #undef  LOG_PROGRESS
 
 #define HIDE_PROGRESS_TIMEOUT_MSECS 500
@@ -2380,11 +2379,11 @@ create_the_progress_dialog (FrWindow *window)
 
        builder = gtk_builder_new_from_resource (FILE_ROLLER_RESOURCE_UI_PATH "progress-dialog.ui");
        use_header_bar = _gtk_settings_get_dialogs_use_header ();
-       dialog = g_object_new (GTK_TYPE_DIALOG, "use-header-bar", use_header_bar, NULL);
-       _gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
-                            _gtk_builder_get_widget (builder, "progress_dialog_content"),
-                            TRUE,
-                            TRUE);
+       dialog = g_object_new (GTK_TYPE_DIALOG,
+                              "use-header-bar", use_header_bar,
+                              "default-width", PROGRESS_DIALOG_DEFAULT_WIDTH,
+                              NULL);
+       _gtk_dialog_set_content (GTK_DIALOG (dialog), _gtk_builder_get_widget (builder, 
"progress_dialog_content"));
        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
        gtk_window_set_title (GTK_WINDOW (dialog), title);
        gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
@@ -2398,12 +2397,6 @@ create_the_progress_dialog (FrWindow *window)
                                _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
                                NULL);
 
-       if (use_header_bar) {
-               GtkWidget *header_bar = gtk_dialog_get_header_bar (GTK_DIALOG (dialog));
-               GtkWidget *cancel_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), 
GTK_RESPONSE_CANCEL);
-               gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), cancel_button);
-       }
-
        private->progress_dialog = dialog;
        private->pd_action = _gtk_builder_get_widget (builder, "action_label");
        private->pd_progress_bar = _gtk_builder_get_widget (builder, "progress_progressbar");
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index 4a4c57c4..8fe16c8c 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -690,3 +690,18 @@ _gtk_widget_set_margin (GtkWidget *widget, int margin)
        gtk_widget_set_margin_top (widget, margin);
        gtk_widget_set_margin_bottom (widget, margin);
 }
+
+
+#define DIALOG_CONTENT_MARGIN 15
+
+
+void
+_gtk_dialog_set_content (GtkDialog  *dialog,
+                        GtkWidget  *content)
+{
+       _gtk_widget_set_margin (content, DIALOG_CONTENT_MARGIN);
+       _gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (dialog)),
+                          content,
+                          TRUE,
+                          FALSE);
+}
diff --git a/src/gtk-utils.h b/src/gtk-utils.h
index 667afbbd..c88a3670 100644
--- a/src/gtk-utils.h
+++ b/src/gtk-utils.h
@@ -112,5 +112,7 @@ void          _gtk_box_pack_end              (GtkBox     *box,
                                              gboolean    vexpand);
 void          _gtk_widget_set_margin         (GtkWidget  *widget,
                                              int         margin);
+void          _gtk_dialog_set_content        (GtkDialog  *dialog,
+                                             GtkWidget  *content);
 
 #endif
diff --git a/src/ui/progress-dialog.ui b/src/ui/progress-dialog.ui
index f71a2715..ff03001e 100644
--- a/src/ui/progress-dialog.ui
+++ b/src/ui/progress-dialog.ui
@@ -2,11 +2,13 @@
 <interface>
   <requires lib="gtk" version="4.0"/>
   <object class="GtkBox" id="progress_dialog_content">
-    <property name="spacing">12</property>
+    <property name="orientation">horizontal</property>
+    <property name="spacing">15</property>
     <child>
       <object class="GtkBox" id="box2">
         <property name="orientation">vertical</property>
         <property name="spacing">18</property>
+        <property name="hexpand">1</property>
         <child>
           <object class="GtkLabel" id="action_label">
             <property name="wrap">1</property>
@@ -17,7 +19,7 @@
         <child>
           <object class="GtkBox" id="progress_box">
             <property name="orientation">vertical</property>
-            <property name="spacing">4</property>
+            <property name="spacing">10</property>
             <child>
               <object class="GtkProgressBar" id="progress_progressbar">
                 <property name="vexpand">1</property>
@@ -30,7 +32,8 @@
                 <property name="ellipsize">end</property>
                 <property name="halign">start</property>
                 <attributes>
-                  <attribute name="size" value="9000"></attribute>
+                  <attribute name="size" value="12000"></attribute>
+                  <attribute name="style" value="italic"></attribute>
                 </attributes>
               </object>
             </child>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]