Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eta
gajim
Commits
20ac1575
Commit
20ac1575
authored
19 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
more OO for systraywin32
parent
b4ae3153
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/systray.py
+38
-31
38 additions, 31 deletions
src/systray.py
src/systraywin32.py
+5
-51
5 additions, 51 deletions
src/systraywin32.py
with
43 additions
and
82 deletions
src/systray.py
+
38
−
31
View file @
20ac1575
...
...
@@ -182,7 +182,7 @@ class Systray:
account_menu_for_new_message
.
append
(
item
)
elif
len
(
gajim
.
connections
)
==
1
:
# one account
# one account, no need to show 'as jid
# one account, no need to show 'as jid
'
# for chat_with
account
=
gajim
.
connections
.
keys
()[
0
]
...
...
@@ -193,7 +193,7 @@ class Systray:
self
.
new_message_handler_id
=
new_message_menuitem
.
connect
(
'
activate
'
,
self
.
on_new_message_menuitem_activate
,
account
)
if
event
is
not
None
:
if
event
is
not
None
:
# None means windows (we explicitly popup in systraywin32.py)
self
.
systray_context_menu
.
popup
(
None
,
None
,
None
,
event
.
button
,
event
.
time
)
self
.
systray_context_menu
.
show_all
()
...
...
@@ -238,39 +238,46 @@ class Systray:
return
groups_menu
def
on_clicked
(
self
,
widget
,
event
):
self
.
on_tray_leave_notify_event
(
widget
,
None
)
def
on_left_click
(
self
):
win
=
self
.
plugin
.
roster
.
window
if
event
.
button
==
1
:
# Left click
if
len
(
self
.
jids
)
==
0
:
if
win
.
get_property
(
'
visible
'
):
win
.
hide
()
else
:
win
.
present
()
else
:
account
=
self
.
jids
[
0
][
0
]
jid
=
self
.
jids
[
0
][
1
]
acc
=
self
.
plugin
.
windows
[
account
]
w
=
None
if
acc
[
'
gc
'
].
has_key
(
jid
):
w
=
acc
[
'
gc
'
][
jid
]
elif
acc
[
'
chats
'
].
has_key
(
jid
):
w
=
acc
[
'
chats
'
][
jid
]
else
:
self
.
plugin
.
roster
.
new_chat
(
gajim
.
contacts
[
account
][
jid
][
0
],
account
)
acc
[
'
chats
'
][
jid
].
set_active_tab
(
jid
)
acc
[
'
chats
'
][
jid
].
window
.
present
()
if
w
:
w
.
set_active_tab
(
jid
)
w
.
window
.
present
()
tv
=
w
.
xmls
[
jid
].
get_widget
(
'
conversation_textview
'
)
w
.
scroll_to_end
(
tv
)
if
event
.
button
==
2
:
# middle click
if
win
.
is_active
():
if
len
(
self
.
jids
)
==
0
:
if
win
.
get_property
(
'
visible
'
):
win
.
hide
()
else
:
win
.
present
()
else
:
account
=
self
.
jids
[
0
][
0
]
jid
=
self
.
jids
[
0
][
1
]
acc
=
self
.
plugin
.
windows
[
account
]
w
=
None
if
acc
[
'
gc
'
].
has_key
(
jid
):
w
=
acc
[
'
gc
'
][
jid
]
elif
acc
[
'
chats
'
].
has_key
(
jid
):
w
=
acc
[
'
chats
'
][
jid
]
else
:
self
.
plugin
.
roster
.
new_chat
(
gajim
.
contacts
[
account
][
jid
][
0
],
account
)
acc
[
'
chats
'
][
jid
].
set_active_tab
(
jid
)
acc
[
'
chats
'
][
jid
].
window
.
present
()
if
w
:
w
.
set_active_tab
(
jid
)
w
.
window
.
present
()
tv
=
w
.
xmls
[
jid
].
get_widget
(
'
conversation_textview
'
)
w
.
scroll_to_end
(
tv
)
def
on_middle_click
(
self
):
win
=
self
.
plugin
.
roster
.
window
if
win
.
is_active
():
win
.
hide
()
else
:
win
.
present
()
def
on_clicked
(
self
,
widget
,
event
):
self
.
on_tray_leave_notify_event
(
widget
,
None
)
if
event
.
button
==
1
:
# Left click
self
.
on_left_click
()
if
event
.
button
==
2
:
# middle click
self
.
on_middle_click
()
if
event
.
button
==
3
:
# right click
self
.
make_menu
(
event
)
...
...
This diff is collapsed.
Click to expand it.
src/systraywin32.py
+
5
−
51
View file @
20ac1575
...
...
@@ -20,6 +20,7 @@ WS_EX_LAYERED = 0x80000
import
gtk
WM_LBUTTONUP
=
0x0202
WM_MBUTTONUP
=
0x0208
WM_RBUTTONUP
=
0x0205
from
common
import
gajim
...
...
@@ -200,6 +201,7 @@ class NotifyIcon:
class
SystrayWin32
(
systray
.
Systray
):
def
__init__
(
self
,
plugin
):
# Note: gtk window must be realized before installing extensions.
systray
.
Systray
.
__init__
(
self
,
plugin
)
self
.
plugin
=
plugin
self
.
jids
=
[]
self
.
status
=
'
offline
'
...
...
@@ -224,62 +226,14 @@ class SystrayWin32(systray.Systray):
def
hide_icon
(
self
):
self
.
win32ext
.
remove_notify_icon
()
def
make_menu
(
self
):
"""
create chat with and new message (sub) menus/menuitems
"""
chat_with_menuitem
=
self
.
xml
.
get_widget
(
'
chat_with_menuitem
'
)
new_message_menuitem
=
self
.
xml
.
get_widget
(
'
new_message_menuitem
'
)
iskey
=
len
(
gajim
.
connections
.
keys
())
>
0
chat_with_menuitem
.
set_sensitive
(
iskey
)
new_message_menuitem
.
set_sensitive
(
iskey
)
if
len
(
gajim
.
connections
.
keys
())
>=
2
:
# 2 or more accounts? make submenus
account_menu_for_chat_with
=
gtk
.
Menu
()
chat_with_menuitem
.
set_submenu
(
account_menu_for_chat_with
)
account_menu_for_new_message
=
gtk
.
Menu
()
new_message_menuitem
.
set_submenu
(
account_menu_for_new_message
)
for
account
in
gajim
.
connections
:
our_jid
=
gajim
.
config
.
get_per
(
'
accounts
'
,
account
,
'
name
'
)
+
'
@
'
+
\
gajim
.
config
.
get_per
(
'
accounts
'
,
account
,
'
hostname
'
)
#for chat_with
item
=
gtk
.
MenuItem
(
_
(
'
as
'
)
+
our_jid
)
account_menu_for_chat_with
.
append
(
item
)
group_menu
=
self
.
make_groups_submenus_for_chat_with
(
account
)
item
.
set_submenu
(
group_menu
)
#for new_message
item
=
gtk
.
MenuItem
(
_
(
'
as
'
)
+
our_jid
)
item
.
connect
(
'
activate
'
,
\
self
.
on_new_message_menuitem_activate
,
account
)
account_menu_for_new_message
.
append
(
item
)
def
on_clicked
(
self
,
hwnd
,
message
,
wparam
,
lparam
):
if
lparam
==
WM_RBUTTONUP
:
# Right click
self
.
make_menu
()
self
.
win32ext
.
notify_icon
.
menu
.
popup
(
None
,
None
,
None
,
0
,
0
)
elif
lparam
==
WM_MBUTTONUP
:
# Middle click
self
.
on_middle_click
()
elif
lparam
==
WM_LBUTTONUP
:
# Left click
if
len
(
self
.
jids
)
==
0
:
win
=
self
.
plugin
.
roster
.
window
if
win
.
is_active
():
win
.
hide
()
else
:
win
.
present
()
else
:
account
=
self
.
jids
[
0
][
0
]
jid
=
self
.
jids
[
0
][
1
]
acc
=
self
.
plugin
.
windows
[
account
]
if
acc
[
'
gc
'
].
has_key
(
jid
):
acc
[
'
gc
'
][
jid
].
set_active_tab
(
jid
)
acc
[
'
gc
'
][
jid
].
window
.
present
()
elif
acc
[
'
chats
'
].
has_key
(
jid
):
acc
[
'
chats
'
][
jid
].
set_active_tab
(
jid
)
acc
[
'
chats
'
][
jid
].
window
.
present
()
else
:
self
.
plugin
.
roster
.
new_chat
(
self
.
plugin
.
roster
.
contacts
[
account
][
jid
][
0
],
account
)
acc
[
'
chats
'
][
jid
].
set_active_tab
(
jid
)
acc
[
'
chats
'
][
jid
].
window
.
present
()
self
.
on_left_click
()
#self.win32ext.notify_icon.menu.popdown()
#self.win32ext.notify_icon.menu.popup(None, None, None, 0, 0)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment