gnome-terminal r2813 - trunk/src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-terminal r2813 - trunk/src
- Date: Thu, 29 May 2008 19:56:41 +0000 (UTC)
Author: chpe
Date: Thu May 29 19:56:40 2008
New Revision: 2813
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2813&view=rev
Log:
Add special callto: handling for the context menu. Bug #408922, based on the patches by Gilles Dartiguelongue.
Modified:
trunk/src/terminal-screen.c
trunk/src/terminal-screen.h
trunk/src/terminal-util.c
trunk/src/terminal-window.c
trunk/src/terminal.xml
Modified: trunk/src/terminal-screen.c
==============================================================================
--- trunk/src/terminal-screen.c (original)
+++ trunk/src/terminal-screen.c Thu May 29 19:56:40 2008
@@ -329,28 +329,38 @@
#define USERCHARS "-A-Za-z0-9"
#define PASSCHARS "-A-Za-z0-9,?;.:/!%$^*&~\"#'"
#define HOSTCHARS "-A-Za-z0-9"
+#define HOST "[" HOSTCHARS "]+(\\.[" HOSTCHARS "]+)*"
+#define PORT "(:[0-9]{1,5})?"
#define PATHCHARS "-A-Za-z0-9_$.+!*(),;:@&=?/~#%"
#define SCHEME "(news:|telnet:|nntp:|file:/|https?:|ftps?:|webcal:)"
#define USER "[" USERCHARS "]+(:["PASSCHARS "]+)?"
#define URLPATH "/[" PATHCHARS "]*[^]'.}>) \t\r\n,\\\"]"
terminal_screen_match_add (screen,
- "\\<" SCHEME "//(" USER "@)?[" HOSTCHARS ".]+"
- "(:[0-9]+)?(" URLPATH ")?\\>/?", FLAVOR_AS_IS);
+ "\\<" SCHEME "//(" USER "@)?" HOST
+ PORT "(" URLPATH ")?\\>/?",
+ FLAVOR_AS_IS);
terminal_screen_match_add (screen,
- "\\<(www|ftp)[" HOSTCHARS "]*\\.[" HOSTCHARS ".]+"
- "(:[0-9]+)?(" URLPATH ")?\\>/?",
- FLAVOR_DEFAULT_TO_HTTP);
+ "\\<(www|ftp)[" HOSTCHARS "]*\\." HOST
+ PORT "(" URLPATH ")?\\>/?",
+ FLAVOR_DEFAULT_TO_HTTP);
terminal_screen_match_add (screen,
- "\\<(mailto:)?[a-z0-9][a-z0-9 -]* [a-z0-9]"
- "[a-z0-9-]*(\\.[a-z0-9][a-z0-9-]*)+\\>",
- FLAVOR_EMAIL);
+ "\\<(mailto:)?[" USERCHARS "][" USERCHARS ".]*@"
+ "[" HOSTCHARS "]+\\." HOST "\\>",
+ FLAVOR_EMAIL);
terminal_screen_match_add (screen,
- "\\<news:[-A-Z\\^_a-z{|}~!\"#$%&'()*+,./0-9;:=?`]+"
- "@[" HOSTCHARS ".]+(:[0-9]+)?\\>", FLAVOR_AS_IS);
+ "\\<news:[-A-Z\\^_a-z{|}~!\"#$%&'()*+,./0-9;:=?`]+"
+ HOST PORT "\\>",
+ FLAVOR_AS_IS);
+
+ terminal_screen_match_add (screen,
+ "\\<(callto|h323|sip):[" USERCHARS "]"
+ "[" USERCHARS ".]*(" PORT "/[a-z0-9]+)?"
+ "@" HOST "\\>",
+ FLAVOR_VOIP_CALL);
/* Setup DND */
target_list = gtk_target_list_new (NULL, 0);
Modified: trunk/src/terminal-screen.h
==============================================================================
--- trunk/src/terminal-screen.h (original)
+++ trunk/src/terminal-screen.h Thu May 29 19:56:40 2008
@@ -29,6 +29,7 @@
typedef enum {
FLAVOR_AS_IS,
FLAVOR_DEFAULT_TO_HTTP,
+ FLAVOR_VOIP_CALL,
FLAVOR_EMAIL
} TerminalURLFlavour;
Modified: trunk/src/terminal-util.c
==============================================================================
--- trunk/src/terminal-util.c (original)
+++ trunk/src/terminal-util.c Thu May 29 19:56:40 2008
@@ -177,11 +177,12 @@
uri = g_strdup_printf ("http:%s", orig_url);
break;
case FLAVOR_EMAIL:
- if (strncmp ("mailto:", orig_url, 7))
+ if (g_ascii_strncasecmp ("mailto:", orig_url, 7) != 0)
uri = g_strdup_printf ("mailto:%s", orig_url);
else
uri = g_strdup (orig_url);
break;
+ case FLAVOR_VOIP_CALL:
case FLAVOR_AS_IS:
uri = g_strdup (orig_url);
break;
Modified: trunk/src/terminal-window.c
==============================================================================
--- trunk/src/terminal-window.c (original)
+++ trunk/src/terminal-window.c Thu May 29 19:56:40 2008
@@ -986,7 +986,7 @@
TerminalScreen *screen = info->screen;
GtkWidget *popup_menu, *im_menu, *im_menu_item;
GtkAction *action;
- gboolean can_paste, show_link, show_email_link, show_input_method_menu;
+ gboolean can_paste, show_link, show_email_link, show_call_link, show_input_method_menu;
remove_popup_info (window);
@@ -999,13 +999,18 @@
priv->popup_info = info; /* adopt the ref added when requesting the clipboard */
can_paste = gtk_targets_include_text (targets, n_targets);
- show_link = info->string != NULL && info->flavour != FLAVOR_EMAIL;
+ show_link = info->string != NULL && info->flavour != FLAVOR_EMAIL && info->flavour != FLAVOR_VOIP_CALL;
show_email_link = info->string != NULL && info->flavour == FLAVOR_EMAIL;
+ show_call_link = info->string != NULL && info->flavour == FLAVOR_VOIP_CALL;
action = gtk_action_group_get_action (priv->action_group, "PopupSendEmail");
gtk_action_set_visible (action, show_email_link);
action = gtk_action_group_get_action (priv->action_group, "PopupCopyEmailAddress");
gtk_action_set_visible (action, show_email_link);
+ action = gtk_action_group_get_action (priv->action_group, "PopupCall");
+ gtk_action_set_visible (action, show_call_link);
+ action = gtk_action_group_get_action (priv->action_group, "PopupCopyCallAddress");
+ gtk_action_set_visible (action, show_call_link);
action = gtk_action_group_get_action (priv->action_group, "PopupOpenLink");
gtk_action_set_visible (action, show_link);
action = gtk_action_group_get_action (priv->action_group, "PopupCopyLinkAddress");
@@ -1324,6 +1329,12 @@
{ "PopupCopyEmailAddress", NULL, N_("_Copy E-mail Address"), NULL,
NULL,
G_CALLBACK (popup_copy_url_callback) },
+ { "PopupCall", NULL, N_("C_all To..."), NULL,
+ NULL,
+ G_CALLBACK (popup_open_url_callback) },
+ { "PopupCopyCallAddress", NULL, N_("_Copy Call Address"), NULL,
+ NULL,
+ G_CALLBACK (popup_copy_url_callback) },
{ "PopupOpenLink", NULL, N_("_Open Link"), NULL,
NULL,
G_CALLBACK (popup_open_url_callback) },
Modified: trunk/src/terminal.xml
==============================================================================
--- trunk/src/terminal.xml (original)
+++ trunk/src/terminal.xml Thu May 29 19:56:40 2008
@@ -58,6 +58,8 @@
<popup name="Popup" action="Popup">
<menuitem action="PopupSendEmail" />
<menuitem action="PopupCopyEmailAddress" />
+ <menuitem action="PopupCall" />
+ <menuitem action="PopupCopyCallAddress" />
<menuitem action="PopupOpenLink" />
<menuitem action="PopupCopyLinkAddress" />
<separator />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]