[gnome-notes/136-implement-the-list-row-pattern-in-main-view: 16/17] controller: improve notebook info for list view
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes/136-implement-the-list-row-pattern-in-main-view: 16/17] controller: improve notebook info for list view
- Date: Thu, 9 Jul 2020 18:05:23 +0000 (UTC)
commit 69a21b5fe17b91eb4caaaade4e397ad3db698ff0
Author: Isaque Galdino <igaldino gmail com>
Date: Tue Jun 16 19:57:46 2020 -0300
controller: improve notebook info for list view
src/bjb-controller.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/bjb-controller.c b/src/bjb-controller.c
index c0f9b94..1978a18 100644
--- a/src/bjb-controller.c
+++ b/src/bjb-controller.c
@@ -23,6 +23,7 @@
* it controls the window behaviour.
*/
+#include "bjb-application.h"
#include "bjb-controller.h"
#include "bjb-main-view.h"
#include "bjb-window-base.h"
@@ -47,6 +48,7 @@ struct _BjbController
GtkTreeModel *model;
BjbWindowBase *window;
+ BjbSettings *settings;
GList *items_to_show;
gint n_items_to_show;
@@ -234,7 +236,8 @@ bjb_controller_add_item (BjbController *self,
GtkTreeIter iter;
GtkListStore *store;
GdkRGBA note_color;
- g_autofree char *color = NULL;
+ const char *text = _("Notebook");
+ g_autofree char *color = NULL;
g_return_if_fail (BIJI_IS_ITEM (item));
store = GTK_LIST_STORE (self->model);
@@ -254,14 +257,21 @@ bjb_controller_add_item (BjbController *self,
else
gtk_list_store_append (store, &iter);
- if (biji_note_obj_get_rgba (BIJI_NOTE_OBJ (item), ¬e_color))
- color = gdk_rgba_to_string (¬e_color);
+ if (BIJI_IS_NOTE_OBJ (item))
+ {
+ text = biji_note_obj_get_raw_text (BIJI_NOTE_OBJ (item));
+ if (biji_note_obj_get_rgba (BIJI_NOTE_OBJ (item), ¬e_color))
+ color = gdk_rgba_to_string (¬e_color);
+ }
+
+ if (!color)
+ color = g_strdup (bjb_settings_get_default_color (self->settings));
gtk_list_store_set (store,
&iter,
BJB_MODEL_COLUMN_UUID, biji_item_get_uuid (item),
BJB_MODEL_COLUMN_TITLE, biji_item_get_title (item),
- BJB_MODEL_COLUMN_TEXT, biji_note_obj_get_raw_text (BIJI_NOTE_OBJ (item)),
+ BJB_MODEL_COLUMN_TEXT, text,
BJB_MODEL_COLUMN_MTIME, biji_item_get_mtime (item),
BJB_MODEL_COLUMN_COLOR, color,
-1);
@@ -660,9 +670,12 @@ bjb_controller_disconnect (BjbController *self)
static void
bjb_controller_constructed (GObject *obj)
{
+ BjbController *self = BJB_CONTROLLER (obj);
G_OBJECT_CLASS(bjb_controller_parent_class)->constructed(obj);
- bjb_controller_connect (BJB_CONTROLLER (obj));
+ self->settings = bjb_app_get_settings (g_application_get_default ());
+
+ bjb_controller_connect (self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]