[PATCH] Update paste sensitivity whenever clipboard changes - fixes #17
(originally reported and fixed here: https://bugzilla.gnome.org/show_bug.cgi?id=600876)master-1.22
parent
b2bc45fbca
commit
b8f33a3b2a
|
@ -1033,10 +1033,8 @@ update_edit_menu_cb (GtkClipboard *clipboard,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_menu_activate_callback (GtkMenuItem *menuitem,
|
update_edit_menu(TerminalWindow *window)
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
TerminalWindow *window = (TerminalWindow *) user_data;
|
|
||||||
GtkClipboard *clipboard;
|
GtkClipboard *clipboard;
|
||||||
|
|
||||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
|
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
|
||||||
|
@ -2087,6 +2085,7 @@ terminal_window_init (TerminalWindow *window)
|
||||||
GError *error;
|
GError *error;
|
||||||
GtkWindowGroup *window_group;
|
GtkWindowGroup *window_group;
|
||||||
GtkAccelGroup *accel_group;
|
GtkAccelGroup *accel_group;
|
||||||
|
GtkClipboard *clipboard;
|
||||||
|
|
||||||
priv = window->priv = G_TYPE_INSTANCE_GET_PRIVATE (window, TERMINAL_TYPE_WINDOW, TerminalWindowPrivate);
|
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);
|
gtk_ui_manager_insert_action_group (manager, action_group, 0);
|
||||||
g_object_unref (action_group);
|
g_object_unref (action_group);
|
||||||
|
|
||||||
action = gtk_action_group_get_action (action_group, "Edit");
|
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
|
||||||
g_signal_connect (action, "activate",
|
g_signal_connect_swapped (clipboard, "owner-change",
|
||||||
G_CALLBACK (edit_menu_activate_callback), window);
|
G_CALLBACK (update_edit_menu), window);
|
||||||
|
update_edit_menu (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);
|
|
||||||
|
|
||||||
/* Idem for this action, since the window is not fullscreen. */
|
/* Idem for this action, since the window is not fullscreen. */
|
||||||
action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen");
|
action = gtk_action_group_get_action (priv->action_group, "PopupLeaveFullscreen");
|
||||||
gtk_action_set_visible (action, FALSE);
|
gtk_action_set_visible (action, FALSE);
|
||||||
|
@ -2260,6 +2253,7 @@ terminal_window_dispose (GObject *object)
|
||||||
TerminalWindowPrivate *priv = window->priv;
|
TerminalWindowPrivate *priv = window->priv;
|
||||||
TerminalApp *app;
|
TerminalApp *app;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
|
GtkClipboard *clipboard;
|
||||||
|
|
||||||
remove_popup_info (window);
|
remove_popup_info (window);
|
||||||
|
|
||||||
|
@ -2283,6 +2277,10 @@ terminal_window_dispose (GObject *object)
|
||||||
g_signal_handlers_disconnect_by_func (app,
|
g_signal_handlers_disconnect_by_func (app,
|
||||||
G_CALLBACK (terminal_window_encoding_list_changed_cb),
|
G_CALLBACK (terminal_window_encoding_list_changed_cb),
|
||||||
window);
|
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));
|
screen = gtk_widget_get_screen (GTK_WIDGET (object));
|
||||||
if (screen)
|
if (screen)
|
||||||
|
|
Loading…
Reference in New Issue