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



commit eb5c2bcd31142ce0a3f0c6779c57d578b87a78db
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 +++++++++
 2 files changed, 10 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 89958b4..fa99a42 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -434,6 +434,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)
 {
@@ -810,6 +817,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 *


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