add show_all_events and show_roster menuitems to systray menu

This commit is contained in:
Yann Leboulanger 2005-10-30 00:08:39 +00:00
parent 39710fe110
commit 56bc8d4709
2 changed files with 88 additions and 38 deletions

View File

@ -11798,7 +11798,7 @@ Status message</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1236">
<widget class="GtkImage" id="image1263">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -11811,6 +11811,42 @@ Status message</property>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator12">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="show_all_events_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Show All _Events</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_show_all_events_menuitem_activate" last_modification_time="Sat, 29 Oct 2005 23:55:24 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="show_roster_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Show _Roster</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_show_roster_menuitem_activate" last_modification_time="Sat, 29 Oct 2005 23:55:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1264">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="preferences_menuitem">
<property name="visible">True</property>

View File

@ -209,6 +209,14 @@ class Systray:
self.systray_context_menu.popup(None, None, None, event.button, event.time)
self.systray_context_menu.show_all()
def on_show_all_events_menuitem_activate(self, widget):
while len(self.jids):
self.handle_first_event()
def on_show_roster_menuitem_activate(self, widget):
win = gajim.interface.roster.window
win.present()
def on_preferences_menuitem_activate(self, widget):
if gajim.interface.windows['preferences'].window.get_property('visible'):
gajim.interface.windows['preferences'].window.present()
@ -258,43 +266,49 @@ class Systray:
else:
win.present()
else:
account = self.jids[0][0]
jid = self.jids[0][1]
typ = self.jids[0][2]
wins = gajim.interface.windows[account]
w = None
if typ == 'gc':
if wins['gc'].has_key(jid):
w = wins['gc'][jid]
elif typ == 'chat':
if wins['chats'].has_key(jid):
w = wins['chats'][jid]
else:
gajim.interface.roster.new_chat(
gajim.contacts[account][jid][0], account)
w = wins['chats'][jid]
elif typ == 'pm':
if wins['chats'].has_key(jid):
w = wins['chats'][jid]
else:
room_jid, nick = jid.split('/', 1)
show = gajim.gc_contacts[account][room_jid][nick].show
c = Contact(jid = jid, name = nick, groups = ['none'],
show = show, ask = 'none')
gajim.interface.roster.new_chat(c, account)
w = wins['chats'][jid]
elif typ in ('normal', 'file-request', 'file-request-error',
'file-send-error', 'file-error', 'file-stopped', 'file-completed'):
# Get the first single message event
ev = gajim.get_first_event(account, jid, typ)
# Open the window
gajim.interface.roster.open_event(account, jid, ev)
if w:
w.set_active_tab(jid)
w.window.present()
tv = w.conversation_textviews[jid]
tv.scroll_to_end()
self.handle_first_event()
def handle_first_event(self):
account = self.jids[0][0]
jid = self.jids[0][1]
typ = self.jids[0][2]
self.handle_event(account, jid, typ)
def handle_event(self, account, jid, typ):
wins = gajim.interface.windows[account]
w = None
if typ == 'gc':
if wins['gc'].has_key(jid):
w = wins['gc'][jid]
elif typ == 'chat':
if wins['chats'].has_key(jid):
w = wins['chats'][jid]
else:
gajim.interface.roster.new_chat(
gajim.contacts[account][jid][0], account)
w = wins['chats'][jid]
elif typ == 'pm':
if wins['chats'].has_key(jid):
w = wins['chats'][jid]
else:
room_jid, nick = jid.split('/', 1)
show = gajim.gc_contacts[account][room_jid][nick].show
c = Contact(jid = jid, name = nick, groups = ['none'],
show = show, ask = 'none')
gajim.interface.roster.new_chat(c, account)
w = wins['chats'][jid]
elif typ in ('normal', 'file-request', 'file-request-error',
'file-send-error', 'file-error', 'file-stopped', 'file-completed'):
# Get the first single message event
ev = gajim.get_first_event(account, jid, typ)
# Open the window
gajim.interface.roster.open_event(account, jid, ev)
if w:
w.set_active_tab(jid)
w.window.present()
tv = w.conversation_textviews[jid]
tv.scroll_to_end()
def on_middle_click(self):
win = gajim.interface.roster.window
if win.is_active():