diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org.mate.terminal.gschema.xml.in | 5 | ||||
-rw-r--r-- | src/profile-editor.c | 17 | ||||
-rw-r--r-- | src/profile-preferences.ui | 42 | ||||
-rw-r--r-- | src/terminal-profile.c | 4 | ||||
-rw-r--r-- | src/terminal-profile.h | 1 | ||||
-rw-r--r-- | src/terminal-screen.c | 64 |
6 files changed, 113 insertions, 20 deletions
diff --git a/src/org.mate.terminal.gschema.xml.in b/src/org.mate.terminal.gschema.xml.in index 2e0659c..2ab3d7e 100644 --- a/src/org.mate.terminal.gschema.xml.in +++ b/src/org.mate.terminal.gschema.xml.in @@ -278,6 +278,11 @@ <summary>Highlight S/Key challenges</summary> <description>Popup a dialog when an S/Key challenge response query is detected and clicked on. Typing a password into the dialog will send it to the terminal.</description> </key> + <key name="use-urls" type="b"> + <default>true</default> + <summary>Highlight URLs under mouse pointer</summary> + <description>If true, URLs under mouse pointer are highlighted and can be opened by mouse click together with control key or used in context menu.</description> + </key> </schema> <schema id="org.mate.terminal.keybindings" path="/org/mate/terminal/keybindings/"> <key name="new-tab" type="s"> diff --git a/src/profile-editor.c b/src/profile-editor.c index fc13235..e0d54b2 100644 --- a/src/profile-editor.c +++ b/src/profile-editor.c @@ -253,6 +253,15 @@ profile_notify_sensitivity_cb (TerminalProfile *profile, SET_SENSITIVE ("copy-checkbutton", !terminal_profile_property_locked (profile, TERMINAL_PROFILE_COPY_SELECTION)); +#ifdef ENABLE_SKEY + if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_SKEY)) + SET_SENSITIVE ("use-skey-checkbutton", + !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_SKEY)); +#endif + if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_URLS)) + SET_SENSITIVE ("use-urls-checkbutton", + !terminal_profile_property_locked (profile, TERMINAL_PROFILE_USE_URLS)); + if (!prop_name || prop_name == I_(TERMINAL_PROFILE_WORD_CHARS)) SET_SENSITIVE ("word-chars-entry", !terminal_profile_property_locked (profile, TERMINAL_PROFILE_WORD_CHARS)); @@ -683,7 +692,9 @@ terminal_profile_edit (TerminalProfile *profile, editor = (GtkWidget *) gtk_builder_get_object (builder, "profile-editor-dialog"); g_object_set_data_full (G_OBJECT (editor), "builder", builder, (GDestroyNotify) g_object_unref); - +#ifndef ENABLE_SKEY + gtk_widget_hide (profile_editor_get_widget (editor, "use-skey-checkbutton")); +#endif /* Store the dialogue on the profile, so we can acccess it above to check if * there's already a profile editor for this profile. */ @@ -818,6 +829,10 @@ terminal_profile_edit (TerminalProfile *profile, CONNECT_WITH_FLAGS ("bell-checkbutton", TERMINAL_PROFILE_SILENT_BELL, FLAG_INVERT_BOOL); /* CONNECT_WITH_FLAGS ("copy-checkbutton", TERMINAL_PROFILE_COPY_SELECTION, FLAG_INVERT_BOOL); */ CONNECT ("copy-checkbutton", TERMINAL_PROFILE_COPY_SELECTION); +#ifdef ENABLE_SKEY + CONNECT ("use-skey-checkbutton", TERMINAL_PROFILE_USE_SKEY); +#endif + CONNECT ("use-urls-checkbutton", TERMINAL_PROFILE_USE_URLS); #undef CONNECT #undef CONNECT_WITH_FLAGS diff --git a/src/profile-preferences.ui b/src/profile-preferences.ui index 131a810..59734dc 100644 --- a/src/profile-preferences.ui +++ b/src/profile-preferences.ui @@ -470,6 +470,38 @@ Author: Wolfgang Ulbrich </packing> </child> <child> + <object class="GtkCheckButton" id="use-skey-checkbutton"> + <property name="label" translatable="yes">Highlight _S/Key challenges under mouse pointer</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">7</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="use-urls-checkbutton"> + <property name="label" translatable="yes">Highlight _URLs under mouse pointer</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">8</property> + </packing> + </child> + <child> <object class="GtkBox" id="hbox147"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -513,7 +545,7 @@ Author: Wolfgang Ulbrich <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">7</property> + <property name="position">9</property> </packing> </child> <child> @@ -560,7 +592,7 @@ Author: Wolfgang Ulbrich <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">8</property> + <property name="position">10</property> </packing> </child> <child> @@ -600,7 +632,7 @@ Author: Wolfgang Ulbrich <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">9</property> + <property name="position">11</property> </packing> </child> <child> @@ -616,7 +648,7 @@ Author: Wolfgang Ulbrich <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">10</property> + <property name="position">12</property> </packing> </child> <child> @@ -727,7 +759,7 @@ Author: Wolfgang Ulbrich <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">11</property> + <property name="position">13</property> </packing> </child> </object> diff --git a/src/terminal-profile.c b/src/terminal-profile.c index 02daa6a..ab25741 100644 --- a/src/terminal-profile.c +++ b/src/terminal-profile.c @@ -79,6 +79,7 @@ enum PROP_USE_CUSTOM_COMMAND, PROP_USE_CUSTOM_DEFAULT_SIZE, PROP_USE_SKEY, + PROP_USE_URLS, PROP_USE_SYSTEM_FONT, PROP_USE_THEME_COLORS, PROP_VISIBLE_NAME, @@ -120,6 +121,7 @@ enum #define KEY_USE_CUSTOM_COMMAND "use-custom-command" #define KEY_USE_CUSTOM_DEFAULT_SIZE "use-custom-default-size" #define KEY_USE_SKEY "use-skey" +#define KEY_USE_URLS "use-urls" #define KEY_USE_SYSTEM_FONT "use-system-font" #define KEY_USE_THEME_COLORS "use-theme-colors" #define KEY_VISIBLE_NAME "visible-name" @@ -160,6 +162,7 @@ enum #define DEFAULT_USE_CUSTOM_COMMAND (FALSE) #define DEFAULT_USE_CUSTOM_DEFAULT_SIZE (FALSE) #define DEFAULT_USE_SKEY (TRUE) +#define DEFAULT_USE_URLS (TRUE) #define DEFAULT_USE_SYSTEM_FONT (TRUE) #define DEFAULT_USE_THEME_COLORS (TRUE) #define DEFAULT_VISIBLE_NAME (N_("Unnamed")) @@ -1298,6 +1301,7 @@ terminal_profile_class_init (TerminalProfileClass *klass) TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_COMMAND, DEFAULT_USE_CUSTOM_COMMAND, KEY_USE_CUSTOM_COMMAND); TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_CUSTOM_DEFAULT_SIZE, DEFAULT_USE_CUSTOM_DEFAULT_SIZE, KEY_USE_CUSTOM_DEFAULT_SIZE); TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SKEY, DEFAULT_USE_SKEY, KEY_USE_SKEY); + TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_URLS, DEFAULT_USE_URLS, KEY_USE_URLS); TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_SYSTEM_FONT, DEFAULT_USE_SYSTEM_FONT, KEY_USE_SYSTEM_FONT); TERMINAL_PROFILE_PROPERTY_BOOLEAN (USE_THEME_COLORS, DEFAULT_USE_THEME_COLORS, KEY_USE_THEME_COLORS); diff --git a/src/terminal-profile.h b/src/terminal-profile.h index 007766f..d8f41b2 100644 --- a/src/terminal-profile.h +++ b/src/terminal-profile.h @@ -101,6 +101,7 @@ typedef enum #define TERMINAL_PROFILE_USE_CUSTOM_COMMAND "use-custom-command" #define TERMINAL_PROFILE_USE_CUSTOM_DEFAULT_SIZE "use-custom-default-size" #define TERMINAL_PROFILE_USE_SKEY "use-skey" +#define TERMINAL_PROFILE_USE_URLS "use-urls" #define TERMINAL_PROFILE_USE_SYSTEM_FONT "use-system-font" #define TERMINAL_PROFILE_USE_THEME_COLORS "use-theme-colors" #define TERMINAL_PROFILE_VISIBLE_NAME "visible-name" diff --git a/src/terminal-screen.c b/src/terminal-screen.c index b4e7460..eb8eeee 100644 --- a/src/terminal-screen.c +++ b/src/terminal-screen.c @@ -174,6 +174,9 @@ static GRegex **url_regexes; static TerminalURLFlavour *url_regex_flavors; static guint n_url_regexes; +static void terminal_screen_url_match_remove (TerminalScreen *screen); + + #ifdef ENABLE_SKEY static const TerminalRegexPattern skey_regex_patterns[] = { @@ -333,12 +336,10 @@ terminal_screen_init (TerminalScreen *screen) { "text/x-moz-url", 0, TARGET_MOZ_URL }, { "_NETSCAPE_URL", 0, TARGET_NETSCAPE_URL } }; - VteTerminal *terminal = VTE_TERMINAL (screen); TerminalScreenPrivate *priv; GtkTargetList *target_list; GtkTargetEntry *targets; int n_targets; - guint i; priv = screen->priv = G_TYPE_INSTANCE_GET_PRIVATE (screen, TERMINAL_TYPE_SCREEN, TerminalScreenPrivate); @@ -351,18 +352,6 @@ terminal_screen_init (TerminalScreen *screen) priv->font_scale = PANGO_SCALE_MEDIUM; - for (i = 0; i < n_url_regexes; ++i) - { - TagData *tag_data; - - tag_data = g_slice_new (TagData); - tag_data->flavor = url_regex_flavors[i]; - tag_data->tag = vte_terminal_match_add_gregex (terminal, url_regexes[i], 0); - vte_terminal_match_set_cursor_type (terminal, tag_data->tag, URL_MATCH_CURSOR); - - priv->match_tags = g_slist_prepend (priv->match_tags, tag_data); - } - /* Setup DND */ target_list = gtk_target_list_new (NULL, 0); gtk_target_list_add_uri_targets (target_list, 0); @@ -1060,6 +1049,29 @@ terminal_screen_profile_notify_cb (TerminalProfile *profile, vte_terminal_set_cursor_shape (vte_terminal, terminal_profile_get_property_enum (priv->profile, TERMINAL_PROFILE_CURSOR_SHAPE)); + if (!prop_name || prop_name == I_(TERMINAL_PROFILE_USE_URLS)) + { + if (terminal_profile_get_property_boolean (profile, TERMINAL_PROFILE_USE_URLS)) + { + guint i; + + for (i = 0; i < n_url_regexes; ++i) + { + TagData *tag_data; + + tag_data = g_slice_new (TagData); + tag_data->flavor = url_regex_flavors[i]; + tag_data->tag = vte_terminal_match_add_gregex (vte_terminal, url_regexes[i], 0); + vte_terminal_match_set_cursor_type (vte_terminal, tag_data->tag, URL_MATCH_CURSOR); + + priv->match_tags = g_slist_prepend (priv->match_tags, tag_data); + } + } + else + { + terminal_screen_url_match_remove (screen); + } + } g_object_thaw_notify (object); } @@ -2312,6 +2324,30 @@ terminal_screen_skey_match_remove (TerminalScreen *screen) } #endif /* ENABLE_SKEY */ +static void +terminal_screen_url_match_remove (TerminalScreen *screen) +{ + TerminalScreenPrivate *priv = screen->priv; + GSList *l, *next; + + l = priv->match_tags; + while (l != NULL) + { + TagData *tag_data = (TagData *) l->data; + + next = l->next; +#ifdef ENABLE_SKEY + if (tag_data->flavor != FLAVOR_SKEY) +#endif + { + vte_terminal_match_remove (VTE_TERMINAL (screen), tag_data->tag); + priv->match_tags = g_slist_delete_link (priv->match_tags, l); + } + + l = next; + } +} + static char* terminal_screen_check_match (TerminalScreen *screen, GdkEvent *event, |