[gnote] Derive Search window from Gtk::ApplicationWindow
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Derive Search window from Gtk::ApplicationWindow
- Date: Thu, 19 Apr 2012 20:45:38 +0000 (UTC)
commit 36f3bc748bce5e3279e8c1c648f959ffd36460c6
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Tue Apr 17 00:01:48 2012 +0300
Derive Search window from Gtk::ApplicationWindow
* Turn ForcedPresentWindow into template with parametrised parent class
* Adjust NoteWindow accordingly
* If Gtkmm 3.4 is used, derive Search window from Gtk::ApplicationWindow,
otherwise use Gtk::Window.
src/notewindow.cpp | 6 +++---
src/notewindow.hpp | 4 ++--
src/recentchanges.cpp | 6 +++---
src/recentchanges.hpp | 14 ++++++++++++--
src/utils.hpp | 11 ++++++-----
5 files changed, 26 insertions(+), 15 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 8e06f4e..adc565b 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -52,7 +52,7 @@
namespace gnote {
NoteWindow::NoteWindow(Note & note)
- : ForcedPresentWindow(note.get_title())
+ : ForcedPresentWindow<Gtk::Window>(note.get_title())
, m_note(note)
, m_global_keys(NULL)
{
@@ -224,7 +224,7 @@ namespace gnote {
void NoteWindow::on_hide()
{
- utils::ForcedPresentWindow::on_hide();
+ utils::ForcedPresentWindow<Gtk::Window>::on_hide();
// Workaround Gtk bug, where adding or changing Widgets
// while the Window is hidden causes it to be reshown at
@@ -737,7 +737,7 @@ namespace gnote {
void NoteWindow::on_show()
{
- utils::ForcedPresentWindow::on_show();
+ utils::ForcedPresentWindow<Gtk::Window>::on_show();
// Make sure the cursor position is visible
m_editor->scroll_to (m_editor->get_buffer()->get_insert());
}
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 294e1b0..472b3a0 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011 Aurimas Cernius
+ * Copyright (C) 2011-2012 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -100,7 +100,7 @@ private:
class NoteWindow
- : public utils::ForcedPresentWindow
+ : public utils::ForcedPresentWindow<Gtk::Window>
{
public:
NoteWindow(Note &);
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index e96bc40..136ae11 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2011 Aurimas Cernius
+ * Copyright (C) 2010-2012 Aurimas Cernius
* Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
@@ -90,7 +90,7 @@ namespace gnote {
}
NoteRecentChanges::NoteRecentChanges(NoteManager& m)
- : utils::ForcedPresentWindow(_("Search All Notes"))
+ : NoteRecentChangesParent(_("Search All Notes"))
, m_manager(m)
, m_menubar(NULL)
, m_find_combo(Glib::RefPtr<Gtk::TreeModel>::cast_static(Gtk::ListStore::create(m_find_combo_columns)), true)
@@ -1248,7 +1248,7 @@ namespace gnote {
select_all_notes_notebook ();
m_find_combo.get_entry()->grab_focus ();
- utils::ForcedPresentWindow::on_show();
+ NoteRecentChangesParent::on_show();
}
diff --git a/src/recentchanges.hpp b/src/recentchanges.hpp
index 3a296df..d161de9 100644
--- a/src/recentchanges.hpp
+++ b/src/recentchanges.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2010-2011 Aurimas Cernius
+ * Copyright (C) 2010-2012 Aurimas Cernius
* Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
@@ -45,6 +45,10 @@
#include <gtkmm/treepath.h>
#include <gtkmm/treeview.h>
+#if HAVE_GTKMM_3_4
+ #include <gtkmm/applicationwindow.h>
+#endif
+
#include "note.hpp"
#include "tag.hpp"
#include "utils.hpp"
@@ -56,8 +60,14 @@ namespace gnote {
}
class NoteManager;
+#if HAVE_GTKMM_3_4
+ typedef utils::ForcedPresentWindow<Gtk::ApplicationWindow> NoteRecentChangesParent;
+#else
+ typedef utils::ForcedPresentWindow<Gtk::Window> NoteRecentChangesParent;
+#endif
+
class NoteRecentChanges
- : public utils::ForcedPresentWindow
+ : public NoteRecentChangesParent
{
public:
static NoteRecentChanges *get_instance();
diff --git a/src/utils.hpp b/src/utils.hpp
index 00e9c50..82094c6 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011 Aurimas Cernius
+ * Copyright (C) 2011-2012 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -206,19 +206,20 @@ namespace gnote {
guint m_timeout_id;
};
+ template<typename ParentT>
class ForcedPresentWindow
- : public Gtk::Window
+ : public ParentT
{
public:
ForcedPresentWindow(const Glib::ustring & title)
- : Gtk::Window()
+ : ParentT()
{
- set_title(title);
+ ParentT::set_title(title);
}
void present()
{
- ::tomboy_window_present_hardcore(gobj());
+ ::tomboy_window_present_hardcore(GTK_WINDOW(ParentT::gobj()));
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]