Changeset 172

Show
Ignore:
Timestamp:
06/09/04 16:22:27 (4 years ago)
Author:
asterix
Message:

icon in systray (it represents state and changes when we recieve a message not poped up)

Location:
trunk
Files:
6 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/common/i18n.py

    • Property svn:executable deleted
  • trunk/Makefile

    r159 r172  
     1MODULES = common plugins/gtkgui 
     2 
    13all: 
    2         python setup.py build_ext -i 
    3         mv idle.so common/ 
    44        msgfmt Messages/fr/LC_MESSAGES/gajim.po -o Messages/fr/LC_MESSAGES/gajim.mo 
     5        for dir in ${MODULES}; do \ 
     6          (cd $$dir; make all); \ 
     7        done 
     8 
     9clean: 
     10        find -name *.pyc -exec rm {} \; 
     11        for dir in ${MODULES}; do \ 
     12          (cd $$dir; make clean); \ 
     13        done 
  • trunk/plugins/gtkgui/gtkgui.glade

    r169 r172  
    33 
    44<glade-interface> 
    5 <requires lib="gnome"/> 
    65 
    76<widget class="GtkWindow" id="Gajim"> 
     
    1110  <property name="window_position">GTK_WIN_POS_NONE</property> 
    1211  <property name="modal">False</property> 
    13   <property name="default_width">100</property> 
    14   <property name="default_height">300</property> 
     12  <property name="default_width">150</property> 
     13  <property name="default_height">400</property> 
    1514  <property name="resizable">True</property> 
    1615  <property name="destroy_with_parent">False</property> 
     
    40634062                  <property name="editable">True</property> 
    40644063                  <property name="overwrite">False</property> 
    4065                   <property name="accepts_tab">True</property> 
     4064                  <property name="accepts_tab">False</property> 
    40664065                  <property name="justification">GTK_JUSTIFY_LEFT</property> 
    40674066                  <property name="wrap_mode">GTK_WRAP_WORD</property> 
  • trunk/plugins/gtkgui/gtkgui.py

    r169 r172  
    2222import gtk 
    2323from gtk import TRUE, FALSE 
     24import trayicon 
    2425import gtk.glade,gobject 
    2526import os,string,time,Queue 
     
    103104                                self.plugin.roster.tree.get_model().set_value(i, 0, \ 
    104105                                        self.plugin.roster.pixbufs[self.user.show]) 
     106                self.plugin.set_systray() 
    105107 
    106108        def on_msg_key_press_event(self, widget, event): 
     
    840842                #table to change index in plugin.connected to index in optionmenu 
    841843                table = {0:6, 1:0, 2:1, 3:2, 4:3, 5:4} 
    842                 mini = min(self.plugin.connected.values()) 
     844                maxi = max(self.plugin.connected.values()) 
    843845                optionmenu = self.xml.get_widget('optionmenu') 
    844846                #temporarily block signal in order not to send status that we show 
    845847                #in the optionmenu 
    846848                optionmenu.handler_block(self.id_signal_optionmenu) 
    847                 optionmenu.set_history(table[mini]) 
     849                optionmenu.set_history(table[maxi]) 
    848850                optionmenu.handler_unblock(self.id_signal_optionmenu) 
     851                statuss = ['offline', 'online', 'away', 'xa', 'dnd', 'invisible'] 
     852                self.plugin.set_systray(statuss[maxi]) 
    849853 
    850854        def on_status_changed(self, account, status): 
     
    892896                                for i in self.get_user_iter(jid, account): 
    893897                                        model.set_value(i, 0, self.pixbufs['message']) 
     898                                self.plugin.set_systray('message') 
    894899                        tim = time.strftime("[%H:%M:%S]") 
    895900                        self.plugin.queues[account][jid].put((msg, tim)) 
     
    14031408                return 1 
    14041409 
     1410        def set_systray_img(self, status): 
     1411                if not self.roster.pixbufs.has_key(status): 
     1412                        return 
     1413                pix = self.roster.pixbufs[status] 
     1414                if isinstance(pix, gtk.gdk.PixbufAnimation): 
     1415                        self.img_tray.set_from_animation(pix) 
     1416                else: 
     1417                        self.img_tray.set_from_pixbuf(pix) 
     1418 
     1419        def set_systray(self, status=None): 
     1420                if not status: 
     1421                        self.nb_msg -= 1 
     1422                        if self.nb_msg == 0: 
     1423                                self.set_systray_img(self.status) 
     1424                elif status == 'message': 
     1425                        self.nb_msg += 1 
     1426                        self.set_systray_img('message') 
     1427                else: 
     1428                        self.status = status 
     1429                        self.set_systray_img(status) 
     1430 
    14051431        def __init__(self, quIN, quOUT): 
    14061432                gtk.threads_init() 
     
    14211447                self.send('ASK_CONFIG', None, ('GtkGui', 'accounts')) 
    14221448                self.accounts = self.wait('CONFIG') 
     1449                self.nb_msg = 0 
    14231450                self.windows = {'logs':{}} 
    14241451                self.queues = {} 
     
    14411468                gtk.timeout_add(1000, self.read_sleepy) 
    14421469                self.sleeper = None 
     1470                t = trayicon.TrayIcon("Gajim") 
     1471                tip = gtk.Tooltips() 
     1472                tip.set_tip(t, 'Gajim') 
     1473                self.img_tray = gtk.Image() 
     1474                t.add(self.img_tray) 
     1475                t.show_all() 
     1476                self.set_systray('offline') 
    14431477                gtk.main() 
    14441478                gtk.threads_leave()