[devhelp] Make Ctrl+C copy the symbol name in the symbol listing pane



commit 4e6fa0cfb1db25c9a652de71091a33797748d840
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat Aug 29 18:55:13 2009 +0200

    Make Ctrl+C copy the symbol name in the symbol listing pane
    
    http://bugzilla.gnome.org/show_bug.cgi?id=578964

 src/dh-window.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index 5d5f496..ba3ff0a 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -55,6 +55,8 @@ struct _DhWindowPriv {
 
         GtkUIManager   *manager;
         GtkActionGroup *action_group;
+
+        DhLink         *selected_search_link;
 };
 
 enum {
@@ -210,11 +212,21 @@ window_activate_copy (GtkAction *action,
                       DhWindow  *window)
 {
         GtkWidget *widget;
+        DhWindowPriv  *priv;
+
+        priv = window->priv;
 
         widget = gtk_window_get_focus (GTK_WINDOW (window));
 
         if (GTK_IS_EDITABLE (widget)) {
                 gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
+        } else if (GTK_IS_TREE_VIEW (widget) &&
+                   gtk_widget_is_ancestor (widget, priv->search) &&
+                   priv->selected_search_link) {
+                GtkClipboard *clipboard;
+                clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_CLIPBOARD);
+                gtk_clipboard_set_text (clipboard,
+                                dh_link_get_name(priv->selected_search_link), -1);
         } else {
                 WebKitWebView *web_view;
 
@@ -574,6 +586,8 @@ dh_window_init (DhWindow *window)
         priv = GET_PRIVATE (window);
         window->priv = priv;
 
+        priv->selected_search_link = NULL;
+
         priv->manager = gtk_ui_manager_new ();
 
         accel_group = gtk_ui_manager_get_accel_group (priv->manager);
@@ -958,6 +972,8 @@ window_search_link_selected_cb (GObject  *ignored,
 
         priv = window->priv;
 
+        priv->selected_search_link = link;
+
         view = window_get_active_web_view (window);
 
         uri = dh_link_get_uri (link);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]