[gtk/prop-list: 2/8] column view: Add some helpers



commit aca820c069c7aa752a5b097b186c1a01d384f455
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Dec 4 10:02:44 2019 -0500

    column view: Add some helpers
    
    These functions will be used in updating sort indicators
    in column headers.

 gtk/gtkcolumnview.c              | 12 ++++++++++++
 gtk/gtkcolumnviewcolumn.c        |  6 ++++++
 gtk/gtkcolumnviewcolumnprivate.h |  1 +
 gtk/gtkcolumnviewprivate.h       |  1 +
 4 files changed, 20 insertions(+)
---
diff --git a/gtk/gtkcolumnview.c b/gtk/gtkcolumnview.c
index d6170dfc46..59b304e053 100644
--- a/gtk/gtkcolumnview.c
+++ b/gtk/gtkcolumnview.c
@@ -681,3 +681,15 @@ gtk_column_view_get_header_widget (GtkColumnView *self)
   return GTK_LIST_ITEM_WIDGET (self->header);
 }
 
+void
+gtk_column_view_active_sorter_changed (GtkColumnView *self)
+{
+  guint i;
+
+  for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->columns)); i++)
+    {
+      GtkColumnViewColumn *column = g_list_model_get_item (G_LIST_MODEL (self->columns), i);
+      gtk_column_view_column_active_sorter_changed (column);
+      g_object_unref (column);
+    }
+}
diff --git a/gtk/gtkcolumnviewcolumn.c b/gtk/gtkcolumnviewcolumn.c
index 0898c54548..283f1f6082 100644
--- a/gtk/gtkcolumnviewcolumn.c
+++ b/gtk/gtkcolumnviewcolumn.c
@@ -552,3 +552,9 @@ gtk_column_view_column_get_title (GtkColumnViewColumn *self)
   return self->title;
 }
 
+void
+gtk_column_view_column_active_sorter_changed (GtkColumnViewColumn *self)
+{
+  if (self->header)
+    gtk_column_view_title_update (GTK_COLUMN_VIEW_TITLE (self->header));
+}
diff --git a/gtk/gtkcolumnviewcolumnprivate.h b/gtk/gtkcolumnviewcolumnprivate.h
index d7e06a5b0f..3df2958c07 100644
--- a/gtk/gtkcolumnviewcolumnprivate.h
+++ b/gtk/gtkcolumnviewcolumnprivate.h
@@ -43,5 +43,6 @@ void                    gtk_column_view_column_allocate                 (GtkColu
 void                    gtk_column_view_column_get_allocation           (GtkColumnViewColumn    *self,
                                                                          int                    *offset,
                                                                          int                    *size);
+void                    gtk_column_view_column_active_sorter_changed    (GtkColumnViewColumn    *self);
 
 #endif  /* __GTK_COLUMN_VIEW_COLUMN_PRIVATE_H__ */
diff --git a/gtk/gtkcolumnviewprivate.h b/gtk/gtkcolumnviewprivate.h
index c356fae508..ee4a7675ba 100644
--- a/gtk/gtkcolumnviewprivate.h
+++ b/gtk/gtkcolumnviewprivate.h
@@ -29,5 +29,6 @@ GtkListItemWidget *     gtk_column_view_get_header_widget       (GtkColumnView
 void                    gtk_column_view_measure_across          (GtkColumnView          *self,
                                                                  int                    *minimum,
                                                                  int                    *natural);
+void                    gtk_column_view_active_sorter_changed   (GtkColumnView          *self);
 
 #endif  /* __GTK_COLUMN_VIEW_PRIVATE_H__ */


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