summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Terry <[email protected]>2013-04-14 17:17:14 +0900
committerMartin Wimpress <[email protected]>2014-01-02 11:48:51 +0000
commit032d69ae89332e79977b9c4b6322fddfb8627aba (patch)
tree343bb9d1219822296a3e85526c0c6f9ca48b8dfd
parentaf9e888f9f9d6d8d07e1f2edaf2f5e155cbad3b8 (diff)
downloadmate-terminal-032d69ae89332e79977b9c4b6322fddfb8627aba.tar.bz2
mate-terminal-032d69ae89332e79977b9c4b6322fddfb8627aba.tar.xz
[PATCH] Update paste sensitivity whenever clipboard changes - fixes #17
(originally reported and fixed here: https://bugzilla.gnome.org/show_bug.cgi?id=600876)
-rw-r--r--src/terminal-window.c24
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)