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> <property name="use_underline">True</property>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image1236"> <widget class="GtkImage" id="image1263">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-new</property> <property name="stock">gtk-new</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -11811,6 +11811,42 @@ Status message</property>
</widget> </widget>
</child> </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> <child>
<widget class="GtkImageMenuItem" id="preferences_menuitem"> <widget class="GtkImageMenuItem" id="preferences_menuitem">
<property name="visible">True</property> <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.popup(None, None, None, event.button, event.time)
self.systray_context_menu.show_all() 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): def on_preferences_menuitem_activate(self, widget):
if gajim.interface.windows['preferences'].window.get_property('visible'): if gajim.interface.windows['preferences'].window.get_property('visible'):
gajim.interface.windows['preferences'].window.present() gajim.interface.windows['preferences'].window.present()
@ -258,43 +266,49 @@ class Systray:
else: else:
win.present() win.present()
else: else:
account = self.jids[0][0] self.handle_first_event()
jid = self.jids[0][1]
typ = self.jids[0][2] def handle_first_event(self):
wins = gajim.interface.windows[account] account = self.jids[0][0]
w = None jid = self.jids[0][1]
if typ == 'gc': typ = self.jids[0][2]
if wins['gc'].has_key(jid): self.handle_event(account, jid, typ)
w = wins['gc'][jid]
elif typ == 'chat': def handle_event(self, account, jid, typ):
if wins['chats'].has_key(jid): wins = gajim.interface.windows[account]
w = wins['chats'][jid] w = None
else: if typ == 'gc':
gajim.interface.roster.new_chat( if wins['gc'].has_key(jid):
gajim.contacts[account][jid][0], account) w = wins['gc'][jid]
w = wins['chats'][jid] elif typ == 'chat':
elif typ == 'pm': if wins['chats'].has_key(jid):
if wins['chats'].has_key(jid): w = wins['chats'][jid]
w = wins['chats'][jid] else:
else: gajim.interface.roster.new_chat(
room_jid, nick = jid.split('/', 1) gajim.contacts[account][jid][0], account)
show = gajim.gc_contacts[account][room_jid][nick].show w = wins['chats'][jid]
c = Contact(jid = jid, name = nick, groups = ['none'], elif typ == 'pm':
show = show, ask = 'none') if wins['chats'].has_key(jid):
gajim.interface.roster.new_chat(c, account) w = wins['chats'][jid]
w = wins['chats'][jid] else:
elif typ in ('normal', 'file-request', 'file-request-error', room_jid, nick = jid.split('/', 1)
'file-send-error', 'file-error', 'file-stopped', 'file-completed'): show = gajim.gc_contacts[account][room_jid][nick].show
# Get the first single message event c = Contact(jid = jid, name = nick, groups = ['none'],
ev = gajim.get_first_event(account, jid, typ) show = show, ask = 'none')
# Open the window gajim.interface.roster.new_chat(c, account)
gajim.interface.roster.open_event(account, jid, ev) w = wins['chats'][jid]
if w: elif typ in ('normal', 'file-request', 'file-request-error',
w.set_active_tab(jid) 'file-send-error', 'file-error', 'file-stopped', 'file-completed'):
w.window.present() # Get the first single message event
tv = w.conversation_textviews[jid] ev = gajim.get_first_event(account, jid, typ)
tv.scroll_to_end() # 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): def on_middle_click(self):
win = gajim.interface.roster.window win = gajim.interface.roster.window
if win.is_active(): if win.is_active():