code for instantly apply changements about links grabber

function to launch the application
This commit is contained in:
Yann Leboulanger 2005-03-08 20:59:29 +00:00
parent e6b04e8159
commit 09ce159387
3 changed files with 43 additions and 22 deletions

View file

@ -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']

View file

@ -5347,10 +5347,11 @@ Custom</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">thunderbird -remote 'mailto(%s)'</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="on_custom_mail_client_entry_changed" last_modification_time="Tue, 08 Mar 2005 19:59:41 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
@ -5368,10 +5369,11 @@ Custom</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">firefox -remote 'OpenURL(%s)'</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="on_custom_browser_entry_changed" last_modification_time="Tue, 08 Mar 2005 19:59:36 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>

View file

@ -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,\