[gnome-notes/wip/igaldino/new-note-title: 9/12] main-toolbar: Update note title



commit ebc953505bfc92218032870c5ef4aa43da56b8ae
Author: Isaque Galdino <igaldino gmail com>
Date:   Sun Jun 9 21:56:40 2019 -0300

    main-toolbar: Update note title

 data/resources/main-toolbar.ui | 1 +
 src/bjb-main-toolbar.c         | 9 +++++++++
 src/libbiji/biji-note-obj.c    | 1 +
 3 files changed, 11 insertions(+)
---
diff --git a/data/resources/main-toolbar.ui b/data/resources/main-toolbar.ui
index 811ba6b..eea8d52 100644
--- a/data/resources/main-toolbar.ui
+++ b/data/resources/main-toolbar.ui
@@ -436,6 +436,7 @@
     <property name="visible">True</property>
     <property name="can_focus">True</property>
     <property name="max-width-chars">60</property>
+    <signal name="changed" handler="on_title_changed" swapped="yes"/>
   </object>
 
 </interface>
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 2bb281d..d89475d 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -435,6 +435,13 @@ on_last_updated_cb (BijiItem       *note,
   gtk_label_set_text (GTK_LABEL (self->last_update_item), label);
 }
 
+static void
+on_title_changed (BjbMainToolbar *self,
+                  GtkEntry       *title)
+{
+  biji_note_obj_set_title (self->note, gtk_entry_get_text (title));
+}
+
 static void
 populate_bar_for_note_view (BjbMainToolbar *self)
 {
@@ -811,6 +818,8 @@ bjb_main_toolbar_class_init (BjbMainToolbarClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, on_view_mode_clicked);
   gtk_widget_class_bind_template_callback (widget_class, on_empty_clicked_callback);
   gtk_widget_class_bind_template_callback (widget_class, on_color_button_clicked);
+
+  gtk_widget_class_bind_template_callback (widget_class, on_title_changed);
 }
 
 BjbMainToolbar *
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index 3db50d1..79baaa7 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -336,6 +336,7 @@ biji_note_obj_set_title (BijiNoteObj *note, const gchar *proposed_title)
 
   /* Emit signal even if initial title, just to let know */
   biji_note_id_set_title (priv->id, title);
+  biji_note_obj_save_note (note);
   g_signal_emit (G_OBJECT (note), biji_obj_signals[NOTE_RENAMED], 0);
   retval = TRUE;
 


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