Re: [GnomeMeeting-devel-list] Do you like smileys?
- From: PUYDT Julien <julien puydt laposte net>
- To: GnomeMeeting Devel Liste <gnomemeeting-devel-list gnome org>
- Subject: Re: [GnomeMeeting-devel-list] Do you like smileys?
- Date: Thu, 02 Oct 2003 09:14:47 +0200
On mer, 2003-10-01 at 21:52, Stephane Wirtel wrote:
> What's the problem with the actual code ?
Well, there was the code to detect smileys (works great), then I added
code to detect uris (ie: right-click and you can copy the link location,
or open it).
That made _two_ detection systems, that had to be stacked (this is what
is in gm now -- if Damien didn't apply the patch I sent yesterday
evening).
That was one too many, hence I modified my code, so that it became able
to recognize both smileys and uris ; which makes for a single detection
system, hence less code.
For example, here is the code in src/chat_window.cpp, to take care of
http/ftp uris:
GtkTextTag *regex_tag;
regex_tag = gtk_text_buffer_create_tag (chat->text_buffer, "uri-http",
"foreground", "blue",
NULL);
if (gtk_text_tag_set_regex (regex_tag,
"\\<([s]?(ht|f)tp://[^[:blank:]]+)\\>")) {
gtk_text_tag_add_actions_to_regex (regex_tag,
#ifndef DISABLE_GNOME
_("Open URI"),
open_uri_callback,
#endif
_("Copy Link Location"),
copy_uri_callback,
NULL);
}
else
g_warning (_("Couldn't compile http/ftp regex!"));
Of course, that's short because the code responsible for the popup, and
changing the cursor to a pointing hand, is hidden in
lib/gtk-text-*-addon.[ch].
This allows to handle in a generic way:
* uris (http, ftp), written in blue, with a menu that allows to
copy/open the link;
* h323 adresses, written in pink, with a menu that allows to
copy/open/add to adressbook the link (notice: the two last functions are
dummy g_warning functions, hence don't work atm);
* smileys, displayed as pictures, with mostly the same as before, except
the :0 -> :O and :-0 -> :-O previously discussed (I'm wondering if 8)
shouldn't disappear to keep only 8-), to solve that little problem;
* latex equation: any text between single or double $, will be
interpreted as a latex equation, and appear in grey, with a "Copy
equation" menu.
In short: nothing wrong with the previous smiley code...
Snark
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]