[nautilus/wip/antoniof/extension-properties: 11/12] column: Don't depend on GTK




commit c60d3099edca0558601c50c32f7307a26dda2532
Author: António Fernandes <antoniof gnome org>
Date:   Sat Aug 6 17:22:13 2022 +0100

    column: Don't depend on GTK
    
    We use GtkSortOrder internally only, it's not meant for extensions.

 libnautilus-extension/nautilus-column.c | 22 ++++++++++++++--------
 libnautilus-extension/nautilus-column.h |  1 -
 2 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/libnautilus-extension/nautilus-column.c b/libnautilus-extension/nautilus-column.c
index 38a78141e..e39cbf6fb 100644
--- a/libnautilus-extension/nautilus-column.c
+++ b/libnautilus-extension/nautilus-column.c
@@ -21,7 +21,6 @@
  *
  */
 
-#include <gtk/gtk.h>
 #include "nautilus-column.h"
 
 enum
@@ -46,7 +45,7 @@ struct _NautilusColumn
     char *label;
     char *description;
     float xalign;
-    GtkSortType default_sort_order;
+    int default_sort_order; /* Actually, meant to store GtkSortType */
 };
 
 G_DEFINE_TYPE (NautilusColumn, nautilus_column, G_TYPE_OBJECT);
@@ -274,12 +273,19 @@ nautilus_column_class_init (NautilusColumnClass *class)
                                                          1.0,
                                                          0.0,
                                                          G_PARAM_READWRITE));
+    /**
+     * NautilusColumn:default-sort-order: (type gboolean)
+     *
+     * Actually meant to store the enum values of GtkSortType, but we don't want
+     * extensions to depend on GTK. Also, this is for internal consumption only.
+     *
+     * Stability: Private: Internal to the application.
+     */
     g_object_class_install_property (G_OBJECT_CLASS (class),
                                      PROP_DEFAULT_SORT_ORDER,
-                                     g_param_spec_enum ("default-sort-order",
-                                                        "Default sort order",
-                                                        "Default sort order",
-                                                        GTK_TYPE_SORT_TYPE,
-                                                        GTK_SORT_ASCENDING,
-                                                        G_PARAM_READWRITE));
+                                     g_param_spec_int ("default-sort-order",
+                                                       "Default sort order",
+                                                       "Default sort order",
+                                                       G_MININT, G_MAXINT, 0,
+                                                       G_PARAM_READWRITE));
 }
diff --git a/libnautilus-extension/nautilus-column.h b/libnautilus-extension/nautilus-column.h
index dfaa8c0be..8f82bf23e 100644
--- a/libnautilus-extension/nautilus-column.h
+++ b/libnautilus-extension/nautilus-column.h
@@ -68,7 +68,6 @@ NautilusColumn *nautilus_column_new  (const char *name,
  *   label (string)       - the user-visible label for the column
  *   description (string) - a user-visible description of the column
  *   xalign (float)       - x-alignment of the column 
- *   default-sort-order (GtkSortType) - default sort order of the column
  */
 
 G_END_DECLS


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