3
# Copyright © 2012 Umang Varma <umang.me@gmail.com>
5
# This file is part of indicator-stickynotes.
7
# indicator-stickynotes is free software: you can redistribute it and/or
8
# modify it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or (at your
10
# option) any later version.
12
# indicator-stickynotes is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
# You should have received a copy of the GNU General Public License along with
18
# indicator-stickynotes. If not, see <http://www.gnu.org/licenses/>.
20
from stickynotes.backend import Note, NoteSet
21
from stickynotes.gui import StickyNote
22
from gi.repository import Gtk, Gdk
23
from gi.repository import AppIndicator3 as appindicator
25
class IndicatorStickyNotes:
28
self.nset = NoteSet(StickyNote)
31
# Create App Indicator
32
self.ind = appindicator.Indicator.new(
33
"Sticky Notes", "indicator-stickynotes",
34
appindicator.IndicatorCategory.APPLICATION_STATUS)
35
self.ind.set_status(appindicator.IndicatorStatus.ACTIVE)
36
self.ind.set_title("Sticky Notes")
37
#self.ind.set_attention_icon("pynagram")
39
self.menu = Gtk.Menu()
40
self.mNewNote = Gtk.MenuItem("New Note")
41
self.menu.append(self.mNewNote)
42
self.mNewNote.connect("activate", self.new_note, None)
45
s = Gtk.SeparatorMenuItem.new()
49
self.mShowAll = Gtk.MenuItem("Show All")
50
self.menu.append(self.mShowAll)
51
self.mShowAll.connect("activate", self.showall, None)
54
self.mHideAll = Gtk.MenuItem("Hide All")
55
self.menu.append(self.mHideAll)
56
self.mHideAll.connect("activate", self.hideall, None)
59
s = Gtk.SeparatorMenuItem.new()
63
self.mLockAll = Gtk.MenuItem("Lock All")
64
self.menu.append(self.mLockAll)
65
self.mLockAll.connect("activate", self.lockall, None)
68
self.mUnlockAll = Gtk.MenuItem("Unlock All")
69
self.menu.append(self.mUnlockAll)
70
self.mUnlockAll.connect("activate", self.unlockall, None)
71
self.mUnlockAll.show()
73
s = Gtk.SeparatorMenuItem.new()
77
self.mQuit = Gtk.MenuItem("Quit")
78
self.menu.append(self.mQuit)
79
self.mQuit.connect("activate", Gtk.main_quit, None)
81
# Connect Indicator to menu
82
self.ind.set_menu(self.menu)
84
def new_note(self, *args):
87
def showall(self, *args):
88
self.nset.showall(*args)
90
def hideall(self, *args):
93
def lockall(self, *args):
94
for note in self.nset.notes:
95
note.gui.set_locked_state(True)
97
def unlockall(self, *args):
98
for note in self.nset.notes:
99
note.gui.set_locked_state(False)
106
indicator = IndicatorStickyNotes()
110
if __name__ == "__main__":