[gnome-terminal] Update paste sensitivity whenever clipboard changes
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] Update paste sensitivity whenever clipboard changes
- Date: Sun, 20 Mar 2011 20:59:53 +0000 (UTC)
commit 4a17cb516a4b24bc4d845574b1c1d9efc5ce4cb5
Author: Michael Terry <michael terry canonical com>
Date: Mon Mar 7 10:33:13 2011 -0500
Update paste sensitivity whenever clipboard changes
Bug #600876.
src/terminal-window.c | 29 ++++++++++++++---------------
1 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index d98d44a..1b5b46b 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1038,13 +1038,10 @@ update_edit_menu_cb (GtkClipboard *clipboard,
}
static void
-edit_menu_activate_callback (GtkMenuItem *menuitem,
- gpointer user_data)
+update_edit_menu (GtkClipboard *clipboard,
+ GdkEvent *event G_GNUC_UNUSED,
+ TerminalWindow *window)
{
- TerminalWindow *window = (TerminalWindow *) user_data;
- GtkClipboard *clipboard;
-
- clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
gtk_clipboard_request_targets (clipboard,
(GtkClipboardTargetsReceivedFunc) update_edit_menu_cb,
g_object_ref (window));
@@ -2003,6 +2000,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);
@@ -2089,15 +2087,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);
+ update_edit_menu (clipboard, NULL, window);
+ g_signal_connect (clipboard, "owner-change",
+ G_CALLBACK (update_edit_menu), window);
/* Idem for this action, since the window is not fullscreen. */
action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen");
@@ -2182,6 +2175,7 @@ terminal_window_dispose (GObject *object)
TerminalWindowPrivate *priv = window->priv;
TerminalApp *app;
GdkScreen *screen;
+ GtkClipboard *clipboard;
remove_popup_info (window);
@@ -2206,6 +2200,11 @@ terminal_window_dispose (GObject *object)
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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]