[gnote] Never open new window with --background



commit a47cc00e509a5de5c5bd9ff46dfe64dbf49951a3
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Dec 16 22:59:07 2013 +0200

    Never open new window with --background
    
    Fixes Bug 720491.

 src/gnote.cpp |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 8a4a187..2962188 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -132,7 +132,7 @@ namespace gnote {
     else if(cmd_line.needs_execute()) {
       cmd_line.execute();
     }
-    else {
+    else if(!cmd_line.background()) {
       new_main_window().present();
     }
 
@@ -177,17 +177,19 @@ namespace gnote {
       else {
         // If Gnote is already running, open the search window
         // so the user gets some sort of feedback when they
-        // attempt to run Gnote again.
-        Glib::RefPtr<RemoteControlClient> remote;
-        try {
-          remote = RemoteControlProxy::get_instance();
-          DBG_ASSERT(remote, "remote is NULL, something is wrong");
-          if(remote) {
-            remote->DisplaySearch();
+        // attempt to run Gnote again, except when --background is passed
+        if(!m_is_background) {
+          Glib::RefPtr<RemoteControlClient> remote;
+          try {
+            remote = RemoteControlProxy::get_instance();
+            DBG_ASSERT(remote, "remote is NULL, something is wrong");
+            if(remote) {
+              remote->DisplaySearch();
+            }
+          } 
+          catch (...)
+          {
           }
-        } 
-        catch (...)
-        {
         }
 
         ERR_OUT(_("Gnote is already running.  Exiting..."));


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