diff options
author | Stefano Karapetsas <[email protected]> | 2014-01-02 11:04:50 -0800 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-01-02 11:04:50 -0800 |
commit | 540ddbef81387cbcc67f74d4fa2c128ca39bcc7a (patch) | |
tree | 95a2eb957dc09bf5b017be5bcb927bfee2ee338c /src/terminal-window.c | |
parent | af9e888f9f9d6d8d07e1f2edaf2f5e155cbad3b8 (diff) | |
parent | b26b432e3e867e7f3620b304fccf5c28a7ec989d (diff) | |
download | mate-terminal-540ddbef81387cbcc67f74d4fa2c128ca39bcc7a.tar.bz2 mate-terminal-540ddbef81387cbcc67f74d4fa2c128ca39bcc7a.tar.xz |
Merge pull request #48 from flexiondotorg/1.6
Cherry picks from `master` for `mate-terminal` 1.6
Diffstat (limited to 'src/terminal-window.c')
-rw-r--r-- | src/terminal-window.c | 93 |
1 files changed, 79 insertions, 14 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c index b33e33c..f8ad3c3 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -98,7 +98,7 @@ struct _TerminalWindowPrivate #define SET_ENCODING_UI_PATH "/menubar/Terminal/TerminalSetEncoding/EncodingsPH" #define SET_ENCODING_ACTION_NAME_PREFIX "TerminalSetEncoding" -#define PROFILES_UI_PATH "/menubar/Terminal/TerminalProfiles" +#define PROFILES_UI_PATH "/menubar/Terminal/TerminalProfiles/ProfilesPH" #define PROFILES_POPUP_UI_PATH "/Popup/PopupTerminalProfiles/ProfilesPH" #define SIZE_TO_UI_PATH "/menubar/Terminal/TerminalSizeToPH" @@ -197,6 +197,8 @@ static void search_find_prev_callback (GtkAction *action, TerminalWindow *window); static void search_clear_highlight_callback (GtkAction *action, TerminalWindow *window); +static void terminal_next_or_previous_profile_cb (GtkAction *action, + TerminalWindow *window); static void terminal_set_title_callback (GtkAction *action, TerminalWindow *window); static void terminal_add_encoding_callback (GtkAction *action, @@ -1033,10 +1035,8 @@ update_edit_menu_cb (GtkClipboard *clipboard, } static void -edit_menu_activate_callback (GtkMenuItem *menuitem, - gpointer user_data) +update_edit_menu(TerminalWindow *window) { - TerminalWindow *window = (TerminalWindow *) user_data; GtkClipboard *clipboard; clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); @@ -1925,6 +1925,16 @@ terminal_window_init (TerminalWindow *window) /* Terminal menu */ { "TerminalProfiles", NULL, N_("Change _Profile") }, { + "ProfilePrevious", NULL, N_("_Previous Profile"), "<alt>Page_Up", + NULL, + G_CALLBACK (terminal_next_or_previous_profile_cb) + }, + { + "ProfileNext", NULL, N_("_Next Profile"), "<alt>Page_Down", + NULL, + G_CALLBACK (terminal_next_or_previous_profile_cb) + }, + { "TerminalSetTitle", NULL, N_("_Set Titleā¦"), NULL, NULL, G_CALLBACK (terminal_set_title_callback) @@ -2087,6 +2097,7 @@ terminal_window_init (TerminalWindow *window) GError *error; GtkWindowGroup *window_group; GtkAccelGroup *accel_group; + GtkClipboard *clipboard; priv = window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, TERMINAL_TYPE_WINDOW, TerminalWindowPrivate); @@ -2160,16 +2171,10 @@ terminal_window_init (TerminalWindow *window) gtk_ui_manager_insert_action_group (manager, action_group, 0); g_object_unref (action_group); - action = gtk_action_group_get_action (action_group, "Edit"); - g_signal_connect (action, "activate", - G_CALLBACK (edit_menu_activate_callback), window); - - /* Set this action invisible so the Edit menu doesn't flash the first - * time it's shown and there's no text/uri-list on the clipboard. - */ - action = gtk_action_group_get_action (priv->action_group, "EditPasteURIPaths"); - gtk_action_set_visible (action, FALSE); - + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); + g_signal_connect_swapped (clipboard, "owner-change", + G_CALLBACK (update_edit_menu), window); + update_edit_menu (window); /* Idem for this action, since the window is not fullscreen. */ action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen"); gtk_action_set_visible (action, FALSE); @@ -2260,6 +2265,7 @@ terminal_window_dispose (GObject *object) TerminalWindowPrivate *priv = window->priv; TerminalApp *app; GdkScreen *screen; + GtkClipboard *clipboard; remove_popup_info (window); @@ -2283,6 +2289,10 @@ terminal_window_dispose (GObject *object) g_signal_handlers_disconnect_by_func (app, G_CALLBACK (terminal_window_encoding_list_changed_cb), window); + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); + g_signal_handlers_disconnect_by_func (clipboard, + G_CALLBACK (update_edit_menu), + window); screen = gtk_widget_get_screen (GTK_WIDGET (object)); if (screen) @@ -3779,6 +3789,61 @@ search_clear_highlight_callback (GtkAction *action, } static void +terminal_next_or_previous_profile_cb (GtkAction *action, + TerminalWindow *window) +{ + TerminalWindowPrivate *priv = window->priv; + TerminalProfile *active_profile, *new_profile; + GList *profiles, *p; + + const char *name; + guint backwards = 0; + + name = gtk_action_get_name (action); + if (strcmp (name, "ProfilePrevious") == 0) + { + backwards = 1; + } + + profiles = terminal_app_get_profile_list (terminal_app_get ()); + if (profiles == NULL) + return; + + if (priv->active_screen) + active_profile = terminal_screen_get_profile (priv->active_screen); + else + return; + + for (p = profiles; p != NULL; p = p->next) + { + TerminalProfile *profile = (TerminalProfile *) p->data; + if (profile == active_profile) + { + if (backwards) { + p = p->prev; + if (p == NULL) + p = g_list_last (profiles); + new_profile = p->data; + break; + } + else + { + p = p->next; + if (p == NULL) + p = g_list_first (profiles); + new_profile = p->data; + break; + } + } + } + + if (new_profile) + terminal_screen_set_profile (priv->active_screen, new_profile); + + g_list_free (profiles); +} + +static void terminal_set_title_dialog_response_cb (GtkWidget *dialog, int response, TerminalScreen *screen) |