[gnome-notes/wip/igaldino/new-note-title: 4/9] main-toolbar: Added title entry



commit c8eb3c9a82cb9f9d309e4f854809b34f34085807
Author: Isaque Galdino <igaldino gmail com>
Date:   Wed May 8 10:10:29 2019 -0300

    main-toolbar: Added title entry

 data/resources/main-toolbar.ui | 6 ++++++
 src/bjb-main-toolbar.c         | 7 +++++++
 2 files changed, 13 insertions(+)
---
diff --git a/data/resources/main-toolbar.ui b/data/resources/main-toolbar.ui
index 80b7a90..c6740e2 100644
--- a/data/resources/main-toolbar.ui
+++ b/data/resources/main-toolbar.ui
@@ -432,4 +432,10 @@
     </child>
   </object>
 
+  <object class="GtkEntry" id="title_entry">
+    <property name="visible">True</property>
+    <property name="max-width-chars">60</property>
+  </object>
+
 </interface>
+
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 7836a81..04ef2f8 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -57,6 +57,7 @@ struct _BjbMainToolbar
   /* Main View */
   GtkWidget *new_button;
   GtkWidget *back_button;
+  GtkWidget *title_entry;
   GtkWidget *list_button;
   GtkWidget *grid_button;
   GtkWidget *select_button;
@@ -390,6 +391,8 @@ on_note_renamed (BijiItem *note,
 
   gtk_header_bar_set_title (GTK_HEADER_BAR (self), str);
   gtk_header_bar_set_subtitle (GTK_HEADER_BAR (self), NULL);
+
+  gtk_entry_set_text (GTK_ENTRY (self->title_entry), str);
 }
 
 static void
@@ -446,6 +449,8 @@ populate_bar_for_note_view (BjbMainToolbar *self)
 
   settings = bjb_app_get_settings (g_application_get_default());
 
+  gtk_header_bar_set_custom_title (GTK_HEADER_BAR (self), self->title_entry);
+
   gtk_widget_hide (self->new_button);
   gtk_widget_hide (self->style_buttons);
   gtk_widget_hide (self->search_button);
@@ -494,6 +499,7 @@ populate_bar_for_note_view (BjbMainToolbar *self)
 static void
 bjb_main_toolbar_reset (BjbMainToolbar *self)
 {
+  gtk_header_bar_set_custom_title (GTK_HEADER_BAR (self), NULL);
   gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self), TRUE);
 
   gtk_widget_show (self->button_stack);
@@ -779,6 +785,7 @@ bjb_main_toolbar_class_init (BjbMainToolbarClass *klass)
   gtk_widget_class_bind_template_child (widget_class, BjbMainToolbar, button_stack);
   gtk_widget_class_bind_template_child (widget_class, BjbMainToolbar, new_button);
   gtk_widget_class_bind_template_child (widget_class, BjbMainToolbar, back_button);
+  gtk_widget_class_bind_template_child (widget_class, BjbMainToolbar, title_entry);
   gtk_widget_class_bind_template_child (widget_class, BjbMainToolbar, list_button);
   gtk_widget_class_bind_template_child (widget_class, BjbMainToolbar, grid_button);
   gtk_widget_class_bind_template_child (widget_class, BjbMainToolbar, search_button);


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