diff --git a/data/pixmaps/Makefile.am b/data/pixmaps/Makefile.am index ae122a971..a7eadc116 100644 --- a/data/pixmaps/Makefile.am +++ b/data/pixmaps/Makefile.am @@ -1,15 +1,5 @@ pixmapsdir = $(pkgdatadir)/data/pixmaps nobase_dist_pixmaps_DATA = \ - $(srcdir)/events/*.png \ - $(srcdir)/agents/*.png \ - $(srcdir)/*.png \ - $(srcdir)/gajim.svg \ $(srcdir)/gajim.ico -gajimpixmapdir = $(datadir)/pixmaps -gajimpixmap_DATA = \ - $(srcdir)/gajim.png \ - $(srcdir)/gajim.svg \ - $(srcdir)/gajim_about.png - MAINTAINERCLEANFILES = Makefile.in diff --git a/data/pixmaps/gajim.icns b/data/pixmaps/gajim.icns deleted file mode 100644 index 37516d5e8..000000000 Binary files a/data/pixmaps/gajim.icns and /dev/null differ diff --git a/data/pixmaps/person.png b/data/pixmaps/person.png deleted file mode 100644 index f2169a8a2..000000000 Binary files a/data/pixmaps/person.png and /dev/null differ diff --git a/data/pixmaps/gajim_about.png b/icons/hicolor/128x128/apps/gajim_about.png similarity index 100% rename from data/pixmaps/gajim_about.png rename to icons/hicolor/128x128/apps/gajim_about.png diff --git a/data/pixmaps/cam_active.png b/icons/hicolor/16x16/actions/gajim-cam_active.png similarity index 100% rename from data/pixmaps/cam_active.png rename to icons/hicolor/16x16/actions/gajim-cam_active.png diff --git a/data/pixmaps/cam_inactive.png b/icons/hicolor/16x16/actions/gajim-cam_inactive.png similarity index 100% rename from data/pixmaps/cam_inactive.png rename to icons/hicolor/16x16/actions/gajim-cam_inactive.png diff --git a/data/pixmaps/kbd_input.png b/icons/hicolor/16x16/actions/gajim-kbd_input.png similarity index 100% rename from data/pixmaps/kbd_input.png rename to icons/hicolor/16x16/actions/gajim-kbd_input.png diff --git a/data/pixmaps/mic_active.png b/icons/hicolor/16x16/actions/gajim-mic_active.png similarity index 100% rename from data/pixmaps/mic_active.png rename to icons/hicolor/16x16/actions/gajim-mic_active.png diff --git a/data/pixmaps/mic_inactive.png b/icons/hicolor/16x16/actions/gajim-mic_inactive.png similarity index 100% rename from data/pixmaps/mic_inactive.png rename to icons/hicolor/16x16/actions/gajim-mic_inactive.png diff --git a/data/pixmaps/muc_separator.png b/icons/hicolor/16x16/actions/gajim-muc_separator.png similarity index 100% rename from data/pixmaps/muc_separator.png rename to icons/hicolor/16x16/actions/gajim-muc_separator.png diff --git a/data/pixmaps/receipt_missing.png b/icons/hicolor/16x16/actions/gajim-receipt_missing.png similarity index 100% rename from data/pixmaps/receipt_missing.png rename to icons/hicolor/16x16/actions/gajim-receipt_missing.png diff --git a/data/pixmaps/security-high.png b/icons/hicolor/16x16/actions/gajim-security_high.png similarity index 100% rename from data/pixmaps/security-high.png rename to icons/hicolor/16x16/actions/gajim-security_high.png diff --git a/data/pixmaps/security-low.png b/icons/hicolor/16x16/actions/gajim-security_low.png similarity index 100% rename from data/pixmaps/security-low.png rename to icons/hicolor/16x16/actions/gajim-security_low.png diff --git a/data/pixmaps/agents/aim.png b/icons/hicolor/32x32/categories/gajim-agent-aim.png similarity index 100% rename from data/pixmaps/agents/aim.png rename to icons/hicolor/32x32/categories/gajim-agent-aim.png diff --git a/data/pixmaps/agents/bytestreams.png b/icons/hicolor/32x32/categories/gajim-agent-bytestreams.png similarity index 100% rename from data/pixmaps/agents/bytestreams.png rename to icons/hicolor/32x32/categories/gajim-agent-bytestreams.png diff --git a/data/pixmaps/agents/conference.png b/icons/hicolor/32x32/categories/gajim-agent-conference.png similarity index 100% rename from data/pixmaps/agents/conference.png rename to icons/hicolor/32x32/categories/gajim-agent-conference.png diff --git a/data/pixmaps/agents/disc.png b/icons/hicolor/32x32/categories/gajim-agent-disc.png similarity index 100% rename from data/pixmaps/agents/disc.png rename to icons/hicolor/32x32/categories/gajim-agent-disc.png diff --git a/data/pixmaps/agents/error.png b/icons/hicolor/32x32/categories/gajim-agent-error.png similarity index 100% rename from data/pixmaps/agents/error.png rename to icons/hicolor/32x32/categories/gajim-agent-error.png diff --git a/data/pixmaps/agents/facebook.png b/icons/hicolor/32x32/categories/gajim-agent-facebook.png similarity index 100% rename from data/pixmaps/agents/facebook.png rename to icons/hicolor/32x32/categories/gajim-agent-facebook.png diff --git a/data/pixmaps/agents/gadu-gadu.png b/icons/hicolor/32x32/categories/gajim-agent-gadu-gadu.png similarity index 100% rename from data/pixmaps/agents/gadu-gadu.png rename to icons/hicolor/32x32/categories/gajim-agent-gadu-gadu.png diff --git a/data/pixmaps/agents/http-ws.png b/icons/hicolor/32x32/categories/gajim-agent-http-ws.png similarity index 100% rename from data/pixmaps/agents/http-ws.png rename to icons/hicolor/32x32/categories/gajim-agent-http-ws.png diff --git a/data/pixmaps/agents/icq.png b/icons/hicolor/32x32/categories/gajim-agent-icq.png similarity index 100% rename from data/pixmaps/agents/icq.png rename to icons/hicolor/32x32/categories/gajim-agent-icq.png diff --git a/data/pixmaps/agents/irc.png b/icons/hicolor/32x32/categories/gajim-agent-irc.png similarity index 100% rename from data/pixmaps/agents/irc.png rename to icons/hicolor/32x32/categories/gajim-agent-irc.png diff --git a/data/pixmaps/agents/jabber.png b/icons/hicolor/32x32/categories/gajim-agent-jabber.png similarity index 100% rename from data/pixmaps/agents/jabber.png rename to icons/hicolor/32x32/categories/gajim-agent-jabber.png diff --git a/data/pixmaps/agents/jud.png b/icons/hicolor/32x32/categories/gajim-agent-jud.png similarity index 100% rename from data/pixmaps/agents/jud.png rename to icons/hicolor/32x32/categories/gajim-agent-jud.png diff --git a/data/pixmaps/agents/mail.png b/icons/hicolor/32x32/categories/gajim-agent-mail.png similarity index 100% rename from data/pixmaps/agents/mail.png rename to icons/hicolor/32x32/categories/gajim-agent-mail.png diff --git a/data/pixmaps/agents/mrim.png b/icons/hicolor/32x32/categories/gajim-agent-mrim.png similarity index 100% rename from data/pixmaps/agents/mrim.png rename to icons/hicolor/32x32/categories/gajim-agent-mrim.png diff --git a/data/pixmaps/agents/msn.png b/icons/hicolor/32x32/categories/gajim-agent-msn.png similarity index 100% rename from data/pixmaps/agents/msn.png rename to icons/hicolor/32x32/categories/gajim-agent-msn.png diff --git a/data/pixmaps/agents/pubsub.png b/icons/hicolor/32x32/categories/gajim-agent-pubsub.png similarity index 100% rename from data/pixmaps/agents/pubsub.png rename to icons/hicolor/32x32/categories/gajim-agent-pubsub.png diff --git a/data/pixmaps/agents/rss.png b/icons/hicolor/32x32/categories/gajim-agent-rss.png similarity index 100% rename from data/pixmaps/agents/rss.png rename to icons/hicolor/32x32/categories/gajim-agent-rss.png diff --git a/data/pixmaps/agents/sip.png b/icons/hicolor/32x32/categories/gajim-agent-sip.png similarity index 100% rename from data/pixmaps/agents/sip.png rename to icons/hicolor/32x32/categories/gajim-agent-sip.png diff --git a/data/pixmaps/agents/sms.png b/icons/hicolor/32x32/categories/gajim-agent-sms.png similarity index 100% rename from data/pixmaps/agents/sms.png rename to icons/hicolor/32x32/categories/gajim-agent-sms.png diff --git a/data/pixmaps/agents/tv.png b/icons/hicolor/32x32/categories/gajim-agent-tv.png similarity index 100% rename from data/pixmaps/agents/tv.png rename to icons/hicolor/32x32/categories/gajim-agent-tv.png diff --git a/data/pixmaps/agents/weather.png b/icons/hicolor/32x32/categories/gajim-agent-weather.png similarity index 100% rename from data/pixmaps/agents/weather.png rename to icons/hicolor/32x32/categories/gajim-agent-weather.png diff --git a/data/pixmaps/agents/yahoo.png b/icons/hicolor/32x32/categories/gajim-agent-yahoo.png similarity index 100% rename from data/pixmaps/agents/yahoo.png rename to icons/hicolor/32x32/categories/gajim-agent-yahoo.png diff --git a/data/pixmaps/events/chat_msg_recv.png b/icons/hicolor/48x48/actions/gajim-chat_msg_recv.png similarity index 100% rename from data/pixmaps/events/chat_msg_recv.png rename to icons/hicolor/48x48/actions/gajim-chat_msg_recv.png diff --git a/data/pixmaps/events/connection_lost.png b/icons/hicolor/48x48/actions/gajim-connection_lost.png similarity index 100% rename from data/pixmaps/events/connection_lost.png rename to icons/hicolor/48x48/actions/gajim-connection_lost.png diff --git a/data/pixmaps/events/ft_done.png b/icons/hicolor/48x48/actions/gajim-ft_done.png similarity index 100% rename from data/pixmaps/events/ft_done.png rename to icons/hicolor/48x48/actions/gajim-ft_done.png diff --git a/data/pixmaps/events/ft_error.png b/icons/hicolor/48x48/actions/gajim-ft_error.png similarity index 100% rename from data/pixmaps/events/ft_error.png rename to icons/hicolor/48x48/actions/gajim-ft_error.png diff --git a/data/pixmaps/events/ft_request.png b/icons/hicolor/48x48/actions/gajim-ft_request.png similarity index 100% rename from data/pixmaps/events/ft_request.png rename to icons/hicolor/48x48/actions/gajim-ft_request.png diff --git a/data/pixmaps/events/ft_stopped.png b/icons/hicolor/48x48/actions/gajim-ft_stopped.png similarity index 100% rename from data/pixmaps/events/ft_stopped.png rename to icons/hicolor/48x48/actions/gajim-ft_stopped.png diff --git a/data/pixmaps/events/gc_invitation.png b/icons/hicolor/48x48/actions/gajim-gc_invitation.png similarity index 100% rename from data/pixmaps/events/gc_invitation.png rename to icons/hicolor/48x48/actions/gajim-gc_invitation.png diff --git a/data/pixmaps/events/new_email_recv.png b/icons/hicolor/48x48/actions/gajim-new_email_recv.png similarity index 100% rename from data/pixmaps/events/new_email_recv.png rename to icons/hicolor/48x48/actions/gajim-new_email_recv.png diff --git a/data/pixmaps/events/priv_msg_recv.png b/icons/hicolor/48x48/actions/gajim-priv_msg_recv.png similarity index 100% rename from data/pixmaps/events/priv_msg_recv.png rename to icons/hicolor/48x48/actions/gajim-priv_msg_recv.png diff --git a/data/pixmaps/security-high-big.png b/icons/hicolor/48x48/actions/gajim-security_high.png similarity index 100% rename from data/pixmaps/security-high-big.png rename to icons/hicolor/48x48/actions/gajim-security_high.png diff --git a/data/pixmaps/security-low-big.png b/icons/hicolor/48x48/actions/gajim-security_low.png similarity index 100% rename from data/pixmaps/security-low-big.png rename to icons/hicolor/48x48/actions/gajim-security_low.png diff --git a/data/pixmaps/events/single_msg_recv.png b/icons/hicolor/48x48/actions/gajim-single_msg_recv.png similarity index 100% rename from data/pixmaps/events/single_msg_recv.png rename to icons/hicolor/48x48/actions/gajim-single_msg_recv.png diff --git a/data/pixmaps/events/subscription_request.png b/icons/hicolor/48x48/actions/gajim-subscription_request.png similarity index 100% rename from data/pixmaps/events/subscription_request.png rename to icons/hicolor/48x48/actions/gajim-subscription_request.png diff --git a/data/pixmaps/events/unsubscribed.png b/icons/hicolor/48x48/actions/gajim-unsubscribed.png similarity index 100% rename from data/pixmaps/events/unsubscribed.png rename to icons/hicolor/48x48/actions/gajim-unsubscribed.png diff --git a/data/pixmaps/gajim.png b/icons/hicolor/64x64/apps/gajim.png similarity index 100% rename from data/pixmaps/gajim.png rename to icons/hicolor/64x64/apps/gajim.png diff --git a/data/pixmaps/gajim.svg b/icons/hicolor/scalable/apps/gajim.svg similarity index 100% rename from data/pixmaps/gajim.svg rename to icons/hicolor/scalable/apps/gajim.svg diff --git a/src/chat_control.py b/src/chat_control.py index 7b52d8b34..9bf83be5d 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1274,21 +1274,15 @@ class ChatControl(ChatControlBase): id_ = self._audio_button.connect('toggled', self.on_audio_button_toggled) self.handlers[id_] = self._audio_button # add a special img - path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps', - 'mic_inactive.png') - img = gtk.Image() - img.set_from_file(path_to_img) - self._audio_button.set_image(img) + gtkgui_helpers.add_image_to_button(self._audio_button, + 'gajim-mic_inactive') self._video_button = self.xml.get_widget('video_togglebutton') id_ = self._video_button.connect('toggled', self.on_video_button_toggled) self.handlers[id_] = self._video_button # add a special img - path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps', - 'cam_inactive.png') - img = gtk.Image() - img.set_from_file(path_to_img) - self._video_button.set_image(img) + gtkgui_helpers.add_image_to_button(self._video_button, + 'gajim-cam_inactive') self._send_file_button = self.xml.get_widget('send_file_button') # add a special img for send file button @@ -1796,12 +1790,13 @@ class ChatControl(ChatControlBase): banner_name_label.set_tooltip_text(label_tooltip) def on_jingle_button_toggled(self, widget, jingle_type): - path_to_img = os.path.join(gajim.DATA_DIR, 'pixmaps', '%s_%s.png' - % ({'audio': 'mic', 'video': 'cam'}[jingle_type], - {True: 'active', False: 'inactive'}[widget.get_active()])) + img_name = '%s_%s' % ({'audio': 'mic', 'video': 'cam'}[jingle_type], + {True: 'active', False: 'inactive'}[widget.get_active()]) + path_to_img = gtkgui_helpers.get_icon_path(img_name) if widget.get_active(): - if getattr(self, jingle_type + '_state') == self.JINGLE_STATE_AVAILABLE: + if getattr(self, jingle_type + '_state') == \ + self.JINGLE_STATE_AVAILABLE: sid = getattr(gajim.connections[self.account], 'start_' + jingle_type)(self.contact.get_full_jid()) getattr(self, 'set_' + jingle_type + '_state')('connecting', sid) @@ -1886,11 +1881,12 @@ class ChatControl(ChatControlBase): if authenticated: #About encrypted chat session authenticated_string = _('and authenticated') - self.lock_image.set_from_file(os.path.join(gajim.DATA_DIR, 'pixmaps', 'security-high.png')) + img_path = gtkgui_helpers.get_icon_path('gajim-security_high') else: #About encrypted chat session authenticated_string = _('and NOT authenticated') - self.lock_image.set_from_file(os.path.join(gajim.DATA_DIR, 'pixmaps', 'security-low.png')) + img_path = gtkgui_helpers.get_icon_path('gajim-security_low') + self.lock_image.set_from_file(img_path) #status will become 'is' or 'is not', authentificaed will become #'and authentificated' or 'and not authentificated', logged will become diff --git a/src/config.py b/src/config.py index df0673d7f..5b7a0c8ce 100644 --- a/src/config.py +++ b/src/config.py @@ -1437,8 +1437,7 @@ class AccountsWindow: self.accounts_treeview = self.xml.get_widget('accounts_treeview') self.remove_button = self.xml.get_widget('remove_button') self.rename_button = self.xml.get_widget('rename_button') - path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', - 'kbd_input.png') + path_to_kbd_input_img = gtkgui_helpers.get_icon_path('gajim-kbd_input') img = self.xml.get_widget('rename_image') img.set_from_file(path_to_kbd_input_img) self.notebook = self.xml.get_widget('notebook') @@ -3372,7 +3371,7 @@ class AccountCreationWizardWindow: if self.modify: img.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_DIALOG) else: - path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'gajim.png') + path_to_file = gtkgui_helpers.get_icon_path('gajim', 48) img.set_from_file(path_to_file) self.show_vcard_checkbutton.set_active(not self.modify) self.notebook.set_current_page(6) # show finish page diff --git a/src/conversation_textview.py b/src/conversation_textview.py index 292d524c2..b7ee783ab 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -169,10 +169,9 @@ class ConversationTextview(gobject.GObject): ) ) - FOCUS_OUT_LINE_PIXBUF = gtk.gdk.pixbuf_new_from_file(os.path.join( - gajim.DATA_DIR, 'pixmaps', 'muc_separator.png')) - XEP0184_WARNING_PIXBUF = gtk.gdk.pixbuf_new_from_file(os.path.join( - gajim.DATA_DIR, 'pixmaps', 'receipt_missing.png')) + FOCUS_OUT_LINE_PIXBUF = gtkgui_helpers.get_icon_pixmap('gajim-muc_separator') + XEP0184_WARNING_PIXBUF = gtkgui_helpers.get_icon_pixmap( + 'gajim-receipt_missing') # smooth scroll constants MAX_SCROLL_TIME = 0.4 # seconds diff --git a/src/dialogs.py b/src/dialogs.py index a82f3a8af..e9ed3344f 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1190,8 +1190,7 @@ class AboutDialog: dlg.props.wrap_license = True - pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join( - gajim.DATA_DIR, 'pixmaps', 'gajim_about.png')) + pixbuf = gtkgui_helpers.get_icon_pixmap('gajim-about', 64) dlg.set_logo(pixbuf) #here you write your name in the form Name FamilyName @@ -2463,9 +2462,7 @@ class PopupNotificationWindow: # default image if not path_to_image: - path_to_image = os.path.abspath( - os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'chat_msg_recv.png')) # img to display + path_to_image = gtkgui_helpers.get_icon_path('gajim-chat_msg_recv', 48) if event_type == _('Contact Signed In'): bg_color = 'limegreen' @@ -4540,43 +4537,37 @@ class ESessionInfoWindow: def update_info(self): labeltext = _('''Your chat session with %(jid)s is encrypted.\n\nThis session's Short Authentication String is %(sas)s.''') % {'jid': self.session.jid, 'sas': self.session.sas} - dir_ = os.path.join(gajim.DATA_DIR, 'pixmaps') if self.session.verified_identity: labeltext += '\n\n' + _('''You have already verified this contact's identity.''') - security_image = 'security-high-big.png' + security_image = 'gajim-security_high' if self.session.control: self.session.control._show_lock_image(True, 'E2E', True, - self.session.is_loggable(), True) + self.session.is_loggable(), True) verification_status = _('''Contact's identity verified''') self.window.set_title(verification_status) self.xml.get_widget('verification_status_label').set_markup( - '' + - verification_status + - '') + '%s' % verification_status) self.xml.get_widget('dialog-action_area1').set_no_show_all(True) self.button_label.set_text(_('Verify again...')) else: if self.session.control: self.session.control._show_lock_image(True, 'E2E', True, - self.session.is_loggable(), False) + self.session.is_loggable(), False) labeltext += '\n\n' + _('''To be certain that only the expected person can read your messages or send you messages, you need to verify their identity by clicking the button below.''') - security_image = 'security-low-big.png' + security_image = 'gajim-security_low' verification_status = _('''Contact's identity NOT verified''') self.window.set_title(verification_status) self.xml.get_widget('verification_status_label').set_markup( - '' + - verification_status + - '') + '%s' % verification_status) self.button_label.set_text(_('Verify...')) - path = os.path.join(dir_, security_image) - filename = os.path.abspath(path) - self.security_image.set_from_file(filename) + path = gtkgui_helpers.get_icon_path(security_image, 32) + self.security_image.set_from_file(path) self.xml.get_widget('info_display').set_markup(labeltext) @@ -4622,13 +4613,13 @@ class GPGInfoWindow: verification_status = _('''Contact's identity NOT verified''') info = _('The contact\'s key (%s) does not match the key ' 'assigned in Gajim.') % keyID[:8] - image = 'security-low-big.png' + image = 'gajim-security_low' elif not keyID: # No key assigned nor a key is used by remote contact verification_status = _('No GPG key assigned') info = _('No GPG key is assigned to this contact. So you cannot ' 'encrypt messages.') - image = 'security-low-big.png' + image = 'gajim-security_low' else: error = gajim.connections[account].gpg.encrypt('test', [keyID])[1] if error: @@ -4636,21 +4627,19 @@ class GPGInfoWindow: info = _('GPG key is assigned to this contact, but you do not ' 'trust his key, so message cannot be encrypted. Use ' 'your GPG client to trust this key.') - image = 'security-low-big.png' + image = 'gajim-security_low' else: verification_status = _('''Contact's identity verified''') info = _('GPG Key is assigned to this contact, and you trust his ' 'key, so messages will be encrypted.') - image = 'security-high-big.png' + image = 'gajim-security_high' status_label.set_markup('%s' % \ verification_status) info_label.set_markup(info) - dir_ = os.path.join(gajim.DATA_DIR, 'pixmaps') - path = os.path.join(dir_, image) - filename = os.path.abspath(path) - security_image.set_from_file(filename) + path = gtkgui_helpers.get_icon_path(image, 32) + security_image.set_from_file(path) xml.signal_autoconnect(self) self.window.show_all() diff --git a/src/disco.py b/src/disco.py index da9021dd4..8e5bc1e92 100644 --- a/src/disco.py +++ b/src/disco.py @@ -73,44 +73,44 @@ def _gen_agent_type_info(): (0, 0): (None, None), # Jabber server - ('server', 'im'): (ToplevelAgentBrowser, 'jabber.png'), - ('services', 'jabber'): (ToplevelAgentBrowser, 'jabber.png'), - ('hierarchy', 'branch'): (AgentBrowser, 'jabber.png'), + ('server', 'im'): (ToplevelAgentBrowser, 'jabber'), + ('services', 'jabber'): (ToplevelAgentBrowser, 'jabber'), + ('hierarchy', 'branch'): (AgentBrowser, 'jabber'), # Services - ('conference', 'text'): (MucBrowser, 'conference.png'), - ('headline', 'rss'): (AgentBrowser, 'rss.png'), - ('headline', 'weather'): (False, 'weather.png'), - ('gateway', 'weather'): (False, 'weather.png'), - ('_jid', 'weather'): (False, 'weather.png'), - ('gateway', 'sip'): (False, 'sip.png'), - ('directory', 'user'): (None, 'jud.png'), - ('pubsub', 'generic'): (PubSubBrowser, 'pubsub.png'), - ('pubsub', 'service'): (PubSubBrowser, 'pubsub.png'), - ('proxy', 'bytestreams'): (None, 'bytestreams.png'), # Socks5 FT proxy - ('headline', 'newmail'): (ToplevelAgentBrowser, 'mail.png'), + ('conference', 'text'): (MucBrowser, 'conference'), + ('headline', 'rss'): (AgentBrowser, 'rss'), + ('headline', 'weather'): (False, 'weather'), + ('gateway', 'weather'): (False, 'weather'), + ('_jid', 'weather'): (False, 'weather'), + ('gateway', 'sip'): (False, 'sip'), + ('directory', 'user'): (None, 'jud'), + ('pubsub', 'generic'): (PubSubBrowser, 'pubsub'), + ('pubsub', 'service'): (PubSubBrowser, 'pubsub'), + ('proxy', 'bytestreams'): (None, 'bytestreams'), # Socks5 FT proxy + ('headline', 'newmail'): (ToplevelAgentBrowser, 'mail'), # Transports - ('conference', 'irc'): (ToplevelAgentBrowser, 'irc.png'), - ('_jid', 'irc'): (False, 'irc.png'), - ('gateway', 'aim'): (False, 'aim.png'), - ('_jid', 'aim'): (False, 'aim.png'), - ('gateway', 'gadu-gadu'): (False, 'gadu-gadu.png'), - ('_jid', 'gadugadu'): (False, 'gadu-gadu.png'), - ('gateway', 'http-ws'): (False, 'http-ws.png'), - ('gateway', 'icq'): (False, 'icq.png'), - ('_jid', 'icq'): (False, 'icq.png'), - ('gateway', 'msn'): (False, 'msn.png'), - ('_jid', 'msn'): (False, 'msn.png'), - ('gateway', 'sms'): (False, 'sms.png'), - ('_jid', 'sms'): (False, 'sms.png'), - ('gateway', 'smtp'): (False, 'mail.png'), - ('gateway', 'yahoo'): (False, 'yahoo.png'), - ('_jid', 'yahoo'): (False, 'yahoo.png'), - ('gateway', 'mrim'): (False, 'mrim.png'), - ('_jid', 'mrim'): (False, 'mrim.png'), - ('gateway', 'facebook'): (False, 'facebook.png'), - ('_jid', 'facebook'): (False, 'facebook.png'), + ('conference', 'irc'): (ToplevelAgentBrowser, 'irc'), + ('_jid', 'irc'): (False, 'irc'), + ('gateway', 'aim'): (False, 'aim'), + ('_jid', 'aim'): (False, 'aim'), + ('gateway', 'gadu-gadu'): (False, 'gadu_gadu'), + ('_jid', 'gadugadu'): (False, 'gadu_gadu'), + ('gateway', 'http-ws'): (False, 'http_ws'), + ('gateway', 'icq'): (False, 'icq'), + ('_jid', 'icq'): (False, 'icq'), + ('gateway', 'msn'): (False, 'msn'), + ('_jid', 'msn'): (False, 'msn'), + ('gateway', 'sms'): (False, 'sms'), + ('_jid', 'sms'): (False, 'sms'), + ('gateway', 'smtp'): (False, 'mail'), + ('gateway', 'yahoo'): (False, 'yahoo'), + ('_jid', 'yahoo'): (False, 'yahoo'), + ('gateway', 'mrim'): (False, 'mrim'), + ('_jid', 'mrim'): (False, 'mrim'), + ('gateway', 'facebook'): (False, 'facebook'), + ('_jid', 'facebook'): (False, 'facebook'), } # Category type to "human-readable" description string, and sort priority @@ -291,13 +291,12 @@ class ServicesCache: info = _agent_type_info[(0, 0)] filename = info[1] if not filename: # we don't have an image to show for this type - filename = 'jabber.png' + filename = 'jabber' # Use the cache if possible if filename in _icon_cache: return _icon_cache[filename] # Or load it - filepath = os.path.join(gajim.DATA_DIR, 'pixmaps', 'agents', filename) - pix = gtk.gdk.pixbuf_new_from_file(filepath) + pix = gtkgui_helpers.get_icon_pixmap('gajim-agent-' + filename, size=32) # Store in cache _icon_cache[filename] = pix return pix diff --git a/src/gajim.py b/src/gajim.py index a2e58f4e7..d0ed38f20 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -322,8 +322,7 @@ def pid_alive(): return True if pid_alive(): - path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png') - pix = gtk.gdk.pixbuf_new_from_file(path_to_file) + pix = gtkgui_helpers.get_icon_pixmap('gajim', 48) gtk.window_set_default_icon(pix) # set the icon to all newly opened wind pritext = _('Gajim is already running') sectext = _('Another instance of Gajim seems to be running\nRun anyway?') diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 1c90e0159..021fb3929 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -82,6 +82,15 @@ def get_icon_path(icon_name, size=16): except gobject.GError, e: log.error("Unable to find icon %s: %s" % (icon_name, str(e))) +def add_image_to_menuitem(menuitem, icon_name): + img = gtk.Image() + path_img = get_icon_path(icon_name) + img.set_from_file(path_img) + menuitem.set_image(img) + +def add_image_to_button(button, icon_name): + add_image_to_menuitem(button, icon_name) + GLADE_DIR = os.path.join(gajim.DATA_DIR, 'glade') def get_glade(file_name, root = None): file_path = os.path.join(GLADE_DIR, file_name) diff --git a/src/gui_interface.py b/src/gui_interface.py index 6f5f06e4f..1ba0d8f8a 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -199,9 +199,7 @@ class Interface: def handle_event_connection_lost(self, account, array): # ('CONNECTION_LOST', account, [title, text]) - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'connection_lost.png') - path = gtkgui_helpers.get_path_to_generic_or_avatar(path) + path = gtkgui_helpers.get_icon_path('gajim-connection_lost', 48) notify.popup(_('Connection Failed'), account, account, 'connection_failed', path, array[0], array[1]) @@ -593,9 +591,7 @@ class Interface: self.add_event(account, jid, 'subscription_request', (text, nick)) if helpers.allow_showing_notification(account): - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'subscription_request.png') - path = gtkgui_helpers.get_path_to_generic_or_avatar(path) + path = gtkgui_helpers.get_icon_path('gajim-subscription_request', 48) event_type = _('Subscription request') notify.popup(event_type, jid, account, 'subscription_request', path, event_type, jid) @@ -657,9 +653,7 @@ class Interface: self.add_event(account, jid, 'unsubscribed', contact) if helpers.allow_showing_notification(account): - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'unsubscribed.png') - path = gtkgui_helpers.get_path_to_generic_or_avatar(path) + path = gtkgui_helpers.get_icon_path('gajim-unsubscribed', 48) event_type = _('Unsubscribed') notify.popup(event_type, jid, account, 'unsubscribed', path, event_type, jid) @@ -1117,9 +1111,7 @@ class Interface: array[3], array[4])) if helpers.allow_showing_notification(account): - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'gc_invitation.png') - path = gtkgui_helpers.get_path_to_generic_or_avatar(path) + path = gtkgui_helpers.get_icon_path('gajim-gc_invitation', 48) event_type = _('Groupchat Invitation') notify.popup(event_type, jid, account, 'gc-invitation', path, event_type, room_jid) @@ -1139,7 +1131,7 @@ class Interface: sectext += _('You are currently connected without your OpenPGP key.') dialogs.WarningDialog(_('Your passphrase is incorrect'), sectext) else: - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'warning.png') + path = gtkgui_helpers.get_icon_path('gajim-warning', 48) notify.popup('warning', account, account, 'warning', path, _('OpenGPG Passphrase Incorrect'), _('You are currently connected without your OpenPGP key.')) @@ -1276,8 +1268,7 @@ class Interface: self.add_event(account, jid, 'file-send-error', file_props) if helpers.allow_showing_notification(account): - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 'ft_error.png') - path = gtkgui_helpers.get_path_to_generic_or_avatar(img) + path = gtkgui_helpers.get_icon_path('gajim-ft_error', 48) event_type = _('File Transfer Error') notify.popup(event_type, jid, account, 'file-send-error', path, event_type, file_props['name']) @@ -1287,8 +1278,7 @@ class Interface: gmail_new_messages = int(array[1]) gmail_messages_list = array[2] if gajim.config.get('notify_on_new_gmail_email'): - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'new_email_recv.png') + path = gtkgui_helpers.get_icon_path('gajim-new_email_recv', 48) title = _('New mail on %(gmail_mail_address)s') % \ {'gmail_mail_address': jid} text = i18n.ngettext('You have %d new mail conversation', @@ -1311,7 +1301,6 @@ class Interface: if gajim.config.get_per('soundevents', 'gmail_received', 'enabled'): helpers.play_sound('gmail_received') - path = gtkgui_helpers.get_path_to_generic_or_avatar(img) notify.popup(_('New E-mail'), jid, account, 'gmail', path_to_image=path, title=title, text=text) @@ -1343,9 +1332,7 @@ class Interface: if helpers.allow_showing_notification(account): # check if we should be notified - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', 'ft_error.png') - - path = gtkgui_helpers.get_path_to_generic_or_avatar(img) + path = gtkgui_helpers.get_icon_path('gajim-ft_error', 48) event_type = _('File Transfer Error') notify.popup(event_type, jid, account, msg_type, path, title = event_type, text = file_props['name']) @@ -1374,11 +1361,9 @@ class Interface: self.add_event(account, jid, 'file-request', file_props) if helpers.allow_showing_notification(account): - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'ft_request.png') + path = gtkgui_helpers.get_icon_path('gajim-ft_request', 48) txt = _('%s wants to send you a file.') % gajim.get_name_from_jid( account, jid) - path = gtkgui_helpers.get_path_to_generic_or_avatar(img) event_type = _('File Transfer Request') notify.popup(event_type, jid, account, 'file-request', path_to_image = path, title = event_type, text = txt) @@ -1449,11 +1434,11 @@ class Interface: if event_type == _('File Transfer Completed'): txt = _('You successfully received %(filename)s from %(name)s.')\ % {'filename': filename, 'name': name} - img = 'ft_done.png' + img_name = 'gajim-ft_done' else: # ft stopped txt = _('File transfer of %(filename)s from %(name)s stopped.')\ % {'filename': filename, 'name': name} - img = 'ft_stopped.png' + img_name = 'gajim-ft_stopped' else: receiver = file_props['receiver'] if hasattr(receiver, 'jid'): @@ -1466,23 +1451,23 @@ class Interface: if event_type == _('File Transfer Completed'): txt = _('You successfully sent %(filename)s to %(name)s.')\ % {'filename': filename, 'name': name} - img = 'ft_done.png' + img_name = 'gajim-ft_done' else: # ft stopped txt = _('File transfer of %(filename)s to %(name)s stopped.')\ % {'filename': filename, 'name': name} - img = 'ft_stopped.png' - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img) - path = gtkgui_helpers.get_path_to_generic_or_avatar(img) + img_name = 'gajim-ft_stopped' + path = gtkgui_helpers.get_icon_path(img_name, 48) else: txt = '' + path = '' if gajim.config.get('notify_on_file_complete') and \ (gajim.config.get('autopopupaway') or \ gajim.connections[account].connected in (2, 3)): # we want to be notified and we are online/chat or we don't mind # bugged when away/na/busy - notify.popup(event_type, jid, account, msg_type, path_to_image = path, - title = event_type, text = txt) + notify.popup(event_type, jid, account, msg_type, path_to_image=path, + title=event_type, text=txt) def handle_event_stanza_arrived(self, account, stanza): if account not in self.instances: @@ -1766,11 +1751,9 @@ class Interface: if helpers.allow_showing_notification(account): # TODO: we should use another pixmap ;-) - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'ft_request.png') txt = _('%s wants to start a voice chat.') % gajim.get_name_from_jid( account, peerjid) - path = gtkgui_helpers.get_path_to_generic_or_avatar(img) + path = gtkgui_helpers.get_icon_path('gajim-mic_active', 48) event_type = _('Voice Chat Request') notify.popup(event_type, peerjid, account, 'jingle-incoming', path_to_image = path, title = event_type, text = txt) @@ -2782,8 +2765,8 @@ class Interface: if status in ('chat', 'away', 'xa', 'dnd', 'invisible', 'offline'): status = status + '.png' elif status == 'online': - prefix = os.path.join(gajim.DATA_DIR, 'pixmaps') - status = 'gajim.png' + prefix = '' + status = gtkgui_helpers.get_icon_path('gajim', 32) path = os.path.join(prefix, status) try: obj = bus.get_object('com.google.code.Awn', '/com/google/code/Awn') @@ -3386,8 +3369,7 @@ class Interface: import statusicon self.systray = statusicon.StatusIcon() - path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'gajim.png') - pix = gtk.gdk.pixbuf_new_from_file(path_to_file) + pix = gtkgui_helpers.get_icon_pixmap('gajim', 32) # set the icon to all windows gtk.window_set_default_icon(pix) diff --git a/src/gui_menu_builder.py b/src/gui_menu_builder.py index f18354175..5fd799a99 100644 --- a/src/gui_menu_builder.py +++ b/src/gui_menu_builder.py @@ -207,11 +207,7 @@ def get_contact_menu(contact, account, use_multiple_contacts=True, if not our_jid: # add a special img for rename menuitem - path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', - 'kbd_input.png') - img = gtk.Image() - img.set_from_file(path_to_kbd_input_img) - rename_menuitem.set_image(img) + gtkgui_helpers.add_image_to_menuitem(rename_menuitem, 'gajim-kbd_input') muc_icon = gtkgui_helpers.load_icon('muc_active') if muc_icon: diff --git a/src/history_manager.py b/src/history_manager.py index c75f120b2..13dd22a62 100644 --- a/src/history_manager.py +++ b/src/history_manager.py @@ -107,8 +107,7 @@ import sqlite3 as sqlite class HistoryManager: def __init__(self): - path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps/gajim.png') - pix = gtk.gdk.pixbuf_new_from_file(path_to_file) + pix = gtkgui_helpers.get_icon_pixmap('gajim') gtk.window_set_default_icon(pix) # set the icon to all newly opened windows if not os.path.exists(LOG_DB_PATH): diff --git a/src/htmltextview.py b/src/htmltextview.py index 11b69e4b6..35a289ebb 100644 --- a/src/htmltextview.py +++ b/src/htmltextview.py @@ -941,12 +941,12 @@ if __name__ == '__main__': htmlview = ConversationTextview(None) - path_to_file = os.path.join(gajim.DATA_DIR, 'pixmaps', 'muc_separator.png') + path = gtkgui_helpers.get_icon_path('gajim-muc_separator') # use this for hr - htmlview.tv.focus_out_line_pixbuf = gtk.gdk.pixbuf_new_from_file(path_to_file) - + htmlview.tv.focus_out_line_pixbuf = gtk.gdk.pixbuf_new_from_file(path) tooltip = tooltips.BaseTooltip() + def on_textview_motion_notify_event(widget, event): """ Change the cursor to a hand when we are over a mail or an url diff --git a/src/notify.py b/src/notify.py index 587c4e292..37a7fd267 100644 --- a/src/notify.py +++ b/src/notify.py @@ -234,16 +234,16 @@ def notify(event, jid, account, parameters, advanced_notif_num=None): show_image = 'online.png' suffix = '_notif_size_colored' transport_name = gajim.get_transport_name_from_jid(jid) - img = None + img_path = None if transport_name: - img = os.path.join(helpers.get_transport_path(transport_name), + img_path = os.path.join(helpers.get_transport_path(transport_name), '48x48', show_image) - if not img or not os.path.isfile(img): + if not img_path or not os.path.isfile(img_path): iconset = gajim.config.get('iconset') - img = os.path.join(helpers.get_iconset_path(iconset), '48x48', + img_path = os.path.join(helpers.get_iconset_path(iconset), '48x48', show_image) - path = gtkgui_helpers.get_path_to_generic_or_avatar(img, - jid = jid, suffix = suffix) + path = gtkgui_helpers.get_path_to_generic_or_avatar(img_path, jid=jid, + suffix=suffix) if event == 'status_change': title = _('%(nick)s Changed Status') % \ {'nick': gajim.get_name_from_jid(account, jid)} @@ -273,16 +273,14 @@ def notify(event, jid, account, parameters, advanced_notif_num=None): elif event == 'new_message': if message_type == 'normal': # single message event_type = _('New Single Message') - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'single_msg_recv.png') + img_name = 'gajim-single_msg_recv' title = _('New Single Message from %(nickname)s') % \ {'nickname': nickname} text = message elif message_type == 'pm': # private message event_type = _('New Private Message') room_name = gajim.get_nick_from_jid(jid) - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'priv_msg_recv.png') + img_name = 'gajim-priv_msg_recv' title = _('New Private Message from group chat %s') % room_name if message: text = _('%(nickname)s: %(message)s') % {'nickname': nickname, @@ -292,14 +290,13 @@ def notify(event, jid, account, parameters, advanced_notif_num=None): else: # chat message event_type = _('New Message') - img = os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'chat_msg_recv.png') + img_name = 'gajim-chat_msg_recv' title = _('New Message from %(nickname)s') % \ {'nickname': nickname} text = message - path = gtkgui_helpers.get_path_to_generic_or_avatar(img) + img_path = gtkgui_helpers.get_icon_path(img_name, 48) popup(event_type, jid, account, message_type, - path_to_image=path, title=title, text=text) + path_to_image=img_path, title=title, text=text) if do_sound: snd_file = None @@ -342,9 +339,7 @@ def popup(event_type, jid, account, msg_type='', path_to_image=None, title=None, """ # default image if not path_to_image: - path_to_image = os.path.abspath( - os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'chat_msg_recv.png')) # img to display + path_to_image = gtkgui_helpers.get_icon_path('gajim-chat_msg_recv', 48) if gajim.HAVE_INDICATOR and event_type in (_('New Message'), _('New Single Message'), _('New Private Message')): @@ -529,9 +524,8 @@ class DesktopNotification: ntype = 'unsubscribed' else: # default failsafe values - self.path_to_image = os.path.abspath( - os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', - 'chat_msg_recv.png')) # img to display + self.path_to_image = gtkgui_helpers.get_icon_path( + 'gajim-chat_msg_recv', 48) ntype = 'im' # Notification Type self.notif = dbus_support.get_notifications_interface(self) @@ -554,8 +548,7 @@ class DesktopNotification: notification_text = ('' \ '%(title)s
%(text)s') % {'title': self.title, 'text': self.text, 'image': self.path_to_image} - gajim_icon = os.path.abspath(os.path.join(gajim.DATA_DIR, 'pixmaps', - 'gajim.png')) + gajim_icon = gtkgui_helpers.get_icon_path('gajim', 48) self.notif.Notify( dbus.String(_('Gajim')), # app_name (string) dbus.UInt32(0), # replaces_id (uint) diff --git a/src/roster_window.py b/src/roster_window.py index 50249d642..9e56d3c97 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -4962,10 +4962,7 @@ class RosterWindow: sub_menu.append(item) item = gtk.ImageMenuItem(_('_Change Status Message')) - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png') - img = gtk.Image() - img.set_from_file(path) - item.set_image(img) + gtkgui_helpers.add_image_to_menuitem(item, 'gajim-kbd_input') sub_menu.append(item) item.connect('activate', self.on_change_status_message_activate, account) @@ -5063,10 +5060,7 @@ class RosterWindow: sub_menu.append(item) item = gtk.ImageMenuItem(_('_Change Status Message')) - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png') - img = gtk.Image() - img.set_from_file(path) - item.set_image(img) + gtkgui_helpers.add_image_to_menuitem(item, 'gajim-kbd_input') sub_menu.append(item) item.connect('activate', self.on_change_status_message_activate, account) @@ -5219,11 +5213,7 @@ class RosterWindow: # Rename rename_item = gtk.ImageMenuItem(_('Re_name')) # add a special img for rename menuitem - path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', - 'kbd_input.png') - img = gtk.Image() - img.set_from_file(path_to_kbd_input_img) - rename_item.set_image(img) + gtkgui_helpers.add_image_to_menuitem(rename_item, 'gajim-kbd_input') menu.append(rename_item) rename_item.connect('activate', self.on_rename, 'group', group, account) @@ -5481,11 +5471,7 @@ class RosterWindow: # Rename item = gtk.ImageMenuItem(_('_Rename')) # add a special img for rename menuitem - path_to_kbd_input_img = os.path.join(gajim.DATA_DIR, 'pixmaps', - 'kbd_input.png') - img = gtk.Image() - img.set_from_file(path_to_kbd_input_img) - item.set_image(img) + gtkgui_helpers.add_image_to_menuitem(item, 'gajim-kbd_input') manage_transport_submenu.append(item) item.connect('activate', self.on_rename, 'agent', jid, account) if gajim.account_is_disconnected(account): @@ -5813,7 +5799,7 @@ class RosterWindow: # Add a Separator (self._iter_is_separator() checks on string SEPARATOR) liststore.append(['SEPARATOR', None, '', True]) - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png') + path = gtkgui_helpers.get_icon_path('gajim-kbd_input') img = gtk.Image() img.set_from_file(path) # sensitivity to False because by default we're offline diff --git a/src/statusicon.py b/src/statusicon.py index 556fb9fa1..33c3fa063 100644 --- a/src/statusicon.py +++ b/src/statusicon.py @@ -207,10 +207,7 @@ class StatusIcon: sub_menu.append(item) item = gtk.ImageMenuItem(_('_Change Status Message...')) - path = os.path.join(gajim.DATA_DIR, 'pixmaps', 'kbd_input.png') - img = gtk.Image() - img.set_from_file(path) - item.set_image(img) + gtkgui_helpers.add_image_to_menuitem(item, 'gajim-kbd_input') sub_menu.append(item) item.connect('activate', self.on_change_status_message_activate)