adding gtkspell and #323

This commit is contained in:
Nikos Kouremenos 2005-05-25 23:58:27 +00:00
parent 9bc2c5781e
commit c1e472bcbd
2 changed files with 130 additions and 38 deletions

View File

@ -23,6 +23,11 @@ import pango
import gobject import gobject
import time import time
try:
import gtkspell
except:
pass
from common import gajim from common import gajim
from common import i18n from common import i18n
@ -143,7 +148,7 @@ class Chat:
self.remove_tab(jid) self.remove_tab(jid)
def on_chat_window_focus_in_event(self, widget, event): def on_chat_window_focus_in_event(self, widget, event):
"""When window get focus""" """When window gets focus"""
jid = self.get_active_jid() jid = self.get_active_jid()
textview = self.xmls[jid].get_widget('conversation_textview') textview = self.xmls[jid].get_widget('conversation_textview')
buffer = textview.get_buffer() buffer = textview.get_buffer()
@ -225,6 +230,10 @@ class Chat:
self.nb_unread[jid] = 0 self.nb_unread[jid] = 0
self.last_message_time[jid] = 0 self.last_message_time[jid] = 0
if gajim.config.get('use_speller') and 'gtk' in locals():
message_textview = self.xmls[jid].get_widget('message_textview')
gtkspell.Spell(message_textview)
conversation_textview = self.xmls[jid].get_widget( conversation_textview = self.xmls[jid].get_widget(
'conversation_textview') 'conversation_textview')
conversation_buffer = conversation_textview.get_buffer() conversation_buffer = conversation_textview.get_buffer()
@ -478,30 +487,29 @@ class Chat:
del self.print_time_timeout_id[jid] del self.print_time_timeout_id[jid]
return 0 return 0
def on_open_link_activated(self, widget, kind, text): def on_open_link_activate(self, widget, kind, text):
self.plugin.launch_browser_mailer(kind, text) self.plugin.launch_browser_mailer(kind, text)
def on_copy_link_activated(self, widget, text): def on_copy_link_activate(self, widget, text):
clip = gtk.clipboard_get() clip = gtk.clipboard_get()
clip.set_text(text) clip.set_text(text)
def make_link_menu(self, event, kind, text): def make_link_menu(self, event, kind, text):
menu = gtk.Menu() xml = gtk.glade.XML(GTKGUI_GLADE, 'chat_context_menu', APP)
if kind == 'mail': menu = xml.get_widget('chat_context_menu')
item = gtk.MenuItem(_('_Open Email Composer')) childs = menu.get_children()
else: if kind == 'url':
item = gtk.MenuItem(_('_Open Link')) childs[0].connect('activate', self.on_copy_link_activate, text)
item.connect('activate', self.on_open_link_activated, kind, text) childs[1].connect('activate', self.on_open_link_activate, kind, text)
menu.append(item) childs[2].hide() # copy mail address
if kind == 'mail': childs[3].hide() # open mail composer
item = gtk.MenuItem(_('_Copy Email Address')) else: # It's a mail
else: # It's an url childs[2].connect('activate', self.on_copy_link_activate, text)
item = gtk.MenuItem(_('_Copy Link Address')) childs[3].connect('activate', self.on_open_link_activate, kind, text)
item.connect('activate', self.on_copy_link_activated, text) childs[0].hide() # copy link location
menu.append(item) childs[1].hide() # open link in browser
menu.popup(None, None, None, event.button, event.time) menu.popup(None, None, None, event.button, event.time)
menu.show_all()
menu.reposition() menu.reposition()
def hyperlink_handler(self, texttag, widget, event, iter, kind): def hyperlink_handler(self, texttag, widget, event, iter, kind):

View File

@ -321,6 +321,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<signal name="destroy" handler="on_accounts_window_destroy" last_modification_time="Sat, 02 Apr 2005 20:34:04 GMT"/> <signal name="destroy" handler="on_accounts_window_destroy" last_modification_time="Sat, 02 Apr 2005 20:34:04 GMT"/>
<signal name="key_press_event" handler="on_accounts_window_key_press_event" last_modification_time="Wed, 25 May 2005 23:19:56 GMT"/>
<child> <child>
<widget class="GtkVBox" id="vbox5"> <widget class="GtkVBox" id="vbox5">
@ -3108,6 +3109,27 @@
<property name="homogeneous">False</property> <property name="homogeneous">False</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<child>
<widget class="GtkCheckButton" id="transports_iconsets_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">If checked, Gajim will use protocol-specific status icons. (eg. A contact from MSN will have the equivalent msn icon for status online, away, busy, etc...)</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use _transports iconsets</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_transports_iconsets_checkbutton_toggled" last_modification_time="Wed, 25 May 2005 17:03:55 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label174"> <widget class="GtkLabel" id="label174">
<property name="visible">True</property> <property name="visible">True</property>
@ -3142,27 +3164,6 @@
<property name="fill">True</property> <property name="fill">True</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkCheckButton" id="transports_iconsets_checkbutton">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">If checked, Gajim will use protocol-specific status icons. (eg. A contact from MSN will have the equivalent msn icon for status online, away, busy, etc...)</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use _transports iconsets</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_transports_iconsets_checkbutton_toggled" last_modification_time="Wed, 25 May 2005 17:03:55 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>
@ -11201,4 +11202,87 @@ send a chat message to</property>
</child> </child>
</widget> </widget>
<widget class="GtkMenu" id="chat_context_menu">
<child>
<widget class="GtkImageMenuItem" id="copy_link_location_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Copy Link Location</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image593">
<property name="visible">True</property>
<property name="stock">gtk-copy</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="open_link_in_browser_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Open Link in Browser</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image594">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="copy_email_address_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Copy Email Address</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image595">
<property name="visible">True</property>
<property name="stock">gtk-copy</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="open_email_composer_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Open Email Composer</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image596">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>