diff options
author | George Stark <[email protected]> | 2023-01-19 18:12:02 +0300 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-08-31 14:25:41 +0200 |
commit | a060d180f0e5e44ab0d0972c42dc4e392f458892 (patch) | |
tree | 968516f99a79758b6d57a0a8e4cd498d71ae1de6 /src | |
parent | 0ba98fd1691157c9cce1f9910df09d8ee9daa444 (diff) | |
download | mate-terminal-a060d180f0e5e44ab0d0972c42dc4e392f458892.tar.bz2 mate-terminal-a060d180f0e5e44ab0d0972c42dc4e392f458892.tar.xz |
Refactoring
rename some url-related variables
rename TerminalURLFlavour enum to TerminalURLFlavor
backport of 0789b02ee11038743fde08795eb4a1ac0bcc3f47
from gnome-terminal to be a bit close to gnome-terminal source
Diffstat (limited to 'src')
-rw-r--r-- | src/terminal-screen.c | 30 | ||||
-rw-r--r-- | src/terminal-screen.h | 8 | ||||
-rw-r--r-- | src/terminal-util.c | 2 | ||||
-rw-r--r-- | src/terminal-util.h | 2 | ||||
-rw-r--r-- | src/terminal-window.c | 22 |
5 files changed, 32 insertions, 32 deletions
diff --git a/src/terminal-screen.c b/src/terminal-screen.c index b4993be..defe083 100644 --- a/src/terminal-screen.c +++ b/src/terminal-screen.c @@ -55,7 +55,7 @@ typedef struct { int tag; - TerminalURLFlavour flavor; + TerminalURLFlavor flavor; } TagData; struct _TerminalScreenPrivate @@ -163,7 +163,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; typedef struct { const char *pattern; - TerminalURLFlavour flavor; + TerminalURLFlavor flavor; guint32 flags; } TerminalRegexPattern; @@ -177,7 +177,7 @@ static const TerminalRegexPattern url_regex_patterns[] = }; static VteRegex **url_regexes; -static TerminalURLFlavour *url_regex_flavors; +static TerminalURLFlavor *url_regex_flavors; static guint n_url_regexes; static void terminal_screen_url_match_remove (TerminalScreen *screen); @@ -577,7 +577,7 @@ terminal_screen_class_init (TerminalScreenClass *klass) /* Precompile the regexes */ n_url_regexes = G_N_ELEMENTS (url_regex_patterns); url_regexes = g_new0 (VteRegex*, n_url_regexes); - url_regex_flavors = g_new0 (TerminalURLFlavour, n_url_regexes); + url_regex_flavors = g_new0 (TerminalURLFlavor, n_url_regexes); for (i = 0; i < n_url_regexes; ++i) { @@ -1680,7 +1680,7 @@ terminal_screen_popup_info_unref (TerminalScreenPopupInfo *info) return; g_object_unref (info->screen); - g_free (info->string); + g_free (info->url); g_slice_free (TerminalScreenPopupInfo, info); } @@ -1707,33 +1707,33 @@ terminal_screen_button_press (GtkWidget *widget, TerminalScreen *screen = TERMINAL_SCREEN (widget); gboolean (* button_press_event) (GtkWidget*, GdkEventButton*) = GTK_WIDGET_CLASS (terminal_screen_parent_class)->button_press_event; - char *matched_string; - int matched_flavor = 0; + char *url; + int url_flavor = 0; guint state; state = event->state & gtk_accelerator_get_default_mod_mask (); - matched_string = terminal_screen_check_match (screen, (GdkEvent*)event, &matched_flavor); + url = terminal_screen_check_match (screen, (GdkEvent*)event, &url_flavor); - if (matched_string != NULL && + if (url != NULL && (event->button == 1 || event->button == 2) && (state & GDK_CONTROL_MASK)) { gboolean handled = FALSE; #ifdef ENABLE_SKEY - if (matched_flavor != FLAVOR_SKEY || + if (url_flavor != FLAVOR_SKEY || terminal_profile_get_property_boolean (screen->priv->profile, TERMINAL_PROFILE_USE_SKEY)) #endif { g_signal_emit (screen, signals[MATCH_CLICKED], 0, - matched_string, - matched_flavor, + url, + url_flavor, state, &handled); } - g_free (matched_string); + g_free (url); if (handled) return TRUE; /* don't do anything else such as select with the click */ @@ -1748,8 +1748,8 @@ terminal_screen_button_press (GtkWidget *widget, info->button = event->button; info->state = state; info->timestamp = event->time; - info->string = matched_string; /* adopted */ - info->flavour = matched_flavor; + info->url = url; /* adopted */ + info->flavor = url_flavor; g_signal_emit (screen, signals[SHOW_POPUP_MENU], 0, info); terminal_screen_popup_info_unref (info); diff --git a/src/terminal-screen.h b/src/terminal-screen.h index d10ce81..c5cdb5d 100644 --- a/src/terminal-screen.h +++ b/src/terminal-screen.h @@ -35,7 +35,7 @@ typedef enum FLAVOR_VOIP_CALL, FLAVOR_EMAIL, FLAVOR_SKEY -} TerminalURLFlavour; +} TerminalURLFlavor; /* Forward decls */ typedef struct _TerminalScreenPopupInfo TerminalScreenPopupInfo; @@ -69,7 +69,7 @@ struct _TerminalScreenClass TerminalScreenPopupInfo *info); gboolean (* match_clicked) (TerminalScreen *screen, const char *url, - int flavour, + int url_flavor, guint state); void (* close_screen) (TerminalScreen *screen); }; @@ -147,8 +147,8 @@ struct _TerminalScreenPopupInfo int ref_count; TerminalWindow *window; TerminalScreen *screen; - char *string; - TerminalURLFlavour flavour; + char *url; + TerminalURLFlavor flavor; guint button; guint state; guint32 timestamp; diff --git a/src/terminal-util.c b/src/terminal-util.c index 3ef9040..ede72da 100644 --- a/src/terminal-util.c +++ b/src/terminal-util.c @@ -181,7 +181,7 @@ terminal_util_set_atk_name_description (GtkWidget *widget, void terminal_util_open_url (GtkWidget *parent, const char *orig_url, - TerminalURLFlavour flavor, + TerminalURLFlavor flavor, guint32 user_time) { GError *error = NULL; diff --git a/src/terminal-util.h b/src/terminal-util.h index ecb7767..190672f 100644 --- a/src/terminal-util.h +++ b/src/terminal-util.h @@ -51,7 +51,7 @@ void terminal_util_set_atk_name_description (GtkWidget *widget, void terminal_util_open_url (GtkWidget *parent, const char *orig_url, - TerminalURLFlavour flavor, + TerminalURLFlavor flavor, guint32 user_time); char *terminal_util_resolve_relative_path (const char *path, diff --git a/src/terminal-window.c b/src/terminal-window.c index 4608267..d23fd87 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -1375,7 +1375,7 @@ popup_open_url_callback (GtkAction *action, if (info == NULL) return; - terminal_util_open_url (GTK_WIDGET (window), info->string, info->flavour, + terminal_util_open_url (GTK_WIDGET (window), info->url, info->flavor, gtk_get_current_event_time ()); } @@ -1390,11 +1390,11 @@ popup_copy_url_callback (GtkAction *action, if (info == NULL) return; - if (info->string == NULL) + if (info->url == NULL) return; clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); - gtk_clipboard_set_text (clipboard, info->string, -1); + gtk_clipboard_set_text (clipboard, info->url, -1); } static void @@ -1494,9 +1494,9 @@ popup_clipboard_targets_received_cb (GtkClipboard *clipboard, can_paste = targets != NULL && gtk_targets_include_text (targets, n_targets); can_paste_uris = targets != NULL && gtk_targets_include_uri (targets, n_targets); - show_link = info->string != NULL && (info->flavour == FLAVOR_AS_IS || info->flavour == FLAVOR_DEFAULT_TO_HTTP); - show_email_link = info->string != NULL && info->flavour == FLAVOR_EMAIL; - show_call_link = info->string != NULL && info->flavour == FLAVOR_VOIP_CALL; + show_link = info->url != NULL && (info->flavor == FLAVOR_AS_IS || info->flavor == FLAVOR_DEFAULT_TO_HTTP); + show_email_link = info->url != NULL && info->flavor == FLAVOR_EMAIL; + show_call_link = info->url != NULL && info->flavor == FLAVOR_VOIP_CALL; G_GNUC_BEGIN_IGNORE_DEPRECATIONS; action = gtk_action_group_get_action (priv->action_group, "PopupSendEmail"); @@ -1576,8 +1576,8 @@ screen_show_popup_menu_callback (TerminalScreen *screen, static gboolean screen_match_clicked_cb (TerminalScreen *screen, - const char *match, - int flavour, + const char *url, + int url_flavor, guint state, TerminalWindow *window) { @@ -1586,16 +1586,16 @@ screen_match_clicked_cb (TerminalScreen *screen, if (screen != priv->active_screen) return FALSE; - switch (flavour) + switch (url_flavor) { #ifdef ENABLE_SKEY case FLAVOR_SKEY: - terminal_skey_do_popup (GTK_WINDOW (window), screen, match); + terminal_skey_do_popup (GTK_WINDOW (window), screen, url); break; #endif default: gtk_widget_grab_focus (GTK_WIDGET (screen)); - terminal_util_open_url (GTK_WIDGET (window), match, flavour, + terminal_util_open_url (GTK_WIDGET (window), url, url_flavor, gtk_get_current_event_time ()); break; } |