From 4d0005a9ab310ec9a5019819aab96490ef1d69a8 Mon Sep 17 00:00:00 2001 From: Denis Fomin <fominde@gmail.com> Date: Wed, 28 Aug 2013 18:33:27 +0400 Subject: [PATCH] Replacing some of the icons. Fixes #7445 --- src/chat_control.py | 7 ++++--- src/conversation_textview.py | 19 ++++++++++++++----- src/groupchat_control.py | 7 ++++--- src/gtkgui_helpers.py | 5 +++-- src/gui_interface.py | 7 +++++-- src/gui_menu_builder.py | 7 ++++--- 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index b1dde4ac55..d9690cecf5 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1496,9 +1496,10 @@ class ChatControl(ChatControlBase): self._send_file_button = self.xml.get_object('send_file_button') # add a special img for send file button - path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload') - img = gtk.Image() - img.set_from_file(path_to_upload_img) + pixbuf = gtkgui_helpers.get_icon_pixmap('document-send', quiet=True) + if not pixbuf: + pixbuf = gtkgui_helpers.get_icon_pixmap('gajim-upload') + img = gtk.image_new_from_pixbuf(pixbuf) self._send_file_button.set_image(img) id_ = self._send_file_button.connect('clicked', self._on_send_file_menuitem_activate) diff --git a/src/conversation_textview.py b/src/conversation_textview.py index 419450bbd0..50d041d30d 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -171,12 +171,21 @@ class ConversationTextview(gobject.GObject): FOCUS_OUT_LINE_PIXBUF = gtkgui_helpers.get_icon_pixmap( 'gajim-muc_separator') - XEP0184_WARNING_PIXBUF = gtkgui_helpers.get_icon_pixmap( - 'gajim-receipt_missing') - XEP0184_RECEIVED_PIXBUF = gtkgui_helpers.get_icon_pixmap( - 'gajim-receipt_received') + XEP0184_WARNING_PIXBUF = gtkgui_helpers.get_icon_pixmap('gtk-no', + quiet=True) + if not XEP0184_WARNING_PIXBUF: + MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap( + 'gajim-receipt_missing') + XEP0184_RECEIVED_PIXBUF = gtkgui_helpers.get_icon_pixmap('gtk-yes', + quiet=True) + if not XEP0184_RECEIVED_PIXBUF: + MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap( + 'gajim-receipt_received') MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap( - 'gajim-message_corrected') + 'gtk-spell-check', quiet=True) + if not MESSAGE_CORRECTED_PIXBUF: + MESSAGE_CORRECTED_PIXBUF = gtkgui_helpers.get_icon_pixmap( + 'gajim-message_corrected') # smooth scroll constants MAX_SCROLL_TIME = 0.4 # seconds diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 6381f7caf7..69af7ebf50 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -2540,9 +2540,10 @@ class GroupchatControl(ChatControlBase): item = xml.get_object('send_file_menuitem') # add a special img for send file menuitem - path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload') - img = gtk.Image() - img.set_from_file(path_to_upload_img) + pixbuf = gtkgui_helpers.get_icon_pixmap('document-send', quiet=True) + if not pixbuf: + pixbuf = gtkgui_helpers.get_icon_pixmap('gajim-upload') + img = gtk.image_new_from_pixbuf(pixbuf) item.set_image(img) if not c.resource: diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index abb1764031..17b9f34be0 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -44,11 +44,12 @@ from common import gajim gtk_icon_theme = gtk.icon_theme_get_default() gtk_icon_theme.append_search_path(gajim.ICONS_DIR) -def get_icon_pixmap(icon_name, size=16): +def get_icon_pixmap(icon_name, size=16, quiet=False): try: return gtk_icon_theme.load_icon(icon_name, size, 0) except gobject.GError, e: - log.error('Unable to load icon %s: %s' % (icon_name, str(e))) + if not quiet: + log.error('Unable to load icon %s: %s' % (icon_name, str(e))) def get_icon_path(icon_name, size=16): try: diff --git a/src/gui_interface.py b/src/gui_interface.py index 1a7658e5cc..81e4e40078 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -2629,8 +2629,11 @@ class Interface: else: return gtkgui_helpers.load_activity_icon('unknown').get_pixbuf() elif isinstance(pep_obj, pep.UserLocationPEP): - path = gtkgui_helpers.get_icon_path('gajim-earth') - return gtk.gdk.pixbuf_new_from_file(path) + icon = gtkgui_helpers.get_icon_pixmap('applications-internet', + quiet=True) + if not icon: + icon = gtkgui_helpers.get_icon_pixmap('gajim-earth') + return icon def create_ipython_window(self): try: diff --git a/src/gui_menu_builder.py b/src/gui_menu_builder.py index 9616f43198..caf2a03f26 100644 --- a/src/gui_menu_builder.py +++ b/src/gui_menu_builder.py @@ -205,9 +205,10 @@ control=None, gc_contact=None, is_anonymous=True): items_to_hide = [] # add a special img for send file menuitem - path_to_upload_img = gtkgui_helpers.get_icon_path('gajim-upload') - img = gtk.Image() - img.set_from_file(path_to_upload_img) + pixbuf = gtkgui_helpers.get_icon_pixmap('document-send', quiet=True) + if not pixbuf: + pixbuf = gtkgui_helpers.get_icon_pixmap('gajim-upload') + img = gtk.image_new_from_pixbuf(pixbuf) send_file_menuitem.set_image(img) if not our_jid: -- GitLab