[gnote] Don't open the start note if it is an applet. (Closes #584583)
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Don't open the start note if it is an applet. (Closes #584583)
- Date: Thu, 4 Jun 2009 21:49:11 -0400 (EDT)
commit fd6d5052ffbc95370c9fe60d7bd063bfc083ec25
Author: Hubert Figuiere <hub figuiere net>
Date: Thu Jun 4 21:38:49 2009 -0400
Don't open the start note if it is an applet. (Closes #584583)
---
NEWS | 3 ++-
src/gnote.cpp | 15 ++++++++++++---
src/gnote.hpp | 1 +
src/notemanager.cpp | 11 ++++++++---
src/notemanager.hpp | 12 ++++++++++--
5 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/NEWS b/NEWS
index b68400d..390da09 100644
--- a/NEWS
+++ b/NEWS
@@ -8,9 +8,10 @@ Fixes:
* Remove libxml++. (Closes #579292) Possibly closes bug #579316.
* Some code cleanups.
- * Fix a race condition causing a crash (Closes #584183)
+ * Fix a race condition causing a crash. (Closes #584183)
* Add --{en,dis}able-applet to configure. (Closes #584158)
(Gilles Dartiguelongue)
+ * Don't open the start note if it is an applet. (Closes #584583)
Translations:
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 073d800..984343c 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -89,13 +89,14 @@ namespace gnote {
{
}
+ m_is_panel_applet = cmd_line.use_panel_applet();
m_icon_theme = Gtk::IconTheme::get_default();
m_icon_theme->append_search_path(DATADIR"/icons");
m_icon_theme->append_search_path(DATADIR"/gnote/icons");
std::string note_path = get_note_path(cmd_line.note_path());
- m_manager = new NoteManager(note_path);
+ m_manager = new NoteManager(note_path, sigc::mem_fun(*this, &Gnote::start_note_created));
m_keybinder = new XKeybinder();
// TODO
@@ -117,10 +118,9 @@ namespace gnote {
cmd_line.execute();
}
- if(cmd_line.use_panel_applet()) {
+ if(m_is_panel_applet) {
DBG_OUT("starting applet");
s_tray_icon_showing = true;
- m_is_panel_applet = true;
am["CloseWindowAction"]->set_visible(true);
am["QuitGNoteAction"]->set_visible(false);
@@ -142,6 +142,15 @@ namespace gnote {
return 0;
}
+
+ void Gnote::start_note_created(const Note::Ptr & start_note)
+ {
+ DBG_OUT("we will show the start note: %d", !is_panel_applet());
+ if(!is_panel_applet()) {
+ start_note->get_window()->show();
+ }
+ }
+
std::string Gnote::get_note_path(const std::string & override_path)
{
std::string note_path;
diff --git a/src/gnote.hpp b/src/gnote.hpp
index f0e4519..be81648 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -82,6 +82,7 @@ public:
m_tray = tray;
}
private:
+ void start_note_created(const Note::Ptr & start_note);
static std::string conf_dir();
std::string get_note_path(const std::string & override_path);
diff --git a/src/notemanager.cpp b/src/notemanager.cpp
index 315173c..3be1fbe 100644
--- a/src/notemanager.cpp
+++ b/src/notemanager.cpp
@@ -73,7 +73,9 @@ namespace gnote {
return (a->change_date() > b->change_date());
}
- NoteManager::NoteManager(const std::string & directory)
+ NoteManager::NoteManager(const std::string & directory,
+ const NoteChangedSlot & start_created)
+ : m_signal_start_note_created(start_created)
{
std::string backup = directory + "/Backup";
@@ -81,7 +83,10 @@ namespace gnote {
}
- NoteManager::NoteManager(const std::string & directory, const std::string & backup)
+ NoteManager::NoteManager(const std::string & directory,
+ const std::string & backup,
+ const NoteChangedSlot & start_created)
+ : m_signal_start_note_created(start_created)
{
_common_init(directory, backup);
}
@@ -252,7 +257,7 @@ namespace gnote {
links_note_content);
links_note->queue_save (Note::CONTENT_CHANGED);
- start_note->get_window()->show();
+ m_signal_start_note_created(start_note);
}
catch (const std::exception & e) {
ERR_OUT("Error creating start notes: %s",
diff --git a/src/notemanager.hpp b/src/notemanager.hpp
index 124d2be..711dfff 100644
--- a/src/notemanager.hpp
+++ b/src/notemanager.hpp
@@ -44,9 +44,12 @@ namespace gnote {
public:
typedef std::tr1::shared_ptr<NoteManager> Ptr;
typedef sigc::signal<void, const Note::Ptr &> ChangedHandler;
+ typedef sigc::slot<void, const Note::Ptr &> NoteChangedSlot;
- NoteManager(const std::string & );
- NoteManager(const std::string & directory, const std::string & backup);
+ NoteManager(const std::string & ,
+ const NoteChangedSlot & start_created = NoteChangedSlot() );
+ NoteManager(const std::string & directory, const std::string & backup,
+ const NoteChangedSlot & start_created = NoteChangedSlot());
~NoteManager();
void on_setting_changed(Preferences*, GConfEntry*);
@@ -79,6 +82,10 @@ namespace gnote {
ChangedHandler signal_note_deleted;
ChangedHandler signal_note_added;
+ /** this signal is emitted when the start note has been created
+ * This is supposed to happen once in a life time *sigh*
+ * This to avoid relying a the Gnote class for that.
+ */
Note::RenamedHandler signal_note_renamed;
Note::SavedHandler signal_note_saved;
@@ -110,6 +117,7 @@ namespace gnote {
TrieController *m_trie_controller;
std::string m_note_template_title;
std::string m_start_note_uri;
+ NoteChangedSlot m_signal_start_note_created;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]