[gnote] Remove status icon



commit 70736892865efe370a0738ff8a97295b55efaa7c
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jan 11 20:46:20 2015 +0200

    Remove status icon

 data/org.gnome.gnote.gschema.xml.in |    2 +-
 src/Makefile.am                     |    1 -
 src/gnote.cpp                       |   67 +----
 src/gnote.hpp                       |   18 +-
 src/preferencesdialog.cpp           |   10 +-
 src/prefskeybinder.cpp              |   10 +-
 src/prefskeybinder.hpp              |    6 +-
 src/tray.cpp                        |  593 -----------------------------------
 src/tray.hpp                        |  163 ----------
 9 files changed, 9 insertions(+), 861 deletions(-)
---
diff --git a/data/org.gnome.gnote.gschema.xml.in b/data/org.gnome.gnote.gschema.xml.in
index 525b034..0837a89 100644
--- a/data/org.gnome.gnote.gschema.xml.in
+++ b/data/org.gnome.gnote.gschema.xml.in
@@ -123,7 +123,7 @@
     <key name="use-status-icon" type="b">
       <default>false</default>
       <_summary>Use status icon, when started as an application</_summary>
-      <_description>Has affect only when started as an application. When set to TRUE, shows a status icon. 
If set to FALSE, Search All Notes window is used as main application window, closing which makes application 
to exit.</_description>
+      <_description>Deprecated, has no effect</_description>
     </key>
     <key name="open-notes-in-new-window" type="b">
       <default>false</default>
diff --git a/src/Makefile.am b/src/Makefile.am
index 537ffa1..3709b86 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -180,7 +180,6 @@ gnote_SOURCES = \
        recentchanges.hpp recentchanges.cpp \
        searchnoteswidget.hpp searchnoteswidget.cpp \
        tagmanager.hpp tagmanager.cpp \
-       tray.hpp tray.cpp \
        notebooks/notebookstreeview.hpp notebooks/notebookstreeview.cpp \
        synchronization/gnotesyncclient.hpp synchronization/gnotesyncclient.cpp \
        synchronization/silentui.hpp synchronization/silentui.cpp \
diff --git a/src/gnote.cpp b/src/gnote.cpp
index dc4a015..41a3edd 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -128,10 +128,6 @@ namespace gnote {
     cmdline.parse(argc, argv);
     if(!m_manager) {
       common_init();
-      Glib::RefPtr<Gio::Settings> settings = Preferences::obj()
-        .get_schema_settings(Preferences::SCHEMA_GNOTE);
-      settings->signal_changed()
-        .connect(sigc::mem_fun(*this, &Gnote::on_setting_changed));
       register_object();
     }
     else if(cmdline.needs_execute()) {
@@ -206,13 +202,7 @@ namespace gnote {
 
     make_app_actions();
     make_app_menu();
-    Glib::RefPtr<Gio::Settings> settings = Preferences::obj()
-      .get_schema_settings(Preferences::SCHEMA_GNOTE);
-    if(settings->get_boolean(Preferences::USE_STATUS_ICON)) {
-      DBG_OUT("starting tray icon");
-      start_tray_icon();
-    }
-    else if(is_background()) {
+    if(is_background()) {
       // do not exit when all windows are closed
       hold();
       if(m_is_shell_search) {
@@ -242,36 +232,6 @@ namespace gnote {
     return note_path;
   }
 
-  bool Gnote::show_tray_icon_timeout()
-  {
-    // Setting to false and back to true is required to make it work on some tray implementations
-    m_tray_icon->set_visible(false);
-    m_tray_icon->set_visible(true);
-    return false;
-  }
-
-  void Gnote::start_tray_icon()
-  {
-    // Create Search All Notes window as we need it present for application to run
-    get_main_window();
-
-    if(!m_tray_icon) {
-      // Create the tray icon and run the main loop
-#ifdef HAVE_X11_SUPPORT
-      m_tray_icon = Glib::RefPtr<TrayIcon>(new TrayIcon(keybinder(), default_note_manager()));
-#else
-      m_tray_icon = Glib::RefPtr<TrayIcon>(new TrayIcon(default_note_manager()));
-#endif
-      m_tray = m_tray_icon->tray();
-    }
-
-    // Tome make status icon visible on some implementations, it should be made visible
-    // after some timeout.
-    Glib::RefPtr<Glib::TimeoutSource> timeout = Glib::TimeoutSource::create(100);
-    timeout->connect(sigc::mem_fun(*this, &Gnote::show_tray_icon_timeout));
-    timeout->attach();
-  }
-
 
   void Gnote::register_remote_control(NoteManager & manager, RemoteControlProxy::slot_name_acquire_finish 
on_finish)
   {
@@ -287,26 +247,6 @@ namespace gnote {
   }
 
 
-  void Gnote::on_setting_changed(const Glib::ustring & key)
-  {
-    if(key != Preferences::USE_STATUS_ICON) {
-      return;
-    }
-
-    bool use_status_icon = Preferences::obj()
-      .get_schema_settings(Preferences::SCHEMA_GNOTE)->get_boolean(key);
-    if(use_status_icon) {
-      start_tray_icon();
-    }
-    else {
-      if(m_tray_icon) {
-        m_tray_icon->set_visible(false);
-      }
-      ActionManager::obj()["ShowSearchAllNotesAction"]->activate();
-    }
-  }
-
-
   void Gnote::setup_global_actions()
   {
     IActionManager & am(IActionManager::obj());
@@ -349,11 +289,6 @@ namespace gnote {
   void Gnote::on_show_help_action(const Glib::VariantBase&)
   {
     GdkScreen *cscreen = NULL;
-    if(m_tray_icon) {
-      Gdk::Rectangle area;
-      GtkOrientation orientation;
-      gtk_status_icon_get_geometry(m_tray_icon->gobj(), &cscreen, area.gobj(), &orientation);
-    }
     utils::show_help("gnote", "", cscreen, NULL);
   }
 
diff --git a/src/gnote.hpp b/src/gnote.hpp
index 30ac62c..76220f5 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2014 Aurimas Cernius
+ * Copyright (C) 2010-2015 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,6 @@
 #include "actionmanager.hpp"
 #include "ignote.hpp"
 #include "remotecontrolproxy.hpp"
-#include "tray.hpp"
 #include "synchronization/syncdialog.hpp"
 
 #ifdef HAVE_X11_SUPPORT
@@ -130,7 +129,6 @@ public:
 #endif
 
   void setup_global_actions();
-  void start_tray_icon();
 
   void on_quit_gnote_action(const Glib::VariantBase&);
   void on_preferences_response(int res);
@@ -143,21 +141,13 @@ public:
   virtual void open_search_all() override;
   void open_note_sync_window(const Glib::VariantBase&);
 
-  bool tray_icon_showing()
-    {
-      return m_tray_icon && m_tray_icon->is_embedded() && m_tray_icon->get_visible();
-    }
   bool is_background() const
     {
       return m_is_background || m_is_shell_search;
     }
   bool windowed()
     {
-      return !tray_icon_showing() && !is_background();
-    }
-  void set_tray(const Tray::Ptr & tray)
-    {
-      m_tray = tray;
+      return !is_background();
     }
   static void register_remote_control(NoteManager & manager, RemoteControlProxy::slot_name_acquire_finish 
on_finish);
   virtual void open_note(const Note::Ptr & note) override;
@@ -167,7 +157,6 @@ protected:
 private:
   Gnote();
   std::string get_note_path(const std::string & override_path);
-  void on_setting_changed(const Glib::ustring & key);
   void common_init();
   void end_main(bool bus_aquired, bool name_acquired);
   void on_sync_dialog_response(int response_id);
@@ -178,13 +167,10 @@ private:
   void on_new_window_action(const Glib::VariantBase&);
   void on_new_note_app_action(const Glib::VariantBase&);
   MainWindow *get_active_window();
-  bool show_tray_icon_timeout();
   void register_object();
 
   NoteManager *m_manager;
   Glib::RefPtr<Gtk::IconTheme> m_icon_theme;
-  Glib::RefPtr<TrayIcon> m_tray_icon;
-  Tray::Ptr m_tray;
   bool m_is_background;
   bool m_is_shell_search;
   PreferencesDialog *m_prefsdlg;
diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp
index dcc9e37..b9dcd3a 100644
--- a/src/preferencesdialog.cpp
+++ b/src/preferencesdialog.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2014 Aurimas Cernius
+ * Copyright (C) 2010-2015 Aurimas Cernius
  * Copyright (C) 2009 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -243,14 +243,6 @@ namespace gnote {
       int options_list_row = 0;
 
 
-      // Status icon
-      check = manage(make_check_button(_("Use status _icon")));
-      set_widget_tooltip(*check, _("Show icon in tray, which is the central place of control."));
-      options_list->attach(*check, 0, options_list_row++, 1, 1);
-      peditor = new sharp::PropertyEditorBool(settings, Preferences::USE_STATUS_ICON, *check);
-      peditor->setup();
-
-
       // Open in new window
       check = manage(make_check_button(_("Always _open notes in new window")));
       options_list->attach(*check, 0, options_list_row++, 1, 1);
diff --git a/src/prefskeybinder.cpp b/src/prefskeybinder.cpp
index 02a4ed4..2c21521 100644
--- a/src/prefskeybinder.cpp
+++ b/src/prefskeybinder.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011-2014 Aurimas Cernius
+ * Copyright (C) 2011-2015 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -28,7 +28,6 @@
 #include "notewindow.hpp"
 #include "preferences.hpp"
 #include "prefskeybinder.hpp"
-#include "tray.hpp"
 
 
 #define KEYBINDING_SHOW_NOTE_MENU_DEFAULT "&lt;Alt&gt;F12"
@@ -144,10 +143,9 @@ namespace gnote {
 
 
   GnotePrefsKeybinder::GnotePrefsKeybinder(IKeybinder & keybinder,
-                                           NoteManager & manager, IGnoteTray & trayicon)
+                                           NoteManager & manager)
     : PrefsKeybinder(keybinder)
     , m_manager(manager)
-    , m_trayicon(trayicon)
   {
     Glib::RefPtr<Gio::Settings> settings = Preferences::obj()
       .get_schema_settings(Preferences::SCHEMA_GNOTE);
@@ -196,10 +194,6 @@ namespace gnote {
 
   void GnotePrefsKeybinder::key_show_menu()
   {
-    // Show the notes menu, highlighting the first item.
-    // This matches the behavior of GTK for
-    // accelerator-shown menus.
-    m_trayicon.show_menu (true);
   }
 
 
diff --git a/src/prefskeybinder.hpp b/src/prefskeybinder.hpp
index 81d13a2..2591c1d 100644
--- a/src/prefskeybinder.hpp
+++ b/src/prefskeybinder.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011,2013 Aurimas Cernius
+ * Copyright (C) 2011,2013,2015 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -33,7 +33,6 @@ namespace gnote {
 
 class TrayIcon;
 class NoteManager;
-class IGnoteTray;
 class IKeybinder;
 
 
@@ -57,7 +56,7 @@ class GnotePrefsKeybinder
   : public PrefsKeybinder
 {
 public:
-  GnotePrefsKeybinder(IKeybinder & keybinder, NoteManager & manager, IGnoteTray & trayicon);
+  GnotePrefsKeybinder(IKeybinder & keybinder, NoteManager & manager);
   void enable_keybindings_changed(const Glib::ustring & key);
   void enable_disable(bool enable);
 private:
@@ -67,7 +66,6 @@ private:
   void key_open_search();
   void key_open_recent_changes();
   NoteManager & m_manager;
-  IGnoteTray & m_trayicon;
 };
 
 


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