]> matita.cs.unibo.it Git - helm.git/commitdiff
* using the clipboard to communicate the id of the selected subtree
authorLuca Padovani <luca.padovani@unito.it>
Fri, 12 Sep 2003 10:20:14 +0000 (10:20 +0000)
committerLuca Padovani <luca.padovani@unito.it>
Fri, 12 Sep 2003 10:20:14 +0000 (10:20 +0000)
helm/gtkmathview-bonobo/src/handlers.c

index cca4f1e9e51fa82b5c798b62e2d434a8ecc2bc90..e7e100aa22125e2d6a59ddb6183ba5b851360164 100644 (file)
@@ -1,6 +1,13 @@
 
 #include "handlers.h"
 
+static void
+set_clipboard(GdomeDOMString* data)
+{
+  GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+  gtk_clipboard_set_text(clipboard, data->str, gdome_str_length(data));
+}
+
 void
 set_frame(BonoboControl *control, gpointer data)
 {     
@@ -22,7 +29,8 @@ click_cb(GtkMathView* math_view, GdomeElement* elem, gint state,
 
       if (href != NULL)
        {
-          gtk_math_view_load_uri(math_view,href->str);
+          /*gtk_math_view_load_uri(math_view,href->str);*/
+         set_clipboard(href);
           gdome_str_unref(href);
          return;
        }
@@ -151,6 +159,19 @@ select_end_cb(GtkMathView* math_view, GdomeElement* elem, gint state,
       gdome_el_unref(control_data->first_selected, &exc);
       g_assert(exc == 0);
       control_data->first_selected = NULL;
+
+      if (control_data->root_selected != NULL &&
+         (control_data->id_ns_uri != NULL || control_data->id_name != NULL))
+       {
+         GdomeException exc = 0;
+         GdomeDOMString* id = gdome_el_getAttributeNS(control_data->root_selected,
+                                                      control_data->id_ns_uri,
+                                                      control_data->id_name, &exc);
+         g_assert(exc == 0);
+         g_assert(id != NULL);
+         set_clipboard(id);
+         gdome_str_unref(id);
+       }
     }
 }