diff --git a/data/iconsets/transports/gadugadu/closed.xpm b/data/iconsets/transports/gadugadu/closed.xpm new file mode 100644 index 000000000..0ae3c97ea --- /dev/null +++ b/data/iconsets/transports/gadugadu/closed.xpm @@ -0,0 +1,13 @@ +/* XPM */ +static char * closed_xpm[] = { +"6 8 2 1", +" c None", +". c #000000", +". ", +".. ", +"... ", +".... ", +"... ", +".. ", +". ", +" "}; diff --git a/data/iconsets/transports/gadugadu/dnd.png b/data/iconsets/transports/gadugadu/dnd.png new file mode 100644 index 000000000..d10d41d80 Binary files /dev/null and b/data/iconsets/transports/gadugadu/dnd.png differ diff --git a/data/iconsets/transports/gadugadu/opened.xpm b/data/iconsets/transports/gadugadu/opened.xpm new file mode 100644 index 000000000..44e9298f6 --- /dev/null +++ b/data/iconsets/transports/gadugadu/opened.xpm @@ -0,0 +1,11 @@ +/* XPM */ +static char * opened_xpm[] = { +"7 6 2 1", +" c None", +". c #000000", +".......", +" ..... ", +" ... ", +" . ", +" ", +" "}; diff --git a/data/iconsets/transports/gadugadu/xa.png b/data/iconsets/transports/gadugadu/xa.png new file mode 100644 index 000000000..d10d41d80 Binary files /dev/null and b/data/iconsets/transports/gadugadu/xa.png differ diff --git a/data/iconsets/transports/icq/closed.xpm b/data/iconsets/transports/icq/closed.xpm new file mode 100644 index 000000000..0ae3c97ea --- /dev/null +++ b/data/iconsets/transports/icq/closed.xpm @@ -0,0 +1,13 @@ +/* XPM */ +static char * closed_xpm[] = { +"6 8 2 1", +" c None", +". c #000000", +". ", +".. ", +"... ", +".... ", +"... ", +".. ", +". ", +" "}; diff --git a/data/iconsets/transports/icq/connecting.png b/data/iconsets/transports/icq/connecting.png new file mode 100644 index 000000000..c432f25fd Binary files /dev/null and b/data/iconsets/transports/icq/connecting.png differ diff --git a/data/iconsets/transports/icq/error.png b/data/iconsets/transports/icq/error.png new file mode 100644 index 000000000..c432f25fd Binary files /dev/null and b/data/iconsets/transports/icq/error.png differ diff --git a/data/iconsets/transports/icq/message.gif b/data/iconsets/transports/icq/message.gif new file mode 100644 index 000000000..fea7551cf Binary files /dev/null and b/data/iconsets/transports/icq/message.gif differ diff --git a/data/iconsets/transports/icq/opened.xpm b/data/iconsets/transports/icq/opened.xpm new file mode 100644 index 000000000..44e9298f6 --- /dev/null +++ b/data/iconsets/transports/icq/opened.xpm @@ -0,0 +1,11 @@ +/* XPM */ +static char * opened_xpm[] = { +"7 6 2 1", +" c None", +". c #000000", +".......", +" ..... ", +" ... ", +" . ", +" ", +" "}; diff --git a/data/iconsets/transports/msn/chat.png b/data/iconsets/transports/msn/chat.png new file mode 100644 index 000000000..676d275c6 Binary files /dev/null and b/data/iconsets/transports/msn/chat.png differ diff --git a/data/iconsets/transports/msn/closed.xpm b/data/iconsets/transports/msn/closed.xpm new file mode 100644 index 000000000..0ae3c97ea --- /dev/null +++ b/data/iconsets/transports/msn/closed.xpm @@ -0,0 +1,13 @@ +/* XPM */ +static char * closed_xpm[] = { +"6 8 2 1", +" c None", +". c #000000", +". ", +".. ", +"... ", +".... ", +"... ", +".. ", +". ", +" "}; diff --git a/data/iconsets/transports/msn/connecting.png b/data/iconsets/transports/msn/connecting.png new file mode 100644 index 000000000..fff3fc906 Binary files /dev/null and b/data/iconsets/transports/msn/connecting.png differ diff --git a/data/iconsets/transports/msn/error.png b/data/iconsets/transports/msn/error.png new file mode 100644 index 000000000..fff3fc906 Binary files /dev/null and b/data/iconsets/transports/msn/error.png differ diff --git a/data/iconsets/transports/msn/invisible.png b/data/iconsets/transports/msn/invisible.png new file mode 100644 index 000000000..fff3fc906 Binary files /dev/null and b/data/iconsets/transports/msn/invisible.png differ diff --git a/data/iconsets/transports/msn/message.gif b/data/iconsets/transports/msn/message.gif new file mode 100644 index 000000000..fea7551cf Binary files /dev/null and b/data/iconsets/transports/msn/message.gif differ diff --git a/data/iconsets/transports/msn/opened.xpm b/data/iconsets/transports/msn/opened.xpm new file mode 100644 index 000000000..44e9298f6 --- /dev/null +++ b/data/iconsets/transports/msn/opened.xpm @@ -0,0 +1,11 @@ +/* XPM */ +static char * opened_xpm[] = { +"7 6 2 1", +" c None", +". c #000000", +".......", +" ..... ", +" ... ", +" . ", +" ", +" "}; diff --git a/data/iconsets/transports/msn/requested.png b/data/iconsets/transports/msn/requested.png new file mode 100644 index 000000000..fff3fc906 Binary files /dev/null and b/data/iconsets/transports/msn/requested.png differ diff --git a/data/iconsets/transports/msn/xa.png b/data/iconsets/transports/msn/xa.png new file mode 100644 index 000000000..d9a615e6e Binary files /dev/null and b/data/iconsets/transports/msn/xa.png differ diff --git a/data/iconsets/transports/yahoo/chat.png b/data/iconsets/transports/yahoo/chat.png new file mode 100644 index 000000000..185c20462 Binary files /dev/null and b/data/iconsets/transports/yahoo/chat.png differ diff --git a/data/iconsets/transports/yahoo/closed.xpm b/data/iconsets/transports/yahoo/closed.xpm new file mode 100644 index 000000000..0ae3c97ea --- /dev/null +++ b/data/iconsets/transports/yahoo/closed.xpm @@ -0,0 +1,13 @@ +/* XPM */ +static char * closed_xpm[] = { +"6 8 2 1", +" c None", +". c #000000", +". ", +".. ", +"... ", +".... ", +"... ", +".. ", +". ", +" "}; diff --git a/data/iconsets/transports/yahoo/connecting.png b/data/iconsets/transports/yahoo/connecting.png new file mode 100644 index 000000000..2fe2c4b79 Binary files /dev/null and b/data/iconsets/transports/yahoo/connecting.png differ diff --git a/data/iconsets/transports/yahoo/error.png b/data/iconsets/transports/yahoo/error.png new file mode 100644 index 000000000..2fe2c4b79 Binary files /dev/null and b/data/iconsets/transports/yahoo/error.png differ diff --git a/data/iconsets/transports/yahoo/invisible.png b/data/iconsets/transports/yahoo/invisible.png new file mode 100644 index 000000000..2fe2c4b79 Binary files /dev/null and b/data/iconsets/transports/yahoo/invisible.png differ diff --git a/data/iconsets/transports/yahoo/message.gif b/data/iconsets/transports/yahoo/message.gif new file mode 100644 index 000000000..fea7551cf Binary files /dev/null and b/data/iconsets/transports/yahoo/message.gif differ diff --git a/data/iconsets/transports/yahoo/opened.xpm b/data/iconsets/transports/yahoo/opened.xpm new file mode 100644 index 000000000..44e9298f6 --- /dev/null +++ b/data/iconsets/transports/yahoo/opened.xpm @@ -0,0 +1,11 @@ +/* XPM */ +static char * opened_xpm[] = { +"7 6 2 1", +" c None", +". c #000000", +".......", +" ..... ", +" ... ", +" . ", +" ", +" "}; diff --git a/data/iconsets/transports/yahoo/requested.png b/data/iconsets/transports/yahoo/requested.png new file mode 100644 index 000000000..2fe2c4b79 Binary files /dev/null and b/data/iconsets/transports/yahoo/requested.png differ diff --git a/data/pixmaps/transport/away.png b/data/pixmaps/transport/away.png deleted file mode 100644 index 88b75b6ca..000000000 Binary files a/data/pixmaps/transport/away.png and /dev/null differ diff --git a/data/pixmaps/transport/dnd.png b/data/pixmaps/transport/dnd.png deleted file mode 100644 index 2366f16c6..000000000 Binary files a/data/pixmaps/transport/dnd.png and /dev/null differ diff --git a/data/pixmaps/transport/icondef.xml b/data/pixmaps/transport/icondef.xml deleted file mode 100644 index cd1b63342..000000000 --- a/data/pixmaps/transport/icondef.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - Stellar-Transport (default) - 1.0 - Default Psi 0.9.3 iconset - 2003-07-17 - http://psi.affinix.com - Jason Kim - Michail Pishchagin (icondef.xml) - - - - status/online - online.png - - - - status/chat - online.png - - - - status/invisible - online.png - - - - status/offline - offline.png - - - - status/away - away.png - - - - status/xa - xa.png - - - - status/dnd - dnd.png - - diff --git a/data/pixmaps/transport/offline.png b/data/pixmaps/transport/offline.png deleted file mode 100644 index 1cf5b53a6..000000000 Binary files a/data/pixmaps/transport/offline.png and /dev/null differ diff --git a/data/pixmaps/transport/online.png b/data/pixmaps/transport/online.png deleted file mode 100644 index 75511dc8f..000000000 Binary files a/data/pixmaps/transport/online.png and /dev/null differ diff --git a/data/pixmaps/transport/xa.png b/data/pixmaps/transport/xa.png deleted file mode 100644 index 53e8cb074..000000000 Binary files a/data/pixmaps/transport/xa.png and /dev/null differ diff --git a/src/gajim.py b/src/gajim.py index 10cab944d..8ca97d42c 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -208,7 +208,7 @@ class Interface: self.roster.to_be_removed[account].append(user1.jid) if user1.jid in self.roster.newly_added[account]: self.roster.newly_added[account].remove(user1.jid) - self.roster.redraw_jid(user1.jid, account) + self.roster.draw_contact(user1.jid, account) if not self.queues[account].has_key(jid): gobject.timeout_add(5000, self.roster.really_remove_user, \ user1, account) @@ -220,7 +220,7 @@ class Interface: #It must be an agent if self.roster.contacts[account].has_key(ji): #Update existing iter - self.roster.redraw_jid(ji, account) + self.roster.draw_contact(ji, account) elif self.roster.contacts[account].has_key(ji): #It isn't an agent self.roster.chg_user_status(user1, array[1], array[2], account) @@ -463,7 +463,7 @@ class Interface: user.ask = array[3] if array[4]: user.groups = array[4] - self.roster.redraw_jid(jid, account) + self.roster.draw_contact(jid, account) def read_sleepy(self): '''Check if we are idle''' diff --git a/src/roster_window.py b/src/roster_window.py index ba4173633..9d8e20135 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -100,7 +100,7 @@ class Roster_window: def remove_newly_added(self, jid, account): if jid in self.newly_added[account]: self.newly_added[account].remove(jid) - self.redraw_jid(jid, account) + self.draw_contact(jid, account) def add_user_to_roster(self, jid, account): '''Add a user to the roster and add groups if they aren't in roster''' @@ -109,7 +109,7 @@ class Roster_window: return users = self.contacts[account][jid] user = users[0] - if user.jid.find('@') <= 0: + if user.jid.find('@') == -1: # if not '@' it's an agent user.groups = ['Agents'] elif user.groups == []: user.groups.append('General') @@ -146,7 +146,7 @@ class Roster_window: if self.groups[account][g]['expand']: self.tree.expand_row(model.get_path(iterG), False) - self.redraw_jid(jid, account) + self.draw_contact(jid, account) def really_remove_user(self, user, account): if user.jid in self.to_be_removed[account]: @@ -173,8 +173,8 @@ class Roster_window: if group_empty: del self.groups[account][group] - def redraw_jid(self, jid, account): - '''draw the correct pixbuf and name''' + def draw_contact(self, jid, account): + '''draw the correct state image and name''' model = self.tree.get_model() iters = self.get_user_iter(jid, account) if len(iters) == 0: @@ -189,19 +189,46 @@ class Roster_window: if u.priority > prio: prio = u.priority user = u + jabber_state_images = self.pixbufs for iter in iters: - if jid.find('@') <= 0: # It's an agent - img = self.pixbufs[user.show] + if jid.find('@aim.') != -1: + state_images = self.transports_state_images['aim'] + elif jid.find('@gadugadu.') != -1: + state_images = self.transports_state_images['gadugadu'] + elif jid.find('@icq.') != -1: + state_images = self.transports_state_images['icq'] + elif jid.find('@msn.') != -1: + state_images = self.transports_state_images['msn'] + elif jid.find('@yahoo.') != -1: + state_images = self.transports_state_images['yahoo'] + else: + state_images = jabber_state_images + + if jid.find('@') == -1: # if not '@' it's an agent + if name.find('aim.') != -1: + state_images = self.transports_state_images['aim'] + elif name.find('gadugadu.') != -1: + state_images = self.transports_state_images['gadugadu'] + elif name.find('icq.') != -1: + state_images = self.transports_state_images['icq'] + elif name.find('msn.') != -1: + state_images = self.transports_state_images['msn'] + elif name.find('yahoo.') != -1: + state_images = self.transports_state_images['yahoo'] + else: + state_images = jabber_state_images + + img = state_images[user.show] elif self.plugin.queues[account].has_key(jid): - img = self.pixbufs['message'] + img = state_images['message'] else: if user.sub != 'both': if user.ask == 'subscribe': - img = self.pixbufs['requested'] + img = state_images['requested'] else: - img = self.pixbufs['not in the roster'] + img = state_images['not in the roster'] else: - img = self.pixbufs[user.show] + img = state_images[user.show] model.set_value(iter, 0, img) model.set_value(iter, 1, name) @@ -368,15 +395,15 @@ class Roster_window: not self.plugin.queues[account].has_key(user.jid): if len(luser) > 1: luser.remove(user) - self.redraw_jid(user.jid, account) + self.draw_contact(user.jid, account) elif not showOffline: self.remove_user(user, account) else: - self.redraw_jid(user.jid, account) + self.draw_contact(user.jid, account) else: if not self.get_user_iter(user.jid, account): self.add_user_to_roster(user.jid, account) - self.redraw_jid(user.jid, account) + self.draw_contact(user.jid, account) #Print status in chat window if self.plugin.windows[account]['chats'].has_key(user.jid): self.plugin.windows[account]['chats'][user.jid].set_image(user.jid) @@ -877,7 +904,7 @@ class Roster_window: if not self.plugin.queues[account].has_key(jid): model = self.tree.get_model() self.plugin.queues[account][jid] = Queue.Queue(50) - self.redraw_jid(jid, account) + self.draw_contact(jid, account) if self.plugin.systray_enabled: self.plugin.systray.add_jid(jid, account) self.plugin.queues[account][jid].put((msg, tim)) @@ -1102,7 +1129,7 @@ class Roster_window: for u in self.contacts[account][jid]: u.name = new_text gajim.connections[account].update_user(jid, new_text, u.groups) - self.redraw_jid(jid, account) + self.draw_contact(jid, account) elif type == 'group': old_name = model.get_value(iter, 1) #get all users in that group @@ -1153,14 +1180,18 @@ class Roster_window: image.set_from_file(file) break - def init_transports_pixbufs(self, arg, dirname, fnames): + def init_transports_state_images(self, dirname, fnames): name_only = os.path.basename(dirname) - if name_only == 'transports' or name_only == '.svn': - return - for fname in fnames: - transport_kind = name_only - return - self.transports_pixbufs[transport_kind][fname] = 'be' + for fname in fnames: # fname is abs + if fname == '.svn': + continue + state = unicode(fname[:-4]) # without extension + state = state.replace('_', ' ') # make '_' a space for dict key + path_to_fname = os.path.join(dirname, fname) + image = gtk.Image() + image.set_from_file(path_to_fname) + image.show() + self.transports_state_images[name_only][state] = image def reload_pixbufs(self): self.mkpixbufs() @@ -1387,8 +1418,16 @@ class Roster_window: model.set_sort_column_id(1, gtk.SORT_ASCENDING) self.tree.set_model(model) self.mkpixbufs() - self.transports_pixbufs = { 'aim': {}, 'gadugadu': {}, 'icq': {}, 'msn': {}, 'yahoo': {} } - os.path.walk('../data/iconsets/transports', self.init_transports_pixbufs, None) # arg is None + self.transports_state_images = { 'aim': {}, 'gadugadu': {}, 'icq': {}, 'msn': {}, 'yahoo': {} } + + path = '../data/iconsets/transports' + folders = os.listdir('../data/iconsets/transports') + for folder in folders: + if folder == '.svn': + continue + folder = os.path.join(path, folder) + image_files = os.listdir(folder) + self.init_transports_state_images(folder, image_files) liststore = gtk.ListStore(gobject.TYPE_STRING, gtk.Image, gobject.TYPE_STRING) diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index 0cd5907d2..60790c255 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -211,7 +211,7 @@ class Tabbed_chat_window(chat.Chat): self.plugin.roster.nb_unread -= 1 self.plugin.roster.show_title() del self.plugin.queues[self.account][jid] - self.plugin.roster.redraw_jid(jid, self.account) + self.plugin.roster.draw_contact(jid, self.account) if self.plugin.systray_enabled: self.plugin.systray.remove_jid(jid, self.account) showOffline = gajim.config.get('showoffline')