diff options
author | Stefano Karapetsas <[email protected]> | 2013-08-04 07:30:28 -0700 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-08-04 07:30:28 -0700 |
commit | 5d832f711d0a275154e921859617cc8697b37457 (patch) | |
tree | 7e6ccaa0338ba77de60b3049a565c2857a0ebff1 | |
parent | 69be83e2afbc0d1f2e436434bcb6bdc1cf60260a (diff) | |
parent | b8f33a3b2a13944736b5f790a44d64cdabc68308 (diff) | |
download | mate-terminal-5d832f711d0a275154e921859617cc8697b37457.tar.bz2 mate-terminal-5d832f711d0a275154e921859617cc8697b37457.tar.xz |
Merge pull request #25 from dbravender/issue-17-paste-sometimes-doesnt-work
[PATCH] Update paste sensitivity whenever clipboard changes - fixes #17
-rw-r--r-- | src/terminal-window.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c index b33e33c..92276a5 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -1033,10 +1033,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); @@ -2087,6 +2085,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 +2159,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 +2253,7 @@ terminal_window_dispose (GObject *object) TerminalWindowPrivate *priv = window->priv; TerminalApp *app; GdkScreen *screen; + GtkClipboard *clipboard; remove_popup_info (window); @@ -2283,6 +2277,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) |