diff --git a/url_shortener/config_dialog.ui b/url_shortener/config_dialog.ui index a700e4d..d1424ec 100644 --- a/url_shortener/config_dialog.ui +++ b/url_shortener/config_dialog.ui @@ -8,40 +8,87 @@ True vertical - + True - all + 0 + none - + True - 0.029999999329447746 - The maximum length not be shortened links(chars) - False + 2 + 2 + + + True + True + ● + 6 + True + True + + + + 1 + 2 + + + + + + True + True + ● + 6 + True + True + + + + 1 + 2 + 1 + 2 + GTK_EXPAND + + + + + True + 0 + 13 + incoming message + False + + + 1 + 2 + GTK_EXPAND + + + + + True + 0 + 12 + outgoing message + False + + + GTK_EXPAND + + - - False - False - 0 - - - + + True - True - ● - 6 - True - True - + <b>The maximum length not be shortened links(chars):</b> + True - - False - False - 1 - + 6 0 diff --git a/url_shortener/manifest.ini b/url_shortener/manifest.ini index 0963c44..ea17e2c 100644 --- a/url_shortener/manifest.ini +++ b/url_shortener/manifest.ini @@ -1,7 +1,7 @@ [info] name: Url Shortener short_name: url_shortener -version: 0.2 +version: 0.3 description: Plugin that allows users to shorten a long URL in messages. For example, you can turn this link: http://maps.google.com/maps?f=d&saddr=New+York+Penn+Station&daddr=9th+Ave+%26+14th+St,+New+York,+NY&hl=en&geocode=&mra=ls&dirflg=r&date=11%2F12%2F08&time=4:13pm&ttype=dep&noexp=0&noal=0&sort=&sll=40.746175,-73.998395&sspn=0.014468,0.036392&ie=UTF8&z=14 diff --git a/url_shortener/url_shortener.py b/url_shortener/url_shortener.py index c9131e0..27683ae 100644 --- a/url_shortener/url_shortener.py +++ b/url_shortener/url_shortener.py @@ -32,7 +32,8 @@ class UrlShortenerPlugin(GajimPlugin): 'print_special_text': (self.print_special_text, self.print_special_text1),} self.config_default_values = { - 'MAX_CHARS': (50, _('MAX_CHARS(30-...)')), + 'MAX_CHARS': (50, ('MAX_CHARS(30-...)')), + 'IN_MAX_CHARS': (50, ('MAX_CHARS(30-...)')), 'SHORTEN_OUTGOING': (False, ''),} self.events_handlers['message-outgoing'] = (ged.OUT_PRECORE, self.handle_outgoing_msg) @@ -125,7 +126,7 @@ class Base(object): text_is_valid_uri = True if special_text.startswith('www.') or special_text.startswith('ftp.') \ or text_is_valid_uri and not is_xhtml_link: - if len(special_text) < self.plugin.config['MAX_CHARS']: + if len(special_text) < self.plugin.config['IN_MAX_CHARS']: return end_iter = buffer_.get_end_iter() mark = buffer_.create_mark(None, end_iter, True) @@ -202,6 +203,9 @@ class UrlShortenerPluginConfigDialog(GajimPluginConfigDialog): self.max_chars_spinbutton = self.xml.get_object('max_chars') self.max_chars_spinbutton.get_adjustment().set_all(30, 30, 99999, 1, 10, 0) + self.in_max_chars_spinbutton = self.xml.get_object('in_max_chars') + self.in_max_chars_spinbutton.get_adjustment().set_all(30, 30, 99999, 1, + 10, 0) self.shorten_outgoing = self.xml.get_object('shorten_outgoing') hbox = self.xml.get_object('vbox1') self.child.pack_start(hbox) @@ -210,10 +214,14 @@ class UrlShortenerPluginConfigDialog(GajimPluginConfigDialog): def on_run(self): self.max_chars_spinbutton.set_value(self.plugin.config['MAX_CHARS']) + self.in_max_chars_spinbutton.set_value(self.plugin.config['IN_MAX_CHARS']) self.shorten_outgoing.set_active(self.plugin.config['SHORTEN_OUTGOING']) def avatar_size_value_changed(self, spinbutton): self.plugin.config['MAX_CHARS'] = spinbutton.get_value() + def on_in_max_chars_value_changed(self, spinbutton): + self.plugin.config['IN_MAX_CHARS'] = spinbutton.get_value() + def shorten_outgoing_toggled(self, checkbutton): self.plugin.config['SHORTEN_OUTGOING'] = checkbutton.get_active()