Added minimize/unminimize to status icon
This commit is contained in:
parent
e4a1823788
commit
59d9177f3a
21
hrafn.py
21
hrafn.py
|
@ -75,6 +75,8 @@ class Hrafn():
|
|||
|
||||
self.username = self.db['active_user']
|
||||
|
||||
self.minimized = False
|
||||
|
||||
try:
|
||||
self.api = self.accounts[self.username]
|
||||
except KeyError:
|
||||
|
@ -128,7 +130,7 @@ class Hrafn():
|
|||
|
||||
# Add a system tray icon
|
||||
self.tray_icon = gtk.status_icon_new_from_file('ui/icon.svg')
|
||||
|
||||
self.tray_icon.connect('activate', self.on_tray_icon_clicked)
|
||||
|
||||
# Set the account label
|
||||
self.update_account_label()
|
||||
|
@ -239,7 +241,7 @@ class Hrafn():
|
|||
|
||||
|
||||
def on_about(self, widget):
|
||||
print "STUB: help->about not yet implemented"
|
||||
print "stub: Hrafn.on_about()"
|
||||
|
||||
|
||||
def on_reply(self, widget, data):
|
||||
|
@ -571,6 +573,21 @@ class Hrafn():
|
|||
self.accounts_menu.append(menu_item)
|
||||
menu_item.show()
|
||||
|
||||
|
||||
def on_tray_icon_clicked(self, event):
|
||||
if self.minimized:
|
||||
self.window.deiconify()
|
||||
else:
|
||||
self.window.iconify()
|
||||
|
||||
|
||||
def on_window_state_changed(self, window, event):
|
||||
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
||||
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
||||
self.minimized = True
|
||||
else:
|
||||
self.minimized = False
|
||||
|
||||
### end class Hrafn
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<signal name="hide" handler="gtk_main_quit" last_modification_time="Fri, 09 Apr 2010 03:40:14 GMT"/>
|
||||
<signal name="key_press_event" handler="global_key_press_handler" last_modification_time="Fri, 16 Apr 2010 15:35:22 GMT"/>
|
||||
<signal name="configure_event" handler="on_resize" last_modification_time="Tue, 18 May 2010 03:10:23 GMT"/>
|
||||
<signal name="window_state_event" handler="on_window_state_changed" last_modification_time="Mon, 24 May 2010 19:45:21 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="main_box">
|
||||
|
@ -101,11 +102,10 @@
|
|||
<property name="label" translatable="yes">_Views</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="view_menu">
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="view_menu">
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
|
@ -115,11 +115,10 @@
|
|||
<property name="label" translatable="yes">_Accounts</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="accounts_menu">
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="accounts_menu">
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
|
|
Reference in New Issue
Block a user