[epiphany] Add ephy_node_view_add_column_full



commit 965244584bfdf414137224d3728a578c472d3335
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Dec 11 18:40:03 2014 +0100

    Add ephy_node_view_add_column_full
    
    Allow creating an EphyNodeView column that derives its values from a
    property, but is modified by a function for display.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710004

 lib/widgets/ephy-node-view.c |   52 +++++++++++++++++++++++++++++++++---------
 lib/widgets/ephy-node-view.h |   10 ++++++++
 2 files changed, 51 insertions(+), 11 deletions(-)
---
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index c45240d..8ab9129 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -1269,12 +1269,14 @@ ephy_node_view_add_data_column (EphyNodeView *view,
 }
 
 /**
- * ephy_node_view_add_column:
+ * ephy_node_view_add_column_full:
  * @view: an #EphyNodeView
  * @title: title for the column
  * @value_type: type to be held by the column
  * @prop_id: numeric id corresponding to the column in the model to be shown
  * @flags: flags for the new column
+ * @func: optional function to modify the view of properties in the column
+ * @user_data: optional data passed to @func
  * @icon_func: a function providing the icon for the column
  * @ret: location to store the created column
  *
@@ -1283,22 +1285,23 @@ ephy_node_view_add_data_column (EphyNodeView *view,
  * Returns: the id of the new column
  **/
 int
-ephy_node_view_add_column (EphyNodeView *view,
-                          const char  *title,
-                          GType value_type,
-                          guint prop_id,
-                          EphyNodeViewFlags flags,
-                          EphyTreeModelNodeValueFunc icon_func,
-                          GtkTreeViewColumn **ret)
-
+ephy_node_view_add_column_full (EphyNodeView *view,
+                               const char  *title,
+                               GType value_type,
+                               guint prop_id,
+                               EphyNodeViewFlags flags,
+                               EphyTreeModelNodeValueFunc func,
+                               gpointer user_data,
+                               EphyTreeModelNodeValueFunc icon_func,
+                               GtkTreeViewColumn **ret)
 {
        GtkTreeViewColumn *gcolumn;
        GtkCellRenderer *renderer;
        int column;
        int icon_column;
 
-       column = ephy_tree_model_node_add_prop_column
-               (view->priv->nodemodel, value_type, prop_id);
+       column = ephy_tree_model_node_add_column_full
+               (view->priv->nodemodel, value_type, prop_id, func, user_data);
 
        gcolumn = (GtkTreeViewColumn *) gtk_tree_view_column_new ();
 
@@ -1382,6 +1385,33 @@ ephy_node_view_add_column (EphyNodeView *view,
 }
 
 /**
+ * ephy_node_view_add_column:
+ * @view: an #EphyNodeView
+ * @title: title for the column
+ * @value_type: type to be held by the column
+ * @prop_id: numeric id corresponding to the column in the model to be shown
+ * @flags: flags for the new column
+ * @icon_func: a function providing the icon for the column
+ * @ret: location to store the created column
+ *
+ * Adds a new column, corresponding to a @prop_id of the model, to the @view.
+ *
+ * Returns: the id of the new column
+ **/
+int
+ephy_node_view_add_column (EphyNodeView *view,
+                          const char  *title,
+                          GType value_type,
+                          guint prop_id,
+                          EphyNodeViewFlags flags,
+                          EphyTreeModelNodeValueFunc icon_func,
+                          GtkTreeViewColumn **ret)
+{
+       return ephy_node_view_add_column_full (view, title, value_type, prop_id,
+                                              flags, NULL, NULL, icon_func, ret);
+}
+
+/**
  * ephy_node_view_set_priority:
  * @view: an #EphyNodeView
  * @priority_prop_id: one of #EphyNodeViewPriority
diff --git a/lib/widgets/ephy-node-view.h b/lib/widgets/ephy-node-view.h
index 4232925..10da15c 100644
--- a/lib/widgets/ephy-node-view.h
+++ b/lib/widgets/ephy-node-view.h
@@ -82,6 +82,16 @@ void    ephy_node_view_add_toggle          (EphyNodeView *view,
                                               EphyTreeModelNodeValueFunc value_func,
                                               gpointer data);
 
+int       ephy_node_view_add_column_full     (EphyNodeView *view,
+                                              const char *title,
+                                              GType value_type,
+                                              guint prop_id,
+                                              EphyNodeViewFlags flags,
+                                              EphyTreeModelNodeValueFunc func,
+                                              gpointer user_data,
+                                              EphyTreeModelNodeValueFunc icon_func,
+                                              GtkTreeViewColumn **ret);
+
 int       ephy_node_view_add_column          (EphyNodeView *view,
                                               const char  *title,
                                               GType value_type,


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