]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/gtkmathview-bonobo/src/control-data.c
* advanced implementation of View interface
[helm.git] / helm / gtkmathview-bonobo / src / control-data.c
index 382ea8d1d12545412855d8c5051b1f14ac198b60..10f06491c338a197cd9e04ddd78b6e39c35561e6 100644 (file)
@@ -9,6 +9,8 @@ gtk_math_view_control_data_new(GtkMathView *math_view)
   cd->semantic_selection = FALSE;
   cd->first_selected = NULL;
   cd->root_selected = NULL;
+  cd->id_ns_uri = NULL;
+  cd->id_name = NULL;
   return cd;
 }
 
@@ -30,6 +32,34 @@ gtk_math_view_control_data_destroy(GtkMathViewControlData* cd)
       g_assert(exc == 0);
       cd->root_selected = NULL;
     }
+  if (cd->id_ns_uri != NULL)
+    {
+      gdome_str_unref(cd->id_ns_uri);
+      cd->id_ns_uri = NULL;
+    }
+  if (cd->id_name != NULL)
+    {
+      gdome_str_unref(cd->id_name);
+      cd->id_name = NULL;
+    }
   g_free(cd);
 }
 
+void
+gtk_math_view_control_data_set_id_attribute(GtkMathViewControlData* cd,
+                                           const char* ns_uri, const char* name)
+{
+  g_return_if_fail(cd != NULL);
+  if (cd->id_ns_uri != NULL)
+    {
+      gdome_str_unref(cd->id_ns_uri);
+      cd->id_ns_uri = NULL;
+    }
+  if (cd->id_name != NULL)
+    {
+      gdome_str_unref(cd->id_name);
+      cd->id_name = NULL;
+    }
+  if (ns_uri) cd->id_ns_uri = gdome_str_mkref(ns_uri);
+  if (name) cd->id_name = gdome_str_mkref(name);
+}