@@ -59,13 +59,13 @@ except:
59
59
pyotr_logging = False
60
60
61
61
62
- gtk_available = False
62
+ gtk_enabled = False
63
63
try :
64
64
from gtk import StatusIcon
65
65
import gtk
66
- gtk_available = True
66
+ gtk_enabled = True
67
67
except:
68
- gtk_available = False
68
+ gtk_enabled = False
69
69
#}}}
70
70
71
71
#{{{ VimChatScope
@@ -77,6 +77,7 @@ class VimChatScope:
77
77
otr_fingerprints = ' fingerprints'
78
78
buddyListBuffer = None
79
79
rosterFile = ' /tmp/vimChatRoster'
80
+ statusIcon = None
80
81
81
82
#{{{ init
82
83
def init (self ):
@@ -111,14 +112,15 @@ class VimChatScope:
111
112
pyotr_enabled = False
112
113
pyotr_logging = False
113
114
114
- # GTK StausIcon
115
- #self .status_icon = StatusIcon ()
116
- #self .status_icon.set_from_stock (gtk.STOCK_HOME)
117
- #self .status_icon.set_tooltip (" VimChat" )
118
- #self .status_icon.set_visible (True)
119
- #gtk.main ()
120
-
115
+ isStatusIcon = int (vim .eval (' g:vimchat_statusicon' ))
116
+ if isStatusIcon == 1 :
117
+ gtk_enabled = True
118
+ else :
119
+ gtk_enabled = False
121
120
121
+ if gtk_enabled:
122
+ self .statusIcon = self .StatusIcon ()
123
+ self .statusIcon.start ()
122
124
123
125
#Get JID's /Passwords
124
126
vimChatAccounts = vim .eval (' g:vimchat_accounts' )
@@ -687,6 +689,20 @@ class VimChatScope:
687
689
return False
688
690
#}}}
689
691
#}}}
692
+ #{{{ class StatusIcon
693
+ class StatusIcon (threading.Thread):
694
+ def run (self ):
695
+ # GTK StausIcon
696
+ gtk.gdk.threads_init ()
697
+ self .status_icon = StatusIcon ()
698
+ self .status_icon.set_from_file (os.path .expanduser (
699
+ ' ~/.vimchat/icon.gif' ))
700
+ self .status_icon.set_tooltip (" VimChat" )
701
+ self .status_icon.set_visible (True)
702
+ gtk.main ()
703
+ def blink (self , value):
704
+ self .status_icon.set_blinking (value)
705
+ #}}}
690
706
691
707
#CONNECTION FUNCTIONS
692
708
#{{{ signOn
@@ -973,7 +989,7 @@ class VimChatScope:
973
989
nnoremap <buffer> <silent> <Leader> ov :py VimChat.otrVerifyBuddy()<CR>
974
990
nnoremap <buffer> <silent> <Leader> or :py VimChat.otrSmpRespond()<CR>
975
991
nnoremap <buffer> <silent> <Leader> c :py VimChat.openGroupChat()<CR>
976
- au CursorMoved <buffer> set tabline &
992
+ au CursorMoved <buffer> exe ' py VimChat.clearNotify() '
977
993
" ""
978
994
vim .command (commands)
979
995
#}}}
@@ -1130,8 +1146,16 @@ class VimChatScope:
1130
1146
n = pynotify.Notification (title , msg, type )
1131
1147
n .set_timeout (10000 )
1132
1148
n .show ()
1133
- #}}}
1134
1149
1150
+ if gtk_enabled:
1151
+ self .statusIcon.blink (True)
1152
+ #}}}
1153
+ #{{{
1154
+ def clearNotify (self ):
1155
+ if gtk_enabled:
1156
+ self .statusIcon.blink (False)
1157
+ vim .command (' au CursorMoved <buffer> set tabline&' )
1158
+ #}}}
1135
1159
#LOGGING
1136
1160
#{{{ log
1137
1161
def log (self , account, user , msg):
0 commit comments