diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py index 2b45dd873..36fb23146 100644 --- a/plugins/gtkgui/config.py +++ b/plugins/gtkgui/config.py @@ -337,17 +337,6 @@ class preferences_window: del self.plugin.config['msg%i' % i] i += 1 - #open links with - if self.links_open_with_combobox.get_active() == 0: - self.plugin.config['openwith'] = 'gnome-open' - elif self.links_open_with_combobox.get_active() == 1: - self.plugin.config['openwith'] = 'kfmclient exec' - elif self.links_open_with_combobox.get_active() == 2: - self.plugin.config['openwith'] = 'custom' - self.plugin.config['custombrowser'] = \ - self.xml.get_widget('custom_browser_entry').get_text() - self.plugin.config['custommailapp'] = \ - self.xml.get_widget('custom_mail_app_entry').get_text() #log presences in user file if self.xml.get_widget('chk_log_pres_usr').get_active(): self.config_logger['lognotusr'] = 1 @@ -620,9 +609,20 @@ class preferences_window: def on_links_open_with_combobox_changed(self, widget): if widget.get_active() == 2: self.xml.get_widget('custom_apps_frame').set_sensitive(True) + self.plugin.config['openwith'] = 'custom' else: + if widget.get_active() == 0: + self.plugin.config['openwith'] = 'gnome-open' + if widget.get_active() == 1: + self.plugin.config['openwith'] = 'kfmclient exec' self.xml.get_widget('custom_apps_frame').set_sensitive(False) + def on_custom_browser_entry_changed(self, widget): + self.plugin.config['custombrowser'] = widget.get_text() + + def on_custom_mail_client_entry_changed(self, widget): + self.plugin.config['custommailapp'] = widget.get_text() + def __init__(self, plugin): """Initialize Preference window""" self.xml = gtk.glade.XML(GTKGUI_GLADE, 'preferences_window', APP) @@ -887,10 +887,10 @@ class preferences_window: elif self.plugin.config['openwith'] == 'custom': self.links_open_with_combobox.set_active(2) self.xml.get_widget('custom_apps_frame').set_sensitive(True) - self.xml.get_widget('custom_browser_entry').set_text(\ - self.plugin.config['custombrowser']) - self.xml.get_widget('custom_mail_app_entry').set_text(\ - self.plugin.config['custommailapp']) + self.xml.get_widget('custom_browser_entry').set_text(\ + self.plugin.config['custombrowser']) + self.xml.get_widget('custom_mail_client_entry').set_text(\ + self.plugin.config['custommailapp']) #log presences in user file st = self.config_logger['lognotusr'] diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 599bc778b..721788054 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -5347,10 +5347,11 @@ Custom True True 0 - thunderbird -remote 'mailto(%s)' + True * False + 1 @@ -5368,10 +5369,11 @@ Custom True True 0 - firefox -remote 'OpenURL(%s)' + True * False + 1 diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index d873b93c2..632bf66da 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -228,7 +228,27 @@ class tabbed_chat_window: self.on_tabbed_chat_window_key_press_event) self.xml.signal_connect('on_chat_notebook_switch_page', \ self.on_chat_notebook_switch_page) - #self.xml.signal_autoconnect(self) #FIXME: (nk) THIS SEGFAULTS GAJIM. WHY? -> (asterix) we delete the first page, so we delete the widgets, so we don't want to connect associated signals. + + def run_application(self, type, url): + #type = 'url' or 'mail' + if self.plugin.config['openwith'] == 'gnome-open': + app = 'gnome-open' + args = ['gnome-open'] + args.append(url) + elif self.plugin.config['openwith'] == 'kfmclient exec': + app = 'kfmclient' + args = ['kfmclient', 'exec'] + elif self.plugin.config['openwith'] == 'custom': + if type == 'url': + conf = self.plugin.config['custombrowser'] + if type == 'mail': + conf = self.plugin.config['custommailapp'] + if conf == '': + return + args = conf.split() + app = args[0] + args.append(url) + os.spawnvp(os.P_NOWAIT, app, args) def update_tags(self): for jid in self.tagIn: @@ -1337,7 +1357,6 @@ class Groupchat_window: self.on_chat_notebook_switch_page) self.xml.signal_connect('on_set_button_clicked', \ self.on_set_button_clicked) - #FIXME: (nk) WHY AUTOCONNECT segfaults? [haven't test here but looks the same] with tabbed chat window ;P class history_window: """Class for bowser agent window : @@ -3418,9 +3437,9 @@ class plugin: 'sound_contact_disconnected_file': 'sounds/disconnected.wav',\ 'sound_message_sent': 1,\ 'sound_message_sent_file': 'sounds/sent.wav',\ - 'openwith': 'gnome-open', \ - 'custombrowser' : '', \ - 'custommailapp' : '', \ + 'openwith': 'gnome-open',\ + 'custombrowser' : 'firefox',\ + 'custommailapp' : 'thunderbird',\ 'x-position': 0,\ 'y-position': 0,\ 'width': 150,\