[gnome-notes/136-implement-the-list-row-pattern-in-main-view] gd-main-column: Remove references to them



commit 676659a2b7a06d7bbe9cfb3ae150e35ff0dda3d9
Author: Isaque Galdino <igaldino gmail com>
Date:   Thu Jan 23 23:27:52 2020 -0300

    gd-main-column: Remove references to them

 src/bjb-controller.c | 40 +++++++++++++++++++---------------------
 src/bjb-controller.h | 13 ++++++++++++-
 src/bjb-main-view.c  |  4 ++--
 3 files changed, 33 insertions(+), 24 deletions(-)
---
diff --git a/src/bjb-controller.c b/src/bjb-controller.c
index 7aca0d2..b607470 100644
--- a/src/bjb-controller.c
+++ b/src/bjb-controller.c
@@ -23,13 +23,10 @@
  * it controls the window behaviour.
  */
 
-#include <libgd/gd.h>
-
 #include "bjb-controller.h"
 #include "bjb-main-view.h"
 #include "bjb-window-base.h"
 
-
 /*
  * The start-up number of items to show,
  * and its incrementation
@@ -91,15 +88,15 @@ bjb_controller_init (BjbController *self)
   GtkListStore *store;
 
   /* Create the columns */
-  store = gtk_list_store_new (GD_MAIN_COLUMN_LAST,
-                              G_TYPE_STRING,      // urn
-                              G_TYPE_STRING,      // uri
-                              G_TYPE_STRING,      // name
-                              G_TYPE_STRING,      // author
-                              CAIRO_GOBJECT_TYPE_SURFACE, // icon then note
-                              G_TYPE_INT64,       // mtime
-                              G_TYPE_BOOLEAN,     // state
-                              G_TYPE_UINT);       // pulse
+  store = gtk_list_store_new (BJB_MODEL_COLUMN_LAST,
+                              G_TYPE_STRING,              // urn / id
+                              G_TYPE_STRING,              // uri
+                              G_TYPE_STRING,              // name / primary text
+                              G_TYPE_STRING,              // author / seconday text / null
+                              CAIRO_GOBJECT_TYPE_SURFACE, // icon
+                              G_TYPE_INT64,               // mtime
+                              G_TYPE_BOOLEAN,             // state / selected
+                              G_TYPE_UINT);               // pulse ?
 
   self->model = GTK_TREE_MODEL (store);
   self->n_items_to_show = BJB_ITEMS_SLICE;
@@ -203,7 +200,7 @@ bjb_controller_get_iter (BjbController *self,
   while (try)
   {
     gchar *item_path;
-    gtk_tree_model_get (self->model, *iter, GD_MAIN_COLUMN_URI, &item_path, -1);
+    gtk_tree_model_get (self->model, *iter, BJB_MODEL_COLUMN_URI, &item_path, -1);
 
     /* If we look for the item, check by uid */
     if (needle && g_strcmp0 (item_path, needle) == 0)
@@ -267,14 +264,15 @@ bjb_controller_add_item (BjbController *self,
    * currently use the same model */
   uuid = biji_item_get_uuid (item);
 
-  gtk_list_store_set (store, &iter,
-       GD_MAIN_COLUMN_ID, uuid,
-       GD_MAIN_COLUMN_URI, uuid,
-       GD_MAIN_COLUMN_PRIMARY_TEXT, biji_item_get_title (item),
-       GD_MAIN_COLUMN_SECONDARY_TEXT, NULL,
-       GD_MAIN_COLUMN_ICON, surface,
-       GD_MAIN_COLUMN_MTIME, biji_item_get_mtime (item),
-       -1);
+  gtk_list_store_set (store,
+                      &iter,
+                      BJB_MODEL_COLUMN_ID,             uuid,
+                      BJB_MODEL_COLUMN_URI,            uuid,
+                      BJB_MODEL_COLUMN_PRIMARY_TEXT,   biji_item_get_title (item),
+                      BJB_MODEL_COLUMN_SECONDARY_TEXT, NULL,
+                      BJB_MODEL_COLUMN_ICON,           surface,
+                      BJB_MODEL_COLUMN_MTIME,          biji_item_get_mtime (item),
+                      -1);
 
 }
 
diff --git a/src/bjb-controller.h b/src/bjb-controller.h
index fa46aa6..4cd1511 100644
--- a/src/bjb-controller.h
+++ b/src/bjb-controller.h
@@ -21,7 +21,6 @@
 
 #include <glib-object.h>
 #include <libbiji/libbiji.h>
-#include <libgd/gd-main-view.h>
 
 G_BEGIN_DECLS
 
@@ -29,6 +28,18 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (BjbController, bjb_controller, BJB, CONTROLLER, GObject)
 
+typedef enum {
+  BJB_MODEL_COLUMN_ID,
+  BJB_MODEL_COLUMN_URI,
+  BJB_MODEL_COLUMN_PRIMARY_TEXT,
+  BJB_MODEL_COLUMN_SECONDARY_TEXT,
+  BJB_MODEL_COLUMN_ICON,
+  BJB_MODEL_COLUMN_MTIME,
+  BJB_MODEL_COLUMN_SELECTED,
+  BJB_MODEL_COLUMN_PULSE,
+  BJB_MODEL_COLUMN_LAST
+} BjbModelColumnsType;
+
 BjbController * bjb_controller_new (BijiManager  *manager,
                                     GtkWindow     *bjb_window_base,
                                     gchar         *needle);
diff --git a/src/bjb-main-view.c b/src/bjb-main-view.c
index 01e8514..08dcdc5 100644
--- a/src/bjb-main-view.c
+++ b/src/bjb-main-view.c
@@ -246,7 +246,7 @@ get_note_url_from_tree_path(GtkTreePath *path,
 
   model = bjb_controller_get_model (self->controller);
   gtk_tree_model_get_iter (model, &iter, path);
-  gtk_tree_model_get (model, &iter, GD_MAIN_COLUMN_URI, &note_path, -1);
+  gtk_tree_model_get (model, &iter, BJB_MODEL_COLUMN_URI, &note_path, -1);
 
   return note_path;
 }
@@ -341,7 +341,7 @@ on_item_activated (GdMainView        *gd,
   /* Get Item Path */
   model = gd_main_view_get_model (gd);
   gtk_tree_model_get_iter (model, &iter, (GtkTreePath *) path);
-  gtk_tree_model_get (model, &iter, GD_MAIN_COLUMN_URI, &item_path,-1);
+  gtk_tree_model_get (model, &iter, BJB_MODEL_COLUMN_URI, &item_path,-1);
 
   g_return_val_if_fail (item_path != NULL, FALSE); // #709197
 


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