[nautilus/wip/antoniof/extension-properties: 3/3] image-properties: Port to new API




commit 700d235ce381c4c11789479087874d08e87bc1fa
Author: António Fernandes <antoniof gnome org>
Date:   Fri Aug 5 23:30:21 2022 +0100

    image-properties: Port to new API

 extensions/image-properties/meson.build            |   8 +-
 ... => nautilus-image-properties-model-provider.c} |  48 ++--
 ... => nautilus-image-properties-model-provider.h} |  10 +-
 ...es-page.c => nautilus-image-properties-model.c} | 287 +++++++++------------
 ...es-page.h => nautilus-image-properties-model.h} |   2 +-
 .../nautilus-image-properties-module.c             |   6 +-
 po/POTFILES.in                                     |   4 +-
 7 files changed, 153 insertions(+), 212 deletions(-)
---
diff --git a/extensions/image-properties/meson.build b/extensions/image-properties/meson.build
index b292a1905..bb8fcda8a 100644
--- a/extensions/image-properties/meson.build
+++ b/extensions/image-properties/meson.build
@@ -1,10 +1,10 @@
 shared_module (
   'nautilus-image-properties', [
     'nautilus-image-properties-module.c',
-    'nautilus-image-properties-page.c',
-    'nautilus-image-properties-page.h',
-    'nautilus-image-properties-page-provider.c',
-    'nautilus-image-properties-page-provider.h'
+    'nautilus-image-properties-model.c',
+    'nautilus-image-properties-model.h',
+    'nautilus-image-properties-model-provider.c',
+    'nautilus-image-properties-model-provider.h'
   ],
   dependencies: [
     gexiv,
diff --git a/extensions/image-properties/nautilus-image-properties-page-provider.c 
b/extensions/image-properties/nautilus-image-properties-model-provider.c
similarity index 58%
rename from extensions/image-properties/nautilus-image-properties-page-provider.c
rename to extensions/image-properties/nautilus-image-properties-model-provider.c
index 5ad8b72c0..f22d23191 100644
--- a/extensions/image-properties/nautilus-image-properties-page-provider.c
+++ b/extensions/image-properties/nautilus-image-properties-model-provider.c
@@ -20,29 +20,25 @@
  * XMP support by Hubert Figuiere <hfiguiere novell com>
  */
 
-#include "nautilus-image-properties-page-provider.h"
+#include "nautilus-image-properties-model-provider.h"
 
-#include "nautilus-image-properties-page.h"
-
-#include <glib/gi18n.h>
+#include "nautilus-image-properties-model.h"
 
 #include <nautilus-extension.h>
 
-#define NAUTILUS_IMAGE_PROPERTIES_PAGE_NAME "NautilusImagePropertiesPage::property_page"
-
-struct _NautilusImagesPropertiesPageProvider
+struct _NautilusImagesPropertiesModelProvider
 {
     GObject parent_instance;
 };
 
-static void property_page_provider_iface_init (NautilusPropertyPageProviderInterface *iface);
+static void properties_group_provider_iface_init (NautilusPropertiesModelProviderInterface *iface);
 
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (NautilusImagesPropertiesPageProvider,
-                                nautilus_image_properties_page_provider,
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (NautilusImagesPropertiesModelProvider,
+                                nautilus_image_properties_model_provider,
                                 G_TYPE_OBJECT,
                                 0,
-                                G_IMPLEMENT_INTERFACE_DYNAMIC (NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
-                                                               property_page_provider_iface_init))
+                                G_IMPLEMENT_INTERFACE_DYNAMIC (NAUTILUS_TYPE_PROPERTIES_MODEL_PROVIDER,
+                                                               properties_group_provider_iface_init))
 
 static gboolean
 is_mime_type_supported (const char *mime_type)
@@ -76,13 +72,12 @@ is_mime_type_supported (const char *mime_type)
 }
 
 static GList *
-get_pages (NautilusPropertyPageProvider *provider,
-           GList                        *files)
+get_groups (NautilusPropertiesModelProvider *provider,
+            GList                           *files)
 {
     NautilusFileInfo *file_info;
     g_autofree char *mime_type = NULL;
-    GtkWidget *image_properties_page;
-    NautilusPropertyPage *property_page;
+    NautilusPropertiesModel *properties_group;
 
     if (files == NULL || files->next != NULL)
     {
@@ -95,40 +90,37 @@ get_pages (NautilusPropertyPageProvider *provider,
     {
         return NULL;
     }
-    image_properties_page = nautilus_image_properties_page_new (file_info);
-    property_page = nautilus_property_page_new (NAUTILUS_IMAGE_PROPERTIES_PAGE_NAME,
-                                                gtk_label_new (_("Image")),
-                                                image_properties_page);
+    properties_group = nautilus_image_properties_model_new (file_info);
 
-    return g_list_prepend (NULL, property_page);
+    return g_list_prepend (NULL, properties_group);
 }
 
 static void
-property_page_provider_iface_init (NautilusPropertyPageProviderInterface *iface)
+properties_group_provider_iface_init (NautilusPropertiesModelProviderInterface *iface)
 {
-    iface->get_pages = get_pages;
+    iface->get_groups = get_groups;
 }
 
 static void
-nautilus_image_properties_page_provider_init (NautilusImagesPropertiesPageProvider *self)
+nautilus_image_properties_model_provider_init (NautilusImagesPropertiesModelProvider *self)
 {
     (void) self;
 }
 
 static void
-nautilus_image_properties_page_provider_class_init (NautilusImagesPropertiesPageProviderClass *klass)
+nautilus_image_properties_model_provider_class_init (NautilusImagesPropertiesModelProviderClass *klass)
 {
     (void) klass;
 }
 
 static void
-nautilus_image_properties_page_provider_class_finalize (NautilusImagesPropertiesPageProviderClass *klass)
+nautilus_image_properties_model_provider_class_finalize (NautilusImagesPropertiesModelProviderClass *klass)
 {
     (void) klass;
 }
 
 void
-nautilus_image_properties_page_provider_load (GTypeModule *module)
+nautilus_image_properties_model_provider_load (GTypeModule *module)
 {
-    nautilus_image_properties_page_provider_register_type (module);
+    nautilus_image_properties_model_provider_register_type (module);
 }
diff --git a/extensions/image-properties/nautilus-image-properties-page-provider.h 
b/extensions/image-properties/nautilus-image-properties-model-provider.h
similarity index 68%
rename from extensions/image-properties/nautilus-image-properties-page-provider.h
rename to extensions/image-properties/nautilus-image-properties-model-provider.h
index 59fd6f905..f56b93961 100644
--- a/extensions/image-properties/nautilus-image-properties-page-provider.h
+++ b/extensions/image-properties/nautilus-image-properties-model-provider.h
@@ -20,11 +20,11 @@
 
 #include <glib-object.h>
 
-#define NAUTILUS_TYPE_IMAGE_PROPERTIES_PAGE_PROVIDER (nautilus_image_properties_page_provider_get_type ())
+#define NAUTILUS_TYPE_IMAGE_PROPERTIES_MODEL_PROVIDER (nautilus_image_properties_model_provider_get_type ())
 
-G_DECLARE_FINAL_TYPE (NautilusImagesPropertiesPageProvider,
-                      nautilus_image_properties_page_provider,
-                      NAUTILUS, IMAGE_PROPERTIES_PAGE_PROVIDER,
+G_DECLARE_FINAL_TYPE (NautilusImagesPropertiesModelProvider,
+                      nautilus_image_properties_model_provider,
+                      NAUTILUS, IMAGE_PROPERTIES_MODEL_PROVIDER,
                       GObject)
 
-void nautilus_image_properties_page_provider_load (GTypeModule *module);
\ No newline at end of file
+void nautilus_image_properties_model_provider_load (GTypeModule *module);
diff --git a/extensions/image-properties/nautilus-image-properties-page.c 
b/extensions/image-properties/nautilus-image-properties-model.c
similarity index 56%
rename from extensions/image-properties/nautilus-image-properties-page.c
rename to extensions/image-properties/nautilus-image-properties-model.c
index ea415aa69..b64a58df7 100644
--- a/extensions/image-properties/nautilus-image-properties-page.c
+++ b/extensions/image-properties/nautilus-image-properties-model.c
@@ -19,7 +19,7 @@
  * XMP support by Hubert Figuiere <hfiguiere novell com>
  */
 
-#include "nautilus-image-properties-page.h"
+#include "nautilus-image-properties-model.h"
 
 #include <gexiv2/gexiv2.h>
 #include <glib/gi18n.h>
@@ -30,10 +30,9 @@
 
 typedef struct
 {
-    GtkWidget *page_widget;
+    GListStore *group_model;
 
     GCancellable *cancellable;
-    GtkWidget *grid;
     GdkPixbufLoader *loader;
     gboolean got_size;
     gboolean pixbuf_still_loading;
@@ -43,87 +42,41 @@ typedef struct
 
     GExiv2Metadata *md;
     gboolean md_ready;
-} NautilusImagesPropertiesPage;
+} NautilusImagesPropertiesModel;
 
 static void
-nautilus_images_properties_page_free (NautilusImagesPropertiesPage *page)
+nautilus_images_properties_model_free (NautilusImagesPropertiesModel *self)
 {
-    if (page->cancellable != NULL)
+    if (self->cancellable != NULL)
     {
-        g_cancellable_cancel (page->cancellable);
-        g_clear_object (&page->cancellable);
+        g_cancellable_cancel (self->cancellable);
+        g_clear_object (&self->cancellable);
     }
-    g_free (page);
+    g_free (self);
 }
 
 static void
-append_item (NautilusImagesPropertiesPage *page,
-             const char                   *name,
-             const char                   *value)
+append_item (NautilusImagesPropertiesModel *self,
+             const char                    *name,
+             const char                    *value)
 {
-    GtkWidget *name_label;
-    PangoAttrList *attrs;
-
-    name_label = gtk_label_new (name);
-    attrs = pango_attr_list_new ();
-
-    pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
-    gtk_label_set_attributes (GTK_LABEL (name_label), attrs);
-    pango_attr_list_unref (attrs);
-    gtk_grid_attach_next_to (GTK_GRID (page->grid), name_label, NULL, GTK_POS_BOTTOM, 1, 1);
-    gtk_widget_set_halign (name_label, GTK_ALIGN_START);
-    gtk_widget_show (name_label);
+    g_autoptr (NautilusPropertiesItem) item = NULL;
 
+    item = nautilus_properties_item_new (name, value);
     if (value != NULL)
     {
-        GtkWidget *value_label;
-
-        value_label = gtk_label_new (value);
-
-        gtk_label_set_wrap (GTK_LABEL (value_label), TRUE);
-        gtk_grid_attach_next_to (GTK_GRID (page->grid), value_label,
-                                 name_label, GTK_POS_RIGHT,
-                                 1, 1);
-        gtk_widget_set_halign (value_label, GTK_ALIGN_START);
-        gtk_widget_set_hexpand (value_label, TRUE);
-        gtk_widget_show (value_label);
+        g_list_store_append (self->group_model, item);
     }
 }
 
 static void
-nautilus_image_properties_page_init (NautilusImagesPropertiesPage *self)
+nautilus_image_properties_model_init (NautilusImagesPropertiesModel *self)
 {
-    self->page_widget = gtk_scrolled_window_new ();
-
-    g_object_set (self->page_widget,
-                  "margin-bottom", 6,
-                  "margin-end", 12,
-                  "margin-start", 12,
-                  "margin-top", 6,
-                  NULL);
-    gtk_widget_set_vexpand (self->page_widget, TRUE);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self->page_widget),
-                                    GTK_POLICY_NEVER,
-                                    GTK_POLICY_AUTOMATIC);
-
-    self->grid = gtk_grid_new ();
-
-    gtk_orientable_set_orientation (GTK_ORIENTABLE (self->grid), GTK_ORIENTATION_VERTICAL);
-    gtk_grid_set_row_spacing (GTK_GRID (self->grid), 6);
-    gtk_grid_set_column_spacing (GTK_GRID (self->grid), 18);
-    append_item (self, _("Loading…"), NULL);
-#if GTK_MAJOR_VERSION < 4
-    gtk_container_add (GTK_CONTAINER (self->page_widget), self->grid);
-#else
-    gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (self->page_widget),
-                                   self->grid);
-#endif
-
-    gtk_widget_show (GTK_WIDGET (self->page_widget));
+    self->group_model = g_list_store_new (NAUTILUS_TYPE_PROPERTIES_ITEM);
 }
 
 static void
-append_basic_info (NautilusImagesPropertiesPage *page)
+append_basic_info (NautilusImagesPropertiesModel *self)
 {
     GdkPixbufFormat *format;
     GExiv2Orientation orientation;
@@ -133,27 +86,27 @@ append_basic_info (NautilusImagesPropertiesPage *page)
     g_autofree char *desc = NULL;
     g_autofree char *value = NULL;
 
-    format = gdk_pixbuf_loader_get_format (page->loader);
+    format = gdk_pixbuf_loader_get_format (self->loader);
     name = gdk_pixbuf_format_get_name (format);
     desc = gdk_pixbuf_format_get_description (format);
     value = g_strdup_printf ("%s (%s)", name, desc);
 
-    append_item (page, _("Image Type"), value);
+    append_item (self, _("Image Type"), value);
 
-    orientation = gexiv2_metadata_try_get_orientation (page->md, NULL);
+    orientation = gexiv2_metadata_try_get_orientation (self->md, NULL);
 
     if (orientation == GEXIV2_ORIENTATION_ROT_90
         || orientation == GEXIV2_ORIENTATION_ROT_270
         || orientation == GEXIV2_ORIENTATION_ROT_90_HFLIP
         || orientation == GEXIV2_ORIENTATION_ROT_90_VFLIP)
     {
-        width = page->height;
-        height = page->width;
+        width = self->height;
+        height = self->width;
     }
     else
     {
-        width = page->width;
-        height = page->height;
+        width = self->width;
+        height = self->height;
     }
 
     g_free (value);
@@ -162,7 +115,7 @@ append_basic_info (NautilusImagesPropertiesPage *page)
                                        width),
                              width);
 
-    append_item (page, _("Width"), value);
+    append_item (self, _("Width"), value);
 
     g_free (value);
     value = g_strdup_printf (ngettext ("%d pixel",
@@ -170,23 +123,23 @@ append_basic_info (NautilusImagesPropertiesPage *page)
                                        height),
                              height);
 
-    append_item (page, _("Height"), value);
+    append_item (self, _("Height"), value);
 }
 
 static void
-append_gexiv2_tag (NautilusImagesPropertiesPage  *page,
-                   const char                   **tag_names,
-                   const char                    *description)
+append_gexiv2_tag (NautilusImagesPropertiesModel  *self,
+                   const char                    **tag_names,
+                   const char                     *description)
 {
     g_assert (tag_names != NULL);
 
     for (const char **i = tag_names; *i != NULL; i++)
     {
-        if (gexiv2_metadata_try_has_tag (page->md, *i, NULL))
+        if (gexiv2_metadata_try_has_tag (self->md, *i, NULL))
         {
             g_autofree char *tag_value = NULL;
 
-            tag_value = gexiv2_metadata_try_get_tag_interpreted_string (page->md, *i, NULL);
+            tag_value = gexiv2_metadata_try_get_tag_interpreted_string (self->md, *i, NULL);
 
             if (description == NULL)
             {
@@ -196,7 +149,7 @@ append_gexiv2_tag (NautilusImagesPropertiesPage  *page,
             /* don't add empty tags - try next one */
             if (strlen (tag_value) > 0)
             {
-                append_item (page, description, tag_value);
+                append_item (self, description, tag_value);
                 break;
             }
         }
@@ -204,7 +157,7 @@ append_gexiv2_tag (NautilusImagesPropertiesPage  *page,
 }
 
 static void
-append_gexiv2_info (NautilusImagesPropertiesPage *page)
+append_gexiv2_info (NautilusImagesPropertiesModel *self)
 {
     double longitude;
     double latitude;
@@ -229,30 +182,30 @@ append_gexiv2_info (NautilusImagesPropertiesPage *page)
     const char *rights[] = { "Xmp.dc.rights", NULL };
     const char *rating[] = { "Xmp.xmp.Rating", NULL };
 
-    if (!page->md_ready)
+    if (!self->md_ready)
     {
         return;
     }
 
-    append_gexiv2_tag (page, camera_brand, _("Camera Brand"));
-    append_gexiv2_tag (page, camera_model, _("Camera Model"));
-    append_gexiv2_tag (page, exposure_time, _("Exposure Time"));
-    append_gexiv2_tag (page, exposure_mode, _("Exposure Program"));
-    append_gexiv2_tag (page, aperture_value, _("Aperture Value"));
-    append_gexiv2_tag (page, iso_speed_ratings, _("ISO Speed Rating"));
-    append_gexiv2_tag (page, flash, _("Flash Fired"));
-    append_gexiv2_tag (page, metering_mode, _("Metering Mode"));
-    append_gexiv2_tag (page, focal_length, _("Focal Length"));
-    append_gexiv2_tag (page, software, _("Software"));
-    append_gexiv2_tag (page, title, _("Title"));
-    append_gexiv2_tag (page, description, _("Description"));
-    append_gexiv2_tag (page, subject, _("Keywords"));
-    append_gexiv2_tag (page, creator, _("Creator"));
-    append_gexiv2_tag (page, created_on, _("Created On"));
-    append_gexiv2_tag (page, rights, _("Copyright"));
-    append_gexiv2_tag (page, rating, _("Rating"));
-
-    if (gexiv2_metadata_try_get_gps_info (page->md, &longitude, &latitude, &altitude, NULL))
+    append_gexiv2_tag (self, camera_brand, _("Camera Brand"));
+    append_gexiv2_tag (self, camera_model, _("Camera Model"));
+    append_gexiv2_tag (self, exposure_time, _("Exposure Time"));
+    append_gexiv2_tag (self, exposure_mode, _("Exposure Program"));
+    append_gexiv2_tag (self, aperture_value, _("Aperture Value"));
+    append_gexiv2_tag (self, iso_speed_ratings, _("ISO Speed Rating"));
+    append_gexiv2_tag (self, flash, _("Flash Fired"));
+    append_gexiv2_tag (self, metering_mode, _("Metering Mode"));
+    append_gexiv2_tag (self, focal_length, _("Focal Length"));
+    append_gexiv2_tag (self, software, _("Software"));
+    append_gexiv2_tag (self, title, _("Title"));
+    append_gexiv2_tag (self, description, _("Description"));
+    append_gexiv2_tag (self, subject, _("Keywords"));
+    append_gexiv2_tag (self, creator, _("Creator"));
+    append_gexiv2_tag (self, created_on, _("Created On"));
+    append_gexiv2_tag (self, rights, _("Copyright"));
+    append_gexiv2_tag (self, rating, _("Rating"));
+
+    if (gexiv2_metadata_try_get_gps_info (self->md, &longitude, &latitude, &altitude, NULL))
     {
         g_autofree char *gps_coords = NULL;
 
@@ -267,40 +220,35 @@ append_gexiv2_info (NautilusImagesPropertiesPage *page)
                                       longitude >= 0 ? _("E") : _("W"),
                                       altitude);
 
-        append_item (page, _("Coordinates"), gps_coords);
+        append_item (self, _("Coordinates"), gps_coords);
     }
 }
 
 static void
-load_finished (NautilusImagesPropertiesPage *page)
+load_finished (NautilusImagesPropertiesModel *self)
 {
-    GtkWidget *label;
-
-    label = gtk_grid_get_child_at (GTK_GRID (page->grid), 0, 0);
-    gtk_widget_hide (label);
-
-    if (page->loader != NULL)
+    if (self->loader != NULL)
     {
-        gdk_pixbuf_loader_close (page->loader, NULL);
+        gdk_pixbuf_loader_close (self->loader, NULL);
     }
 
-    if (page->got_size)
+    if (self->got_size)
     {
-        append_basic_info (page);
-        append_gexiv2_info (page);
+        append_basic_info (self);
+        append_gexiv2_info (self);
     }
     else
     {
-        append_item (page, _("Failed to load image information"), NULL);
+        append_item (self, _("Failed to load image information"), NULL);
     }
 
-    if (page->loader != NULL)
+    if (self->loader != NULL)
     {
-        g_object_unref (page->loader);
-        page->loader = NULL;
+        g_object_unref (self->loader);
+        self->loader = NULL;
     }
-    page->md_ready = FALSE;
-    g_clear_object (&page->md);
+    self->md_ready = FALSE;
+    g_clear_object (&self->md);
 }
 
 static void
@@ -308,15 +256,15 @@ file_close_callback (GObject      *object,
                      GAsyncResult *res,
                      gpointer      data)
 {
-    NautilusImagesPropertiesPage *page;
+    NautilusImagesPropertiesModel *self;
     GInputStream *stream;
 
-    page = data;
+    self = data;
     stream = G_INPUT_STREAM (object);
 
     g_input_stream_close_finish (stream, res, NULL);
 
-    g_clear_object (&page->cancellable);
+    g_clear_object (&self->cancellable);
 }
 
 static void
@@ -324,41 +272,41 @@ file_read_callback (GObject      *object,
                     GAsyncResult *res,
                     gpointer      data)
 {
-    NautilusImagesPropertiesPage *page;
+    NautilusImagesPropertiesModel *self;
     GInputStream *stream;
     g_autoptr (GError) error = NULL;
     gssize count_read;
     gboolean done_reading;
 
-    page = data;
+    self = data;
     stream = G_INPUT_STREAM (object);
     count_read = g_input_stream_read_finish (stream, res, &error);
     done_reading = FALSE;
 
     if (count_read > 0)
     {
-        g_assert (count_read <= sizeof (page->buffer));
+        g_assert (count_read <= sizeof (self->buffer));
 
-        if (page->pixbuf_still_loading)
+        if (self->pixbuf_still_loading)
         {
-            if (!gdk_pixbuf_loader_write (page->loader,
-                                          page->buffer,
+            if (!gdk_pixbuf_loader_write (self->loader,
+                                          self->buffer,
                                           count_read,
                                           NULL))
             {
-                page->pixbuf_still_loading = FALSE;
+                self->pixbuf_still_loading = FALSE;
             }
         }
 
-        if (page->pixbuf_still_loading)
+        if (self->pixbuf_still_loading)
         {
             g_input_stream_read_async (G_INPUT_STREAM (stream),
-                                       page->buffer,
-                                       sizeof (page->buffer),
+                                       self->buffer,
+                                       sizeof (self->buffer),
                                        G_PRIORITY_DEFAULT,
-                                       page->cancellable,
+                                       self->cancellable,
                                        file_read_callback,
-                                       page);
+                                       self);
         }
         else
         {
@@ -382,12 +330,12 @@ file_read_callback (GObject      *object,
 
     if (done_reading)
     {
-        load_finished (page);
+        load_finished (self);
         g_input_stream_close_async (stream,
                                     G_PRIORITY_DEFAULT,
-                                    page->cancellable,
+                                    self->cancellable,
                                     file_close_callback,
-                                    page);
+                                    self);
     }
 }
 
@@ -397,19 +345,19 @@ size_prepared_callback (GdkPixbufLoader *loader,
                         int              height,
                         gpointer         callback_data)
 {
-    NautilusImagesPropertiesPage *page;
+    NautilusImagesPropertiesModel *self;
 
-    page = callback_data;
+    self = callback_data;
 
-    page->height = height;
-    page->width = width;
-    page->got_size = TRUE;
-    page->pixbuf_still_loading = FALSE;
+    self->height = height;
+    self->width = width;
+    self->got_size = TRUE;
+    self->pixbuf_still_loading = FALSE;
 }
 
 typedef struct
 {
-    NautilusImagesPropertiesPage *page;
+    NautilusImagesPropertiesModel *self;
     NautilusFileInfo *file_info;
 } FileOpenData;
 
@@ -419,14 +367,14 @@ file_open_callback (GObject      *object,
                     gpointer      user_data)
 {
     g_autofree FileOpenData *data = NULL;
-    NautilusImagesPropertiesPage *page;
+    NautilusImagesPropertiesModel *self;
     GFile *file;
     g_autofree char *uri = NULL;
     g_autoptr (GError) error = NULL;
     g_autoptr (GFileInputStream) stream = NULL;
 
     data = user_data;
-    page = data->page;
+    self = data->self;
     file = G_FILE (object);
     uri = g_file_get_uri (file);
     stream = g_file_read_finish (file, res, &error);
@@ -436,38 +384,38 @@ file_open_callback (GObject      *object,
 
         mime_type = nautilus_file_info_get_mime_type (data->file_info);
 
-        page->loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, &error);
+        self->loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, &error);
         if (error != NULL)
         {
             g_warning ("Error creating loader for %s: %s", uri, error->message);
         }
-        page->pixbuf_still_loading = TRUE;
-        page->width = 0;
-        page->height = 0;
+        self->pixbuf_still_loading = TRUE;
+        self->width = 0;
+        self->height = 0;
 
-        g_signal_connect (page->loader,
+        g_signal_connect (self->loader,
                           "size-prepared",
                           G_CALLBACK (size_prepared_callback),
-                          page);
+                          self);
 
         g_input_stream_read_async (G_INPUT_STREAM (stream),
-                                   page->buffer,
-                                   sizeof (page->buffer),
+                                   self->buffer,
+                                   sizeof (self->buffer),
                                    G_PRIORITY_DEFAULT,
-                                   page->cancellable,
+                                   self->cancellable,
                                    file_read_callback,
-                                   page);
+                                   self);
     }
     else
     {
         g_warning ("Error reading %s: %s", uri, error->message);
-        load_finished (page);
+        load_finished (self);
     }
 }
 
 static void
-nautilus_image_properties_page_load_from_file_info (NautilusImagesPropertiesPage *self,
-                                                    NautilusFileInfo             *file_info)
+nautilus_image_properties_model_load_from_file_info (NautilusImagesPropertiesModel *self,
+                                                     NautilusFileInfo              *file_info)
 {
     g_autofree char *uri = NULL;
     g_autoptr (GFile) file = NULL;
@@ -509,7 +457,7 @@ nautilus_image_properties_page_load_from_file_info (NautilusImagesPropertiesPage
 
     data = g_new0 (FileOpenData, 1);
 
-    data->page = self;
+    data->self = self;
     data->file_info = file_info;
 
     g_file_read_async (file,
@@ -519,20 +467,21 @@ nautilus_image_properties_page_load_from_file_info (NautilusImagesPropertiesPage
                        data);
 }
 
-GtkWidget *
-nautilus_image_properties_page_new (NautilusFileInfo *file_info)
+NautilusPropertiesModel *
+nautilus_image_properties_model_new (NautilusFileInfo *file_info)
 {
-    NautilusImagesPropertiesPage *self;
+    NautilusImagesPropertiesModel *self;
 
-    self = g_new0 (NautilusImagesPropertiesPage, 1);
+    self = g_new0 (NautilusImagesPropertiesModel, 1);
 
-    nautilus_image_properties_page_init (self);
-    nautilus_image_properties_page_load_from_file_info (self, file_info);
+    nautilus_image_properties_model_init (self);
+    nautilus_image_properties_model_load_from_file_info (self, file_info);
 
-    g_object_set_data_full (G_OBJECT (self->page_widget),
-                            "nautilus-images-properties-page",
+    g_object_set_data_full (G_OBJECT (self->group_model),
+                            "nautilus-images-properties-model",
                             self,
-                            (GDestroyNotify) nautilus_images_properties_page_free);
+                            (GDestroyNotify) nautilus_images_properties_model_free);
 
-    return self->page_widget;
+    return nautilus_properties_model_new (_("Image Properties"),
+                                          G_LIST_MODEL (self->group_model));
 }
diff --git a/extensions/image-properties/nautilus-image-properties-page.h 
b/extensions/image-properties/nautilus-image-properties-model.h
similarity index 89%
rename from extensions/image-properties/nautilus-image-properties-page.h
rename to extensions/image-properties/nautilus-image-properties-model.h
index 00b131c88..37ce1bd88 100644
--- a/extensions/image-properties/nautilus-image-properties-page.h
+++ b/extensions/image-properties/nautilus-image-properties-model.h
@@ -22,4 +22,4 @@
 
 #include <nautilus-extension.h>
 
-GtkWidget *nautilus_image_properties_page_new (NautilusFileInfo *file_info);
+NautilusPropertiesModel * nautilus_image_properties_model_new (NautilusFileInfo *file_info);
diff --git a/extensions/image-properties/nautilus-image-properties-module.c 
b/extensions/image-properties/nautilus-image-properties-module.c
index 0ce02e973..1c0f15e23 100644
--- a/extensions/image-properties/nautilus-image-properties-module.c
+++ b/extensions/image-properties/nautilus-image-properties-module.c
@@ -18,7 +18,7 @@
 
 #include <config.h>
 
-#include "nautilus-image-properties-page-provider.h"
+#include "nautilus-image-properties-model-provider.h"
 
 #include <glib/gi18n-lib.h>
 
@@ -30,7 +30,7 @@ nautilus_module_initialize (GTypeModule *module)
     bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
     bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
-    nautilus_image_properties_page_provider_load (module);
+    nautilus_image_properties_model_provider_load (module);
 }
 
 void
@@ -47,7 +47,7 @@ nautilus_module_list_types (const GType **types,
     g_assert (types != NULL);
     g_assert (num_types != NULL);
 
-    type_list[0] = NAUTILUS_TYPE_IMAGE_PROPERTIES_PAGE_PROVIDER;
+    type_list[0] = NAUTILUS_TYPE_IMAGE_PROPERTIES_MODEL_PROVIDER;
 
     *types = type_list;
     *num_types = G_N_ELEMENTS (type_list);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index eb0f8f29d..261acf13e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,8 +10,8 @@ extensions/audio-video-properties/bacon-video-widget-properties.c
 extensions/audio-video-properties/totem-properties-main.c
 extensions/audio-video-properties/totem-properties-view.c
 extensions/audio-video-properties/resources/ui/properties.ui
-extensions/image-properties/nautilus-image-properties-page.c
-extensions/image-properties/nautilus-image-properties-page-provider.c
+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


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