[nautilus/wip/apoos-maximus/gsoc2020: 12/26] properties-window: Add "Open With" tab to template




commit 936e7a3085ab26da621cc05789573e8d9f120bde
Author: Apoorv Sachan <apoorv 99 sachan gmail com>
Date:   Sat Jul 4 18:59:06 2020 +0530

    properties-window: Add "Open With" tab to template
    
    This commit only creates outer container of the Open With tab.
    
    Inner widgets are ported in the next commit.

 src/nautilus-properties-window.c               | 19 +++++++++----------
 src/resources/ui/nautilus-properties-window.ui | 24 ++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index c691d3a61..1224cae94 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -200,6 +200,10 @@ struct _NautilusPropertiesWindow
     GtkWidget *change_permissions_button_box;
     GtkWidget *change_permissions_button;
 
+    /* Open With tab Widgets */
+
+    GtkWidget *open_with_box;
+
     GroupChange *group_change;
     OwnerChange *owner_change;
 
@@ -4971,7 +4975,7 @@ should_show_open_with (NautilusPropertiesWindow *window)
 }
 
 static void
-create_open_with_page (NautilusPropertiesWindow *window)
+setup_open_with_page (NautilusPropertiesWindow *window)
 {
     GtkWidget *vbox;
     char *mime_type;
@@ -4995,18 +4999,11 @@ create_open_with_page (NautilusPropertiesWindow *window)
     }
 
     vbox = nautilus_mime_application_chooser_new (files, mime_type);
+    gtk_box_pack_start (GTK_BOX (window->open_with_box), vbox, TRUE, TRUE, 0);
 
-    gtk_widget_show (vbox);
     g_free (mime_type);
     g_list_free (files);
-
     g_object_set_data_full (G_OBJECT (vbox), "help-uri", g_strdup ("help:gnome-help/files-open"), g_free);
-    gtk_notebook_append_page (window->notebook,
-                              vbox, gtk_label_new (_("Open With")));
-    gtk_container_child_set (GTK_CONTAINER (window->notebook),
-                             vbox,
-                             "tab-expand", TRUE,
-                             NULL);
 }
 
 
@@ -5109,7 +5106,8 @@ create_properties_window (StartupData *startup_data)
 
     if (should_show_open_with (window))
     {
-        create_open_with_page (window);
+        setup_open_with_page (window);
+        gtk_widget_show (window->open_with_box);
     }
 
     /* append pages from available views */
@@ -5832,6 +5830,7 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, spacer_8);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, 
change_permissions_button_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, change_permissions_button);
+    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, open_with_box);
 }
 
 static void
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index 37a5c6315..f2caa3259 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -1167,6 +1167,30 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkBox" id="open_with_box">
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_expand">True</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Open With</property>
+              </object>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
             <child>
               <placeholder/>
             </child>


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