[evince/wip/gpoo/gtk4-rebase-port: 49/96] shell: Port properties dialog to gtk4




commit 419aa4b52af75a8507ccf035a6f02fa5a6d76a27
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Tue Aug 3 09:52:06 2021 +0800

    shell: Port properties dialog to gtk4

 properties/ev-properties-main.c  |  4 ++--
 properties/ev-properties-view.c  |  5 +++--
 shell/ev-properties-dialog.c     |  4 ++--
 shell/ev-properties-fonts.c      | 14 +++++++-------
 shell/ev-properties-license.c    | 10 ++++------
 shell/evince-properties-fonts.ui | 23 ++++-------------------
 6 files changed, 22 insertions(+), 38 deletions(-)
---
diff --git a/properties/ev-properties-main.c b/properties/ev-properties-main.c
index 5c6095dd1..eb9b75954 100644
--- a/properties/ev-properties-main.c
+++ b/properties/ev-properties-main.c
@@ -119,13 +119,13 @@ ev_properties_get_pages (NautilusPropertyPageProvider *provider,
                                     ev_document_get_info (document));
        gtk_widget_show (page);
 
-       scrolled = gtk_scrolled_window_new (NULL, NULL);
+       scrolled = gtk_scrolled_window_new ();
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
                                        GTK_POLICY_NEVER,
                                        GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_propagate_natural_width (GTK_SCROLLED_WINDOW (scrolled),
                                                         TRUE);
-       gtk_container_add (GTK_CONTAINER (scrolled), page);
+       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), page);
        gtk_widget_show (scrolled);
 
        property_page = nautilus_property_page_new ("document-properties",
diff --git a/properties/ev-properties-view.c b/properties/ev-properties-view.c
index e01d93d3c..bf8ea731b 100644
--- a/properties/ev-properties-view.c
+++ b/properties/ev-properties-view.c
@@ -244,6 +244,7 @@ set_property (EvPropertiesView *properties,
                properties->labels[property] = value_label;
        }
 
+#if 0
        if (property_label && value_label) {
                atk_object_add_relationship (gtk_widget_get_accessible (property_label),
                                             ATK_RELATION_LABEL_FOR,
@@ -252,6 +253,7 @@ set_property (EvPropertiesView *properties,
                                             ATK_RELATION_LABELLED_BY,
                                             gtk_widget_get_accessible (property_label));
        }
+#endif
 
        gtk_widget_show (value_label);
 
@@ -451,12 +453,11 @@ ev_properties_view_init (EvPropertiesView *properties)
        properties->grid = gtk_grid_new ();
        gtk_grid_set_column_spacing (GTK_GRID (properties->grid), 12);
        gtk_grid_set_row_spacing (GTK_GRID (properties->grid), 6);
-       gtk_box_pack_start (GTK_BOX (properties), properties->grid, TRUE, TRUE, 0);
-       gtk_widget_show (properties->grid);
        gtk_widget_set_margin_bottom (properties->grid, 12);
        gtk_widget_set_margin_top (properties->grid, 12);
        gtk_widget_set_margin_start (properties->grid, 12);
        gtk_widget_set_margin_end (properties->grid, 12);
+       gtk_box_prepend (GTK_BOX (properties), properties->grid);
 }
 
 void
diff --git a/shell/ev-properties-dialog.c b/shell/ev-properties-dialog.c
index e8ddf5b58..7aa19c16d 100644
--- a/shell/ev-properties-dialog.c
+++ b/shell/ev-properties-dialog.c
@@ -58,14 +58,14 @@ ev_properties_dialog_init (EvPropertiesDialog *properties)
        GtkBox *content_area;
 
        content_area = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (properties)));
-       gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
+       // gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
 
        gtk_window_set_title (GTK_WINDOW (properties), _("Properties"));
        gtk_window_set_destroy_with_parent (GTK_WINDOW (properties), TRUE);
 
        properties->notebook = gtk_notebook_new ();
        gtk_notebook_set_show_border (GTK_NOTEBOOK (properties->notebook), FALSE);
-       gtk_box_pack_start (content_area, properties->notebook, TRUE, TRUE, 0);
+       gtk_box_prepend (content_area, properties->notebook);
        gtk_widget_show (properties->notebook);
 }
 
diff --git a/shell/ev-properties-fonts.c b/shell/ev-properties-fonts.c
index 8a7586dab..52b4f32d3 100644
--- a/shell/ev-properties-fonts.c
+++ b/shell/ev-properties-fonts.c
@@ -58,12 +58,12 @@ ev_properties_fonts_dispose (GObject *object)
        EvPropertiesFonts *properties = EV_PROPERTIES_FONTS (object);
 
        if (properties->fonts_job) {
-               g_signal_handlers_disconnect_by_func (properties->fonts_job, 
-                                                     job_fonts_finished_cb, 
+               g_signal_handlers_disconnect_by_func (properties->fonts_job,
+                                                     job_fonts_finished_cb,
                                                      properties);
                ev_job_cancel (properties->fonts_job);
 
-               g_object_unref (properties->fonts_job);         
+               g_object_unref (properties->fonts_job);
                properties->fonts_job = NULL;
        }
 
@@ -110,7 +110,7 @@ font_cell_data_func (GtkTreeViewColumn *col, GtkCellRenderer *renderer,
                markup = g_strdup_printf ("<b><big>%s</big></b>", name);
        }
 
-       g_object_set (renderer, "markup", markup, NULL, NULL);
+       g_object_set (renderer, "markup", markup, NULL);
 
        g_free (markup);
        g_free (details);
@@ -156,11 +156,11 @@ job_fonts_finished_cb (EvJob *job, EvPropertiesFonts *properties)
 
        font_summary = ev_document_fonts_get_fonts_summary (document_fonts);
        if (font_summary) {
-               gtk_label_set_text (GTK_LABEL (properties->fonts_summary),
+               gtk_label_set_text (GTK_LABEL (properties->summary),
                                    font_summary);
                /* show the label only when fonts are scanned, so the label
                 * does not take space while it is loading */
-               gtk_widget_show (properties->fonts_summary);
+               gtk_widget_show (properties->summary);
        }
 }
 
@@ -170,7 +170,7 @@ job_fonts_updated_cb (EvJobFonts *job, gdouble progress, EvPropertiesFonts *prop
        GtkTreeModel *model;
        EvDocumentFonts *document_fonts = EV_DOCUMENT_FONTS (properties->document);
 
-       update_progress_label (properties->fonts_progress_label, progress);
+       update_progress_label (properties->progress_label, progress);
 
        model = gtk_tree_view_get_model (properties->fonts_treeview);
        /* Document lock is already held by the jop */
diff --git a/shell/ev-properties-license.c b/shell/ev-properties-license.c
index 5a1cf9685..c4823989a 100644
--- a/shell/ev-properties-license.c
+++ b/shell/ev-properties-license.c
@@ -116,12 +116,12 @@ ev_properties_license_add_section (EvPropertiesLicense *properties,
        markup = g_strdup_printf ("<b>%s</b>", title_text);
        gtk_label_set_markup (GTK_LABEL (title), markup);
        g_free (markup);
-       gtk_box_pack_start (GTK_BOX (properties), title, FALSE, FALSE, 0);
+       gtk_box_prepend (GTK_BOX (properties), title);
        gtk_widget_show (title);
 
        g_object_set (G_OBJECT (contents), "margin-left", 12, NULL);
 
-       gtk_box_pack_start (GTK_BOX (properties), contents, FALSE, TRUE, 0);
+       gtk_box_prepend (GTK_BOX (properties), contents);
        gtk_widget_show (contents);
 }
 
@@ -138,10 +138,8 @@ ev_properties_license_set_license (EvPropertiesLicense *properties,
        if (text) {
                if (!properties->license) {
                        properties->license = get_license_text_widget (license);
-                       swindow = gtk_scrolled_window_new (NULL, NULL);
-                       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
-                                                            GTK_SHADOW_IN);
-                       gtk_container_add (GTK_CONTAINER (swindow), properties->license);
+                       swindow = gtk_scrolled_window_new ();
+                       gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), properties->license);
                        ev_properties_license_add_section (properties,
                                                           _("Usage terms"),
                                                           swindow);
diff --git a/shell/evince-properties-fonts.ui b/shell/evince-properties-fonts.ui
index 02e23d130..a503121fc 100644
--- a/shell/evince-properties-fonts.ui
+++ b/shell/evince-properties-fonts.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Generated with glade 3.38.2 -->
 <interface>
-  <requires lib="gtk+" version="3.16"/>
+  <requires lib="gtk" version="4.0"/>
   <template class="EvPropertiesFonts" parent="GtkBox">
     <property name="can-focus">False</property>
     <property name="margin-start">12</property>
@@ -10,19 +10,14 @@
     <property name="margin-bottom">12</property>
     <property name="orientation">vertical</property>
     <property name="spacing">6</property>
-    <child>
+    <child type="start">
       <object class="GtkLabel" id="fonts_summary">
         <property name="can-focus">False</property>
         <property name="wrap">True</property>
         <property name="xalign">0.0</property>
       </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-        <property name="position">0</property>
-      </packing>
     </child>
-    <child>
+    <child type="start">
       <object class="GtkScrolledWindow">
         <property name="can-focus">False</property>
         <property name="shadow-type">in</property>
@@ -49,22 +44,12 @@
           </object>
         </child>
       </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
     </child>
     <child>
       <object class="GtkLabel" id="fonts_progress_label">
         <property name="can-focus">False</property>
-        <property name="xalign">0</property>
+        <property name="xalign">0.0</property>
       </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
     </child>
   </template>
 </interface>


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