Ticket #2378: gajim-icontheme2.patch
| File gajim-icontheme2.patch, 16.3 kB (added by jim++, 2 years ago) |
|---|
-
src/history_manager.py
56 56 57 57 class HistoryManager: 58 58 def __init__(self): 59 path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png')59 path_to_file = gtkgui_helpers.get_icon_path('gajim') 60 60 pix = gtk.gdk.pixbuf_new_from_file(path_to_file) 61 61 gtk.window_set_default_icon(pix) # set the icon to all newly opened windows 62 62 -
src/roster_window.py
1462 1462 1463 1463 if not our_jid: 1464 1464 # add a special img for rename menuitem 1465 path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', 1466 'kbd_input.png') 1465 path_to_kbd_input_img = gtkgui_helpers.get_icon_path('gajim-kbd_input') 1467 1466 img = gtk.Image() 1468 1467 img.set_from_file(path_to_kbd_input_img) 1469 1468 rename_menuitem.set_image(img) … … 1581 1580 1582 1581 if not our_jid: 1583 1582 # add a special img for rename menuitem 1584 path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', 1585 'kbd_input.png') 1583 path_to_kbd_input_img = gtkgui_helpers.get_icon_path('gajim-kbd_input') 1586 1584 img = gtk.Image() 1587 1585 img.set_from_file(path_to_kbd_input_img) 1588 1586 rename_menuitem.set_image(img) … … 1874 1872 1875 1873 rename_item = gtk.ImageMenuItem(_('Re_name')) 1876 1874 # add a special img for rename menuitem 1877 path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', 1878 'kbd_input.png') 1875 path_to_kbd_input_img = gtkgui_helpers.get_icon_path('gajim-kbd_input') 1879 1876 img = gtk.Image() 1880 1877 img.set_from_file(path_to_kbd_input_img) 1881 1878 rename_item.set_image(img) … … 1935 1932 1936 1933 item = gtk.ImageMenuItem(_('_Rename')) 1937 1934 # add a special img for rename menuitem 1938 path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', 1939 'kbd_input.png') 1935 path_to_kbd_input_img = gtkgui_helpers.get_icon_path('gajim-kbd_input') 1940 1936 img = gtk.Image() 1941 1937 img.set_from_file(path_to_kbd_input_img) 1942 1938 item.set_image(img) … … 2021 2017 sub_menu.append(item) 2022 2018 2023 2019 item = gtk.ImageMenuItem(_('_Change Status Message')) 2024 path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png')2020 path = gtkgui_helpers.get_icon_path('gajim-kbd_input') 2025 2021 img = gtk.Image() 2026 2022 img.set_from_file(path) 2027 2023 item.set_image(img) … … 2083 2079 sub_menu.append(item) 2084 2080 2085 2081 item = gtk.ImageMenuItem(_('_Change Status Message')) 2086 path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png')2082 path = gtkgui_helpers.get_icon_path('gajim-kbd_input') 2087 2083 img = gtk.Image() 2088 2084 img.set_from_file(path) 2089 2085 item.set_image(img) … … 4085 4081 # Add a Separator (self.iter_is_separator() checks on string SEPARATOR) 4086 4082 liststore.append(['SEPARATOR', None, '', True]) 4087 4083 4088 path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png')4084 path = gtkgui_helpers.get_icon_path('gajim-kbd_input') 4089 4085 img = gtk.Image() 4090 4086 img.set_from_file(path) 4091 4087 # sensitivity to False because by default we're offline -
src/config.py
3025 3025 self.go_online_checkbutton.show() 3026 3026 self.show_vcard_checkbutton.show() 3027 3027 img = self.xml.get_widget('finish_image') 3028 path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'gajim.png')3028 path_to_file = gtkgui_helpers.get_icon_path('gajim.png', 48) 3029 3029 img.set_from_file(path_to_file) 3030 3030 3031 3031 finish_text = '<big><b>%s</b></big>\n\n%s' % ( -
src/notify.py
201 201 if status_message: 202 202 text = text + " : " + status_message 203 203 popup(_('Contact Changed Status'), jid, account, 204 path_to_image = path, title = title, text = text)204 image = path, title = title, text = text) 205 205 elif event == 'contact_connected': 206 206 title = _('%(nickname)s Signed In') % \ 207 207 {'nickname': gajim.get_name_from_jid(account, jid)} … … 209 209 if status_message: 210 210 text = status_message 211 211 popup(_('Contact Signed In'), jid, account, 212 path_to_image = path, title = title, text = text)212 image = path, title = title, text = text) 213 213 elif event == 'contact_disconnected': 214 214 title = _('%(nickname)s Signed Out') % \ 215 215 {'nickname': gajim.get_name_from_jid(account, jid)} … … 217 217 if status_message: 218 218 text = status_message 219 219 popup(_('Contact Signed Out'), jid, account, 220 path_to_image = path, title = title, text = text)220 image = path, title = title, text = text) 221 221 elif event == 'new_message': 222 222 if message_type == 'normal': # single message 223 223 event_type = _('New Single Message') 224 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 225 'single_msg_recv.png') 224 img = 'gajim-single_msg_recv' 226 225 title = _('New Single Message from %(nickname)s') % \ 227 226 {'nickname': nickname} 228 227 text = message 229 228 elif message_type == 'pm': # private message 230 229 event_type = _('New Private Message') 231 230 room_name = gajim.get_nick_from_jid(jid) 232 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 233 'priv_msg_recv.png') 231 img = 'gajim-priv_msg_recv' 234 232 title = _('New Private Message from group chat %s') % room_name 235 233 text = _('%(nickname)s: %(message)s') % {'nickname': nickname, 236 234 'message': message} 237 235 else: # chat message 238 236 event_type = _('New Message') 239 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 240 'chat_msg_recv.png') 237 img = 'gajim-chat_msg_recv.png' 241 238 title = _('New Message from %(nickname)s') % \ 242 239 {'nickname': nickname} 243 240 text = message 244 path = gtkgui_helpers.get_path_to_generic_or_avatar(img)245 241 popup(event_type, jid, account, message_type, 246 path_to_image = path, title = title, text = text)242 image = img, title = title, text = text) 247 243 248 244 if do_sound: 249 245 snd_file = None … … 275 271 except: 276 272 pass 277 273 278 def popup(event_type, jid, account, msg_type = '', path_to_image = None,274 def popup(event_type, jid, account, msg_type = '', image = None, 279 275 title = None, text = None): 280 276 '''Notifies a user of an event. It first tries to a valid implementation of 281 277 the Desktop Notification Specification. If that fails, then we fall back to … … 286 282 if gajim.config.get('use_notif_daemon') and dbus_support.supported: 287 283 try: 288 284 DesktopNotification(event_type, jid, account, msg_type, 289 path_to_image, title, text)285 image, title, text) 290 286 return # sucessfully did D-Bus Notification procedure! 291 287 except dbus.dbus_bindings.DBusException, e: 292 288 # Connection to D-Bus failed … … 301 297 if not title: 302 298 title = event_type 303 299 # default image 304 if not path_to_image:305 path_to_image = os.path.abspath(306 os.path.join(gajim.DATA_DIR, 'pixmaps', 'events',307 'chat_msg_recv.png')) # img to display300 if not image: 301 path_to_image = gtkgui_helpers.get_icon_path('gajim-chat_msg_recv', 48) # img to display 302 else: 303 path_to_image = gtkgui_helpers.get_icon_path(image, 48) 308 304 309 305 310 306 notification = pynotify.Notification(title, text) … … 433 429 ntype = 'connection.failed' 434 430 else: 435 431 # default failsafe values 436 self.path_to_image = os.path.abspath( 437 os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 438 'chat_msg_recv.png')) # img to display 432 self.path_to_image = gtkgui_helpers.get_icon_path('gajim-chat_msg_recv', 48) # img to display 439 433 ntype = 'im' # Notification Type 440 434 441 435 self.notif = dbus_support.get_notifications_interface() -
src/systray.py
140 140 sub_menu.append(item) 141 141 142 142 item = gtk.ImageMenuItem(_('_Change Status Message...')) 143 path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png')143 path = gtkgui_helpers.get_icon_path('gajim-kbd_input') 144 144 img = gtk.Image() 145 145 img.set_from_file(path) 146 146 item.set_image(img) -
src/dialogs.py
767 767 if gtk.pygtk_version >= (2, 8, 0) and gtk.gtk_version >= (2, 8, 0): 768 768 dlg.props.wrap_license = True 769 769 770 pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join( 771 gajim.DATA_DIR, 'pixmaps', 'gajim_about.png')) 770 pixbuf = gtkgui_helpers.get_icon_pixmap('gajim-about', 64) 772 771 773 772 dlg.set_logo(pixbuf) 774 773 #here you write your name in the form Name FamilyName <someone@somewhere> … … 1342 1341 1343 1342 # default image 1344 1343 if not path_to_image: 1345 path_to_image = os.path.abspath( 1346 os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 1347 'chat_msg_recv.png')) # img to display 1344 path_to_image = gtkgui_helpers.get_icon_path('chat_msg_recv.png', 48) # img to display 1348 1345 1349 1346 if event_type == _('Contact Signed In'): 1350 1347 bg_color = 'limegreen' -
src/gajim.py
150 150 pid_filename += '.pid' 151 151 import dialogs 152 152 if os.path.exists(pid_filename): 153 path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png') 154 pix = gtk.gdk.pixbuf_new_from_file(path_to_file) 153 pix = gtkgui_helpers.get_icon_pixmap('gajim') 155 154 gtk.window_set_default_icon(pix) # set the icon to all newly opened wind 156 155 pritext = _('Gajim is already running') 157 156 sectext = _('Another instance of Gajim seems to be running\nRun anyway?') … … 298 297 299 298 def handle_event_connection_lost(self, account, array): 300 299 # ('CONNECTION_LOST', account, [title, text]) 301 path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 302 'connection_lost.png') 303 path = gtkgui_helpers.get_path_to_generic_or_avatar(path) 300 image = gtkgui_helpers.get_icon_path('gajim-connection_lost', 48) 304 301 notify.popup(_('Connection Failed'), account, account, 305 'connection_failed', path, array[0], array[1])302 'connection_failed', image, array[0], array[1]) 306 303 307 304 def unblock_signed_in_notifications(self, account): 308 305 gajim.block_signed_in_notifications[account] = False … … 973 970 array[3])) 974 971 975 972 if helpers.allow_showing_notification(account): 976 path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 977 'gc_invitation.png') 978 path = gtkgui_helpers.get_path_to_generic_or_avatar(path) 973 path = gtkgui_helpers.get_icon_path('gajim-gc_invitation.png', 48) 979 974 event_type = _('Groupchat Invitation') 980 975 notify.popup(event_type, jid, account, 'gc-invitation', path, 981 976 event_type, room_jid) … … 1076 1071 self.add_event(account, jid, 'file-send-error', file_props) 1077 1072 1078 1073 if helpers.allow_showing_notification(account): 1079 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 'ft_error.png') 1080 path = gtkgui_helpers.get_path_to_generic_or_avatar(img) 1074 img = gtkhui_helpers.get_icon_path('gajim-ft_error', 48) 1081 1075 event_type = _('File Transfer Error') 1082 notify.popup(event_type, jid, account, 'file-send-error', path,1076 notify.popup(event_type, jid, account, 'file-send-error', img, 1083 1077 event_type, file_props['name']) 1084 1078 1085 1079 def handle_event_gmail_notify(self, account, array): … … 1087 1081 gmail_new_messages = int(array[1]) 1088 1082 gmail_messages_list = array[2] 1089 1083 if gajim.config.get('notify_on_new_gmail_email'): 1090 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 1091 'new_email_recv.png') 1084 img = gtkgui_helpers.get_image_path('gajim-new_email_recv', 48) 1092 1085 title = _('New mail on %(gmail_mail_address)s') % \ 1093 1086 {'gmail_mail_address': jid} 1094 1087 text = i18n.ngettext('You have %d new mail conversation', … … 1103 1096 text += _('\nFrom: %(from_address)s') % \ 1104 1097 {'from_address': gmessage['From']} 1105 1098 1106 path = gtkgui_helpers.get_path_to_generic_or_avatar(img)1107 1099 notify.popup(_('New E-mail'), jid, account, 'gmail', 1108 path_to_image = path, title = title, text = text)1100 image = img, title = title, text = text) 1109 1101 1110 1102 if self.remote_ctrl: 1111 1103 self.remote_ctrl.raise_signal('NewGmail', (account, array)) … … 1218 1210 1219 1211 if helpers.allow_showing_notification(account): 1220 1212 # check if we should be notified 1221 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 'ft_error.png') 1222 1223 path = gtkgui_helpers.get_path_to_generic_or_avatar(img) 1213 img = gtkgui_helpers.get_icon_path('gajim-ft_error', 48) 1224 1214 event_type = _('File Transfer Error') 1225 notify.popup(event_type, jid, account, msg_type, path,1215 notify.popup(event_type, jid, account, msg_type, img, 1226 1216 title = event_type, text = file_props['name']) 1227 1217 1228 1218 def handle_event_file_request(self, account, array): … … 1240 1230 self.add_event(account, jid, 'file-request', file_props) 1241 1231 1242 1232 if helpers.allow_showing_notification(account): 1243 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 1244 'ft_request.png') 1233 img = gtkgui_helpers.get_icon_path('gajim-ft_request', 48) 1245 1234 txt = _('%s wants to send you a file.') % gajim.get_name_from_jid( 1246 1235 account, jid) 1247 path = gtkgui_helpers.get_path_to_generic_or_avatar(img)1248 1236 event_type = _('File Transfer Request') 1249 1237 notify.popup(event_type, jid, account, 'file-request', 1250 path_to_image = path, title = event_type, text = txt)1238 image = img, title = event_type, text = txt) 1251 1239 1252 1240 def handle_event_file_progress(self, account, file_props): 1253 1241 self.instances['file_transfers'].set_progress(file_props['type'], … … 1306 1294 if event_type == _('File Transfer Completed'): 1307 1295 txt = _('You successfully received %(filename)s from %(name)s.')\ 1308 1296 % {'filename': filename, 'name': name} 1309 img = ' ft_done.png'1297 img = 'gajim-ft_done' 1310 1298 else: # ft stopped 1311 1299 txt = _('File transfer of %(filename)s from %(name)s stopped.')\ 1312 1300 % {'filename': filename, 'name': name} 1313 img = ' ft_stopped.png'1301 img = 'gajim-ft_stopped' 1314 1302 else: 1315 1303 receiver = file_props['receiver'] 1316 1304 if hasattr(receiver, 'jid'): … … 1323 1311 if event_type == _('File Transfer Completed'): 1324 1312 txt = _('You successfully sent %(filename)s to %(name)s.')\ 1325 1313 % {'filename': filename, 'name': name} 1326 img = ' ft_done.png'1314 img = 'gajim-ft_done' 1327 1315 else: # ft stopped 1328 1316 txt = _('File transfer of %(filename)s to %(name)s stopped.')\ 1329 1317 % {'filename': filename, 'name': name} 1330 img = 'ft_stopped.png' 1331 img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img) 1332 path = gtkgui_helpers.get_path_to_generic_or_avatar(img) 1318 img = 'gajim-ft_stopped' 1319 img = gtkgui_helpers.get_icon_path(img, 48) 1333 1320 else: 1334 1321 txt = '' 1335 1322 … … 1338 1325 gajim.connections[account].connected in (2, 3)): 1339 1326 # we want to be notified and we are online/chat or we don't mind 1340 1327 # bugged when away/na/busy 1341 notify.popup(event_type, jid, account, msg_type, path_to_image = path,1328 notify.popup(event_type, jid, account, msg_type, image = img, 1342 1329 title = event_type, text = txt) 1343 1330 1344 1331 def handle_event_stanza_arrived(self, account, stanza): … … 1954 1941 1955 1942 self.show_vcard_when_connect = [] 1956 1943 1957 p ath_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png')1958 p ix = gtk.gdk.pixbuf_new_from_file(path_to_file)1944 pix = gtkgui_helpers.get_icon_pixmap('gajim') 1945 path_to_file = gtkgui_helpers.get_icon_path('gajim') 1959 1946 gtk.window_set_default_icon(pix) # set the icon to all newly opened windows 1960 1947 self.roster.window.set_icon_from_file(path_to_file) # and to roster window 1961 1948 self.sleeper = common.sleepy.Sleepy( -
src/gtkgui_helpers.py
48 48 screen_w = gtk.gdk.screen_width() 49 49 screen_h = gtk.gdk.screen_height() 50 50 51 gtk_icon_theme = gtk.icon_theme_get_default() 52 53 def get_icon_pixmap(icon_name, size = 16): 54 try: 55 return gtk_icon_theme.load_icon(icon_name, size, 0) 56 except gobject.GError, e: 57 print ("Unable to load icon %s" % icon_name), e 58 59 def get_icon_path(icon_name, size = 16): 60 try: 61 icon_info = gtk_icon_theme.lookup_icon(icon_name, size, 0) 62 if icon_info == None: 63 print "Icon not found: %s" % icon_name 64 return "" 65 else: 66 return icon_info.get_filename() 67 except gobject.GError, e: 68 print ("Unable to find icon %s" % icon_name), e 69 51 70 GLADE_DIR = os.path.join('..', 'data', 'glade') 52 71 def get_glade(file_name, root = None): 53 72 file_path = os.path.join(GLADE_DIR, file_name)
