From: Luca Padovani Date: Fri, 12 Sep 2003 10:20:14 +0000 (+0000) Subject: * using the clipboard to communicate the id of the selected subtree X-Git-Tag: v0_0_1~5 X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=commitdiff_plain;h=1e31fa8cde5e442f5713e01c31574f82d7a5e476 * using the clipboard to communicate the id of the selected subtree --- diff --git a/helm/gtkmathview-bonobo/src/handlers.c b/helm/gtkmathview-bonobo/src/handlers.c index cca4f1e9e..e7e100aa2 100644 --- a/helm/gtkmathview-bonobo/src/handlers.c +++ b/helm/gtkmathview-bonobo/src/handlers.c @@ -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); + } } }