[nautilus/wip/antoniof/extension-properties: 7/11] properties: Remove old extensions API




commit 3c2d847f05564fdcd14eb14bbb8ba0d4b9096fd9
Author: António Fernandes <antoniof gnome org>
Date:   Sat Aug 6 15:55:50 2022 +0100

    properties: Remove old extensions API
    
    We want to control the layout of the window, not having extensions
    injecting their own widgets.
    
    This also avoids future breakage when porting to newer versions of GTK.

 libnautilus-extension/meson.build                  |   4 -
 libnautilus-extension/nautilus-extension.h         |   2 -
 .../nautilus-property-page-provider.c              |  48 ----
 .../nautilus-property-page-provider.h              |  88 --------
 libnautilus-extension/nautilus-property-page.c     | 242 ---------------------
 libnautilus-extension/nautilus-property-page.h     |  96 --------
 po/POTFILES.in                                     |   1 -
 src/nautilus-properties-window.c                   |  96 --------
 src/resources/ui/nautilus-properties-window.ui     |   8 -
 9 files changed, 585 deletions(-)
---
diff --git a/libnautilus-extension/meson.build b/libnautilus-extension/meson.build
index 27f21a5b5..fdfd8c1a6 100644
--- a/libnautilus-extension/meson.build
+++ b/libnautilus-extension/meson.build
@@ -10,8 +10,6 @@ libnautilus_extension_headers = [
   'nautilus-properties-model-provider.h',
   'nautilus-properties-model.h',
   'nautilus-properties-item.h',
-  'nautilus-property-page-provider.h',
-  'nautilus-property-page.h',
   'nautilus-menu.h'
 ]
 
@@ -48,8 +46,6 @@ libnautilus_extension_sources = [
   'nautilus-properties-model-provider.c',
   'nautilus-properties-model.c',
   'nautilus-properties-item.c',
-  'nautilus-property-page-provider.c',
-  'nautilus-property-page.c',
   'nautilus-menu.c'
 ]
 
diff --git a/libnautilus-extension/nautilus-extension.h b/libnautilus-extension/nautilus-extension.h
index af3f67837..34abd91c1 100644
--- a/libnautilus-extension/nautilus-extension.h
+++ b/libnautilus-extension/nautilus-extension.h
@@ -29,8 +29,6 @@
 #include <libnautilus-extension/nautilus-properties-model.h>
 #include <libnautilus-extension/nautilus-properties-model-provider.h>
 #include <libnautilus-extension/nautilus-properties-item.h>
-#include <libnautilus-extension/nautilus-property-page.h>
-#include <libnautilus-extension/nautilus-property-page-provider.h>
 
 /**
  * SECTION:nautilus-extension
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 261acf13e..4aa2ffe28 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,7 +14,6 @@ extensions/image-properties/nautilus-image-properties-model.c
 extensions/image-properties/nautilus-image-properties-model-provider.c
 libnautilus-extension/nautilus-column.c
 libnautilus-extension/nautilus-menu-item.c
-libnautilus-extension/nautilus-property-page.c
 src/nautilus-application.c
 src/nautilus-app-chooser.c
 src/nautilus-autorun-software.c
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 447bd1578..af8c2d8bb 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -48,7 +48,6 @@
 #include "nautilus-module.h"
 #include "nautilus-properties-model.h"
 #include "nautilus-properties-item.h"
-#include "nautilus-property-page.h"
 #include "nautilus-signaller.h"
 #include "nautilus-tag-manager.h"
 #include "nautilus-ui-utilities.h"
@@ -133,8 +132,6 @@ struct _NautilusPropertiesWindow
     GtkWidget *permissions_navigation_row;
     GtkWidget *permissions_value_label;
 
-    GtkListBox *extension_list_box;
-
     GtkWidget *extension_models_list_box;
     GList *extensions_properties_models;
 
@@ -470,7 +467,6 @@ static void set_icon (const char               *icon_path,
 static void remove_pending (StartupData *data,
                             gboolean     cancel_call_when_ready,
                             gboolean     cancel_timed_wait);
-static void refresh_extension_pages (NautilusPropertiesWindow *self);
 static void refresh_extension_model_pages (NautilusPropertiesWindow *self);
 
 G_DEFINE_TYPE (NautilusPropertiesWindow, nautilus_properties_window, ADW_TYPE_WINDOW);
@@ -547,15 +543,6 @@ navigate_permissions_page (NautilusPropertiesWindow *self,
     gtk_stack_set_visible_child_name (self->page_stack, "permissions");
 }
 
-static void
-navigate_extension_page (NautilusPropertiesWindow *self,
-                         GParamSpec               *params,
-                         AdwPreferencesRow        *row)
-{
-    gtk_stack_set_visible_child_name (self->page_stack,
-                                      adw_preferences_row_get_title (row));
-}
-
 static void
 navigate_extension_model_page (NautilusPropertiesWindow *self,
                                GParamSpec               *params,
@@ -925,55 +912,6 @@ file_list_get_string_attribute (GList      *file_list,
     }
 }
 
-static GtkWidget *
-add_extension_page (NautilusPropertyPage     *property_page,
-                    NautilusPropertiesWindow *self)
-{
-    GtkWidget *row;
-    GtkWidget *image;
-    GtkWidget *page_widget;
-    GtkWidget *header_bar;
-    GtkWidget *up_button;
-    GtkWidget *box;
-    const char *extension_type;
-    g_autofree char *navigation_label = NULL;
-
-    row = adw_action_row_new ();
-    image = gtk_image_new_from_icon_name ("go-next-symbolic");
-    extension_type = gtk_label_get_text (GTK_LABEL (nautilus_property_page_get_label (property_page)));
-    navigation_label = g_strdup_printf (_("%s Properties"), extension_type);
-    page_widget = nautilus_property_page_get_widget (property_page);
-
-    adw_preferences_row_set_title (ADW_PREFERENCES_ROW (row), navigation_label);
-    adw_action_row_add_suffix (ADW_ACTION_ROW (row), image);
-
-    gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), TRUE);
-    gtk_list_box_row_set_selectable (GTK_LIST_BOX_ROW (row), FALSE);
-
-    g_signal_connect_swapped (row, "activated",
-                              G_CALLBACK (navigate_extension_page),
-                              self);
-
-    header_bar = gtk_header_bar_new ();
-    gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar),
-                                     adw_window_title_new (navigation_label, NULL));
-
-    up_button = gtk_button_new_from_icon_name ("go-previous-symbolic");
-    g_signal_connect_swapped (up_button, "clicked", G_CALLBACK (navigate_main_page), self);
-    gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), up_button);
-
-    box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-    gtk_box_append (GTK_BOX (box), header_bar);
-    gtk_box_append (GTK_BOX (box), page_widget);
-    gtk_widget_add_css_class (page_widget, "background");
-
-    gtk_stack_add_named (self->page_stack,
-                         box,
-                         navigation_label);
-
-    return row;
-}
-
 static GtkWidget *
 create_extension_group_row (NautilusPropertiesItem   *item,
                             NautilusPropertiesWindow *self)
@@ -1470,7 +1408,6 @@ properties_window_update (NautilusPropertiesWindow *self,
     {
         if (!mime_list_equal (self->mime_list, mime_list))
         {
-            refresh_extension_pages (self);
             refresh_extension_model_pages (self);
         }
 
@@ -3694,35 +3631,6 @@ setup_permissions_page (NautilusPropertiesWindow *self)
     }
 }
 
-static void
-refresh_extension_pages (NautilusPropertiesWindow *self)
-{
-    GListStore *extension_providers = g_list_store_new (NAUTILUS_TYPE_PROPERTY_PAGE);
-    g_autolist (GObject) providers =
-        nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER);
-
-    for (GList *p = providers; p != NULL; p = p->next)
-    {
-        NautilusPropertyPageProvider *provider = NAUTILUS_PROPERTY_PAGE_PROVIDER (p->data);
-        g_autolist (NautilusPropertyPage) pages =
-            nautilus_property_page_provider_get_pages (provider, self->original_files);
-
-        for (GList *l = pages; l != NULL; l = l->next)
-        {
-            g_list_store_append (extension_providers, NAUTILUS_PROPERTY_PAGE (l->data));
-        }
-    }
-
-    gtk_widget_set_visible (GTK_WIDGET (self->extension_list_box),
-                            g_list_model_get_n_items (G_LIST_MODEL (extension_providers)) > 0);
-
-    gtk_list_box_bind_model (self->extension_list_box,
-                             G_LIST_MODEL (extension_providers),
-                             (GtkListBoxCreateWidgetFunc) add_extension_page,
-                             self,
-                             NULL);
-}
-
 static void
 refresh_extension_model_pages (NautilusPropertiesWindow *self)
 {
@@ -3966,9 +3874,6 @@ create_properties_window (StartupData *startup_data)
         gtk_widget_show (GTK_WIDGET (window->execution_row));
     }
 
-    /* Add available extension pages */
-    refresh_extension_pages (window);
-
     /* Add available extension models pages */
     refresh_extension_model_pages (window);
 
@@ -4532,7 +4437,6 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, accessed_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, 
permissions_navigation_row);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, permissions_value_label);
-    gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, extension_list_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, extension_models_list_box);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, free_space_value_label);
     gtk_widget_class_bind_template_child (widget_class, NautilusPropertiesWindow, permissions_stack);
diff --git a/src/resources/ui/nautilus-properties-window.ui b/src/resources/ui/nautilus-properties-window.ui
index fb787fceb..f137651b0 100644
--- a/src/resources/ui/nautilus-properties-window.ui
+++ b/src/resources/ui/nautilus-properties-window.ui
@@ -662,14 +662,6 @@
                                 </style>
                               </object>
                             </child>
-                            <child>
-                              <object class="GtkListBox" id="extension_list_box">
-                                <property name="selection-mode">none</property>
-                                <style>
-                                  <class name="boxed-list"/>
-                                </style>
-                              </object>
-                            </child>
                             <child>
                               <object class="GtkListBox" id="extension_models_list_box">
                                 <property name="selection-mode">none</property>


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