[gnote] Add sync app menu item
- From: Aurimas Äernius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Add sync app menu item
- Date: Sat, 13 Oct 2012 19:44:03 +0000 (UTC)
commit 7b8fc7d680ef7abc024ff01722af82f9559832f5
Author: Aurimas Äernius <aurisc4 gmail com>
Date: Sat Oct 13 22:30:27 2012 +0300
Add sync app menu item
* Remove obsolete actions
* Add app menu item for synchronization
src/actionmanager.cpp | 5 -----
src/gnote.cpp | 5 ++---
src/gnote.hpp | 2 +-
src/preferencesdialog.cpp | 2 +-
src/synchronization/syncmanager.cpp | 34 +++++-----------------------------
src/synchronization/syncmanager.hpp | 1 -
6 files changed, 9 insertions(+), 40 deletions(-)
---
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 63ea472..364e3bf 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -242,11 +242,6 @@ namespace gnote {
_("_Search All Notes"), _("Open the Search All Notes window"));
m_main_window_actions->add(action);
- action = Gtk::Action::create(
- "NoteSynchronizationAction",
- _("S_ynchronize Notes"), _("Start synchronizing notes"));
- m_main_window_actions->add(action);
-
m_ui->insert_action_group(m_main_window_actions);
}
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 8df6787..b6668fc 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -294,8 +294,6 @@ namespace gnote {
.connect(sigc::mem_fun(*this, &Gnote::on_new_note_action));
am["ShowSearchAllNotesAction"]->signal_activate()
.connect(sigc::mem_fun(*this, &Gnote::open_search_all));
- am["NoteSynchronizationAction"]->signal_activate()
- .connect(sigc::mem_fun(*this, &Gnote::open_note_sync_window));
}
void Gnote::on_new_note_action()
@@ -456,7 +454,7 @@ namespace gnote {
get_main_window()->present();
}
- void Gnote::open_note_sync_window()
+ void Gnote::open_note_sync_window(const Glib::VariantBase&)
{
if(m_sync_dlg == 0) {
m_sync_dlg = sync::SyncDialog::create();
@@ -479,6 +477,7 @@ namespace gnote {
ActionManager & am(ActionManager::obj());
am.get_app_action("new-note")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_new_note_app_action));
am.get_app_action("new-window")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_new_window_action));
+ am.get_app_action("sync-notes")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::open_note_sync_window));
am.get_app_action("help-contents")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_show_help_action));
am.get_app_action("about")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_show_about_action));
am.get_app_action("quit")->signal_activate().connect(sigc::mem_fun(*this, &Gnote::on_quit_gnote_action));
diff --git a/src/gnote.hpp b/src/gnote.hpp
index 9335602..08d4de1 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -136,7 +136,7 @@ public:
NoteRecentChanges::Ptr get_main_window();
NoteRecentChanges::Ptr get_window_for_note();
void open_search_all();
- void open_note_sync_window();
+ void open_note_sync_window(const Glib::VariantBase&);
static std::string cache_dir();
static std::string conf_dir();
diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp
index 748d07d..2adcff9 100644
--- a/src/preferencesdialog.cpp
+++ b/src/preferencesdialog.cpp
@@ -1251,7 +1251,7 @@ DBG_OUT("no addin");
if(dialog_response == Gtk::RESPONSE_YES) {
// TODO: Put this voodoo in a method somewhere
- ActionManager::obj()["NoteSynchronizationAction"]->activate();
+ ActionManager::obj().get_app_action("sync-notes")->activate(Glib::VariantBase());
}
}
else {
diff --git a/src/synchronization/syncmanager.cpp b/src/synchronization/syncmanager.cpp
index 9b0e608..907f94d 100644
--- a/src/synchronization/syncmanager.cpp
+++ b/src/synchronization/syncmanager.cpp
@@ -130,28 +130,10 @@ namespace sync {
g_signal_connect(m_sync_helper, "update-note", G_CALLBACK(SyncManager::on_update_note), NULL);
g_signal_connect(m_sync_helper, "delete-note", G_CALLBACK(SyncManager::on_delete_note), NULL);
m_client = SyncClient::Ptr(new GnoteSyncClient);
- // Add a "Synchronize Notes" to Tomboy's Main Menu
- Glib::RefPtr<Gtk::ActionGroup> action_group = Gtk::ActionGroup::create("Sync");
- action_group->add(Gtk::Action::create("ToolsMenuAction", _("_Tools"), ""));
- Glib::RefPtr<Gtk::Action> sync_notes_action = Gtk::Action::create("SyncNotesAction", _("Synchronize Notes"), "");
- sync_notes_action->signal_activate().connect(sigc::mem_fun(*this, &SyncManager::on_sync_notes_activate));
- action_group->add(sync_notes_action);
-
-#if 0
- ActionManager::obj().get_ui()->add_ui_from_string(
- "<ui>"
- "<menubar name='MainWindowMenubar'>"
- "<placeholder name='MainWindowMenuPlaceholder'>"
- "<menu name='ToolsMenu' action='ToolsMenuAction'>"
- "<menuitem name='SyncNotes' action='SyncNotesAction' />"
- "</menu>"
- "</placeholder>"
- "</menubar>"
- "</ui>"
- );
-#endif
-
- ActionManager::obj().get_ui()->insert_action_group(action_group, 0);
+ // Add a "Synchronize Notes" to Gnote's Application Menu
+ ActionManager & am(ActionManager::obj());
+ am.add_app_action("sync-notes");
+ am.add_app_menu_item(ActionManager::APP_ACTION_MANAGE, 200, _("Synchronize Notes"), "app.sync-notes");
// Initialize all the SyncServiceAddins
Gnote::obj().default_note_manager().get_addin_manager().initialize_sync_service_addins();
@@ -499,7 +481,7 @@ namespace sync {
{
Glib::RefPtr<Gio::Settings> settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_SYNC);
std::string sync_addin_id = settings->get_string(Preferences::SYNC_SELECTED_SERVICE_ADDIN);
- ActionManager::obj()["SyncNotesAction"]->set_sensitive(sync_addin_id != "");
+ ActionManager::obj().get_app_action("sync-notes")->set_enabled(sync_addin_id != "");
int timeoutPref = settings->get_int(Preferences::SYNC_AUTOSYNC_TIMEOUT);
if(timeoutPref != m_autosync_timeout_pref_minutes) {
@@ -651,12 +633,6 @@ namespace sync {
}
- void SyncManager::on_sync_notes_activate()
- {
- ActionManager::obj()["NoteSynchronizationAction"]->activate();
- }
-
-
void SyncManager::create_note_in_main_thread(const NoteUpdate & noteUpdate)
{
// Note creation may affect the GUI, so we have to use the
diff --git a/src/synchronization/syncmanager.hpp b/src/synchronization/syncmanager.hpp
index 6d97afc..968c0e0 100644
--- a/src/synchronization/syncmanager.hpp
+++ b/src/synchronization/syncmanager.hpp
@@ -84,7 +84,6 @@ namespace sync {
void set_state(SyncState new_state);
SyncServiceAddin *get_configured_sync_service();
SyncServiceAddin *get_sync_service_addin(const std::string & sync_service_id);
- void on_sync_notes_activate();
void create_note_in_main_thread(const NoteUpdate & noteUpdate);
void update_note_in_main_thread(const Note::Ptr & existingNote, const NoteUpdate & noteUpdate);
void delete_note_in_main_thread(const Note::Ptr & existingNote);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]