[gnote] Add support for embeddable toolbar in main window



commit 5d9fc7242717555a2f3bb1be7ae412e29069c39b
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun May 19 22:05:05 2013 +0300

    Add support for embeddable toolbar in main window

 src/Makefile.am          |    1 +
 src/mainwindowembeds.hpp |   32 ++++++++++++++++++++++++++++++++
 src/recentchanges.cpp    |   13 +++++++++++++
 3 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index d9750cf..0e807a9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -110,6 +110,7 @@ libgnote_la_SOURCES = \
        itagmanager.hpp itagmanager.cpp \
        importaddin.hpp importaddin.cpp \
        mainwindow.hpp mainwindow.cpp \
+       mainwindowembeds.hpp \
        noteaddin.hpp noteaddin.cpp \
        notebuffer.hpp notebuffer.cpp \
        noteeditor.hpp noteeditor.cpp \
diff --git a/src/mainwindowembeds.hpp b/src/mainwindowembeds.hpp
new file mode 100644
index 0000000..3e7bb06
--- /dev/null
+++ b/src/mainwindowembeds.hpp
@@ -0,0 +1,32 @@
+/*
+ * gnote
+ *
+ * Copyright (C) 2013 Aurimas Cernius
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include <gtkmm/widget.h>
+
+
+namespace gnote {
+
+class HasEmbeddableToolbar
+{
+public:
+  virtual Gtk::Widget *embeddable_toolbar() = 0;
+};
+
+}
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index c053050..c46c6f1 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -161,6 +161,7 @@ namespace gnote {
     box->attach(*left_box, 0, 0, 1, 1);
 
     m_embedded_toolbar.set_hexpand(true);
+    m_embedded_toolbar.set(0.5, 0.5, 0.0, 0.0);
     m_embedded_toolbar.show();
     box->attach(m_embedded_toolbar, 1, 0, 1, 1);
 
@@ -470,6 +471,8 @@ namespace gnote {
     }
     catch(std::bad_cast&) {
     }
+
+    m_embedded_toolbar.remove();
   }
 
   bool NoteRecentChanges::is_foreground(utils::EmbeddableWidget & widget)
@@ -586,6 +589,16 @@ namespace gnote {
       m_search_button.set_active(false);
       m_search_button.hide();
     }
+
+    try {
+      HasEmbeddableToolbar & toolbar_provider = dynamic_cast<HasEmbeddableToolbar&>(widget);
+      Gtk::Widget *tool_item = toolbar_provider.embeddable_toolbar();
+      if(tool_item) {
+        m_embedded_toolbar.add(*tool_item);
+      }
+    }
+    catch(std::bad_cast &) {
+    }
   }
 
   void NoteRecentChanges::on_show_window_menu(Gtk::Button *button)


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