[gnote] Show note title on header bar



commit e77388c28e2a9ee7e1a53bf93a0884faeb0c5d16
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Tue Apr 15 23:16:31 2014 +0300

    Show note title on header bar

 src/recentchanges.cpp |   12 ++++++++++--
 src/recentchanges.hpp |    4 +++-
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 5992d40..ca6dc3f 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -171,7 +171,7 @@ namespace gnote {
     right_box->show();
 
     m_header_bar.pack_start(*left_box);
-    m_header_bar.pack_start(m_embedded_toolbar);
+    m_header_bar.pack_end(m_embedded_toolbar);
     m_header_bar.pack_end(*right_box);
     m_header_bar.show();
   }
@@ -479,7 +479,9 @@ namespace gnote {
         m_header_bar.set_title(_("Gnote"));
       }
       else {
-        m_header_bar.set_title("");
+        m_header_bar.set_title(widget.get_name());
+        m_current_embedded_name_slot = widget.signal_name_changed
+          .connect(sigc::mem_fun(*this, &NoteRecentChanges::on_embedded_name_changed));
       }
     }
     catch(std::bad_cast&) {
@@ -506,6 +508,7 @@ namespace gnote {
       widget.background();
       m_embed_box.remove(wid);
 
+      m_current_embedded_name_slot.disconnect();
       m_current_embedded_actions_slot.disconnect();
       if(m_window_menu_embedded) {
         delete m_window_menu_embedded;
@@ -686,6 +689,11 @@ namespace gnote {
     return items;
   }
 
+  void NoteRecentChanges::on_embedded_name_changed(const std::string & name)
+  {
+    m_header_bar.set_title(name);
+  }
+
   void NoteRecentChanges::on_main_window_actions_changed(Gtk::Menu **menu)
   {
     if(*menu) {
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 641f019..da9772f 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2013 Aurimas Cernius
+ * Copyright (C) 2010-2014 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -87,6 +87,7 @@ private:
   Gtk::Menu *make_window_menu(Gtk::Button *button, const std::vector<Gtk::MenuItem*> & items);
   std::vector<Gtk::MenuItem*> & make_menu_items(std::vector<Gtk::MenuItem*> & items,
                                                 const std::vector<Glib::RefPtr<Gtk::Action> > & actions);
+  void on_embedded_name_changed(const std::string & name);
   void on_main_window_actions_changed(Gtk::Menu **menu);
   void on_settings_changed(const Glib::ustring & key);
   bool on_notes_widget_key_press(GdkEventKey*);
@@ -106,6 +107,7 @@ private:
   Gtk::SearchEntry    m_search_entry;
   std::list<EmbeddableWidget*> m_embedded_widgets;
   bool                m_mapped;
+  sigc::connection    m_current_embedded_name_slot;
   sigc::connection    m_current_embedded_actions_slot;
   utils::InterruptableTimeout *m_entry_changed_timeout;
   Gtk::Menu          *m_window_menu_embedded;


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