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
45d3c05f
Commit
45d3c05f
authored
20 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
support trayicon from pythongnomeextras too
parent
bbfc49ba
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plugins/gtkgui/gtkgui.py
+9
-6
9 additions, 6 deletions
plugins/gtkgui/gtkgui.py
plugins/gtkgui/roster_window.py
+9
-10
9 additions, 10 deletions
plugins/gtkgui/roster_window.py
plugins/gtkgui/systray.py
+69
-35
69 additions, 35 deletions
plugins/gtkgui/systray.py
with
87 additions
and
51 deletions
plugins/gtkgui/gtkgui.py
+
9
−
6
View file @
45d3c05f
...
...
@@ -3,8 +3,8 @@
## Gajim Team:
## - Yann Le Boulanger <asterix@lagaule.org>
## - Vincent Hanquez <tab@snarc.org>
##
- Nikos Kouremenos <kourem@gmail.com>
##
- Alex Podaras <bigpod@gmail.com>
## - Nikos Kouremenos <kourem@gmail.com>
## - Alex Podaras <bigpod@gmail.com>
##
## Copyright (C) 2003-2005 Gajim Team
##
...
...
@@ -849,11 +849,14 @@ class plugin:
self
.
config
[
'
autoxatime
'
]
*
60
)
self
.
systray_visible
=
0
try
:
import
trayicon
import
egg.
trayicon
as
trayicon
# use gnomepythonextras traycion
except
:
self
.
config
[
'
trayicon
'
]
=
0
self
.
send
(
'
CONFIG
'
,
None
,
(
'
GtkGui
'
,
self
.
config
,
'
GtkGui
'
))
self
.
systray
=
systrayDummy
()
try
:
import
trayicon
# use yann's
except
:
# user doesn't have trayicon capabilities
self
.
config
[
'
trayicon
'
]
=
0
self
.
send
(
'
CONFIG
'
,
None
,
(
'
GtkGui
'
,
self
.
config
,
'
GtkGui
'
))
self
.
systray
=
systrayDummy
()
else
:
self
.
systray
=
systray
(
self
)
if
self
.
config
[
'
trayicon
'
]:
...
...
This diff is collapsed.
Click to expand it.
plugins/gtkgui/roster_window.py
+
9
−
10
View file @
45d3c05f
...
...
@@ -214,7 +214,7 @@ class roster_window:
join_gc_menuitem
.
set_sensitive
(
False
)
add_contact_menuitem
.
set_sensitive
(
False
)
browse_agents_menuitem
.
set_sensitive
(
False
)
if
len
(
self
.
plugin
.
accounts
.
keys
())
>
1
:
# 2 or more accounts? make submenus
if
len
(
self
.
plugin
.
accounts
.
keys
())
>
=
2
:
# 2 or more accounts? make submenus
#add
sub_menu
=
gtk
.
Menu
()
add_contact_menuitem
.
set_submenu
(
sub_menu
)
...
...
@@ -247,23 +247,22 @@ class roster_window:
sub_menu
.
append
(
item
)
item
.
connect
(
"
activate
"
,
self
.
on_new_message_menuitem_activate
,
account
)
sub_menu
.
show_all
()
elif
len
(
self
.
plugin
.
accounts
.
keys
())
==
1
:
elif
len
(
self
.
plugin
.
accounts
.
keys
())
==
1
:
# one account
#add
if
not
self
.
add_contact_handler_id
:
self
.
add_contact_handler_id
=
self
.
xml
.
get_widget
(
'
add_contact_menuitem
'
)
.
connect
(
"
activate
"
,
self
.
on_add_contact
,
self
.
plugin
.
accounts
.
keys
()[
0
])
self
.
add_contact_handler_id
=
add_contact_menuitem
.
connect
(
\
'
activate
'
,
self
.
on_add_contact
,
self
.
plugin
.
accounts
.
keys
()[
0
])
#agents
if
not
self
.
browse_agents_handler_id
:
self
.
browse_agents_handler_id
=
self
.
xml
.
get_widget
(
'
browse_agents_menuitem
'
).
connect
(
"
activate
"
,
self
.
on_browse_agents
,
self
.
plugin
.
accounts
.
keys
()[
0
])
self
.
browse_agents_handler_id
=
browse_agents_menuitem
.
connect
(
\
'
activate
'
,
self
.
on_browse_agents
,
self
.
plugin
.
accounts
.
keys
()[
0
])
#join_gc
if
not
self
.
join_gc_handler_id
:
self
.
join_gc_handler_id
=
self
.
xml
.
get_widget
(
'
join_gc_menuitem
'
)
.
connect
(
self
.
join_gc_handler_id
=
join_gc_menuitem
.
connect
(
\
"
activate
"
,
self
.
on_join_gc
,
self
.
plugin
.
accounts
.
keys
()[
0
])
if
not
self
.
new_message_menuitem_handler_id
:
self
.
new_message_menuitem_handler_id
=
self
.
xml
.
get_widget
(
'
new_message_menuitem
'
)
.
connect
(
"
activate
"
,
self
.
on_new_message_menuitem_activate
,
self
.
plugin
.
accounts
.
keys
()[
0
])
self
.
new_message_menuitem_handler_id
=
new_message_menuitem
.
connect
(
\
'
activate
'
,
self
.
on_new_message_menuitem_activate
,
self
.
plugin
.
accounts
.
keys
()[
0
])
def
draw_roster
(
self
):
"""
Clear and draw roster
"""
...
...
This diff is collapsed.
Click to expand it.
plugins/gtkgui/systray.py
+
69
−
35
View file @
45d3c05f
...
...
@@ -20,6 +20,7 @@
import
gtk
import
gtk.glade
from
dialogs
import
*
from
common
import
i18n
...
...
@@ -44,7 +45,6 @@ class systrayDummy:
pass
def
__init__
(
self
):
self
.
t
=
gtk
.
Button
()
class
systray
:
"""
Class for icon in the systray
"""
...
...
@@ -85,11 +85,15 @@ class systray:
elif
self
.
plugin
.
roster
.
contacts
[
account
].
has_key
(
jid
):
self
.
plugin
.
roster
.
new_chat
(
self
.
plugin
.
roster
.
contacts
[
account
][
jid
][
0
],
account
)
def
on_new_message_menuitem_activate
(
self
,
widget
,
account
):
"""
When new message menuitem is activated:
call the New_message_dialog class
"""
New_message_dialog
(
self
.
plugin
,
account
)
def
mk_menu
(
self
,
event
):
def
make_menu
(
self
,
event
):
"""
create the browse agents, add contact & join groupchat sub menus
"""
menu
=
gtk
.
Menu
()
item
=
gtk
.
TearoffMenuItem
()
menu
.
append
(
item
)
item
=
gtk
.
MenuItem
(
_
(
"
Status
"
))
menu
.
append
(
item
)
...
...
@@ -115,37 +119,61 @@ class systray:
item
=
gtk
.
MenuItem
(
_
(
"
Offline
"
))
sub_menu
.
append
(
item
)
item
.
connect
(
"
activate
"
,
self
.
set_cb
,
'
offline
'
)
item
=
gtk
.
MenuItem
()
menu
.
append
(
item
)
item
=
gtk
.
MenuItem
(
_
(
"
Chat with
"
))
menu
.
append
(
item
)
menu_account
=
gtk
.
Menu
()
item
.
set_submenu
(
menu_account
)
for
account
in
self
.
plugin
.
accounts
.
keys
():
item
=
gtk
.
MenuItem
(
account
)
menu_account
.
append
(
item
)
menu_group
=
gtk
.
Menu
()
item
.
set_submenu
(
menu_group
)
for
group
in
self
.
plugin
.
roster
.
groups
[
account
].
keys
():
if
group
==
'
Agents
'
:
continue
item
=
gtk
.
MenuItem
(
group
)
menu_group
.
append
(
item
)
menu_user
=
gtk
.
Menu
()
item
.
set_submenu
(
menu_user
)
for
users
in
self
.
plugin
.
roster
.
contacts
[
account
].
values
():
user
=
users
[
0
]
if
group
in
user
.
groups
and
user
.
show
!=
'
offline
'
and
\
user
.
show
!=
'
error
'
:
item
=
gtk
.
MenuItem
(
user
.
name
.
replace
(
'
_
'
,
'
__
'
))
menu_user
.
append
(
item
)
item
.
connect
(
"
activate
"
,
self
.
start_chat
,
account
,
user
.
jid
)
item
=
gtk
.
MenuItem
()
chat_with_menuitem
=
gtk
.
MenuItem
(
_
(
"
Chat with
"
))
menu
.
append
(
chat_with_menuitem
)
new_message_menuitem
=
gtk
.
MenuItem
(
_
(
'
New Message
'
))
menu
.
append
(
new_message_menuitem
)
if
len
(
self
.
plugin
.
accounts
.
keys
())
>
0
:
chat_with_menuitem
.
set_sensitive
(
True
)
new_message_menuitem
.
set_sensitive
(
True
)
else
:
chat_with_menuitem
.
set_sensitive
(
False
)
new_message_menuitem
.
set_sensitive
(
False
)
if
len
(
self
.
plugin
.
accounts
.
keys
())
>=
2
:
# 2 or more accounts? make submenus
menu_account
=
gtk
.
Menu
()
chat_with_menuitem
.
set_submenu
(
menu_account
)
for
account
in
self
.
plugin
.
accounts
.
keys
():
#for chat_with
menu_account
=
gtk
.
Menu
()
chat_with_menuitem
.
set_submenu
(
menu_account
)
for
account
in
self
.
plugin
.
accounts
.
keys
():
item
=
gtk
.
MenuItem
(
'
using
'
+
account
+
'
account
'
)
menu_account
.
append
(
item
)
menu_group
=
gtk
.
Menu
()
item
.
set_submenu
(
menu_group
)
for
group
in
self
.
plugin
.
roster
.
groups
[
account
].
keys
():
if
group
==
'
Agents
'
:
continue
item
=
gtk
.
MenuItem
(
group
)
menu_group
.
append
(
item
)
menu_user
=
gtk
.
Menu
()
item
.
set_submenu
(
menu_user
)
for
users
in
self
.
plugin
.
roster
.
contacts
[
account
].
values
():
user
=
users
[
0
]
if
group
in
user
.
groups
and
user
.
show
!=
'
offline
'
and
\
user
.
show
!=
'
error
'
:
item
=
gtk
.
MenuItem
(
user
.
name
.
replace
(
'
_
'
,
'
__
'
))
menu_user
.
append
(
item
)
item
.
connect
(
"
activate
"
,
self
.
start_chat
,
account
,
\
user
.
jid
)
elif
len
(
self
.
plugin
.
accounts
.
keys
())
==
1
:
# one account
#for chat_with
menu_account
=
gtk
.
Menu
()
chat_with_menuitem
.
set_submenu
(
menu_account
)
if
not
self
.
chat_with_handler_id
:
self
.
chat_with_handler_id
=
chat_with_menuitem
.
connect
(
\
'
activate
'
,
self
.
start_chat
,
self
.
plugin
.
accounts
.
keys
()[
0
])
#for new message
self
.
new_message_handler_id
=
new_message_menuitem
.
connect
(
\
'
activate
'
,
self
.
on_new_message_menuitem_activate
,
account
)
item
=
gtk
.
MenuItem
()
# seperator
menu
.
append
(
item
)
item
=
gtk
.
MenuItem
(
_
(
"
Quit
"
))
menu
.
append
(
item
)
item
.
connect
(
"
activate
"
,
self
.
plugin
.
roster
.
on_quit_menuitem_activate
)
...
...
@@ -178,7 +206,7 @@ class systray:
self
.
plugin
.
roster
.
new_chat
(
self
.
plugin
.
roster
.
contacts
[
account
][
jid
][
0
],
account
)
if
event
.
button
==
3
:
self
.
m
k
_menu
(
event
)
self
.
m
ake
_menu
(
event
)
def
show_icon
(
self
):
if
not
self
.
t
:
...
...
@@ -204,5 +232,11 @@ class systray:
self
.
t
=
None
self
.
img_tray
=
gtk
.
Image
()
self
.
status
=
'
offline
'
self
.
chat_with_handler_id
=
None
self
.
new_message_handler_id
=
None
global
trayicon
import
trayicon
try
:
import
egg.trayicon
as
trayicon
# gnomepythonextras trayicon
except
:
import
trayicon
# yann's trayicon
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