[sylpheed:34648] Re: Plugin system

HAYASHI Kentaro kenhys at gmail.com
Mon Jul 11 22:24:19 JST 2011


Hi,

I do not know rikaichan well, but following code snippet may be
meaningfull for you.


a) connect motion-notify-event signal to  textview

GtkWidget* text = ((MessageView*)msgview)->textview->text;
    g_signal_connect(G_OBJECT(text), "motion-notify-event",
			 G_CALLBACK(textview_motion_notify), msgview);

b) get mouse coords in textview_motion_notify.
gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(widget),
					      GTK_TEXT_WINDOW_WIDGET,
					      event->x, event->y, &x, &y);
c) get GtkTextIter and retrieve text
  gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(widget), &iter, x, y);
d) popup text under mouse or anything you want.



On Mon, Jul 11, 2011 at 4:49 PM, Marco Bresciani <m.bresciani at email.it> wrote:
>        --------- Original Message --------
>        Da: sylpheed at sraoss.jp
>
>> > Well, promise I'll read the plugin specs, here
>> > http://sylpheed.sraoss.jp/wiki/index.php?PluginSpec , could someone help
> me
>> > with this plugin?
>
>> It is possible a plug-in to get the contents of selected text by
>> "textview_menu_popup" signal. It requires context menu to be opened by
>> right button click, though. You will be able to create a context-menu
>> based one ('menu -> Translate selected' or something).
>
> Yamamoto san, arigatou gozaimashita.
>
> So it's not (yet?) possible to proceed like the current Firefox/Thunderbird
> rikaichan plugin? That plugin does not need to select the text and open the
> popup but, when enabled, it automatically highlights the text under the
> mouse (if it's Japanese text) and shows the information in a tooltip while
> (for example) pressing enter switches between the installed dictionaries
> (words, kanjis or names).
>
> Well, in the meanwhile I think I can try to proceed according to your
> suggestion. Studying...
>
>
> Marco
>  --
>  Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
> autenticato? GRATIS solo con Email.it: http://www.email.it/f
>
>  Sponsor:
>  LastMinute dal 30/7 al 13/8 Bilocali da 4 posti letto sul mare da euro 750
> a settimana.
> Residence Casa Del Mar-Roseto degli Abruzzi, tel 0858992100
>
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=11660&d=20110711
>
>
>



-- 
HAYASHI Kentaro <kenhys at gmail.com>


More information about the Sylpheed mailing list