X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fgtkmathview-bonobo%2Fsrc%2Fcontrol-data.c;h=8668a3867b87f79aca1bf72557d94aa71c59457c;hb=3f88b5fffc17ecc8b3cb1645f9be846e740c8a3a;hp=10f06491c338a197cd9e04ddd78b6e39c35561e6;hpb=e03554e83a734994353488594810b5c32bfc46af;p=helm.git diff --git a/helm/gtkmathview-bonobo/src/control-data.c b/helm/gtkmathview-bonobo/src/control-data.c index 10f06491c..8668a3867 100644 --- a/helm/gtkmathview-bonobo/src/control-data.c +++ b/helm/gtkmathview-bonobo/src/control-data.c @@ -1,3 +1,29 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ + +#include + +#include #include "control-data.h" @@ -6,11 +32,10 @@ gtk_math_view_control_data_new(GtkMathView *math_view) { GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1); cd->math_view = math_view; - cd->semantic_selection = FALSE; cd->first_selected = NULL; cd->root_selected = NULL; - cd->id_ns_uri = NULL; - cd->id_name = NULL; + cd->id_ns_uri = gdome_str_mkref("http://www.cs.unibo.it/helm"); + cd->id_name = gdome_str_mkref("xref"); return cd; } @@ -45,21 +70,32 @@ gtk_math_view_control_data_destroy(GtkMathViewControlData* cd) g_free(cd); } +gchar* +gtk_math_view_control_data_get_id_ns_uri(GtkMathViewControlData* cd) +{ + g_return_val_if_fail(cd != NULL, NULL); + return (cd->id_ns_uri != NULL) ? g_strdup(cd->id_ns_uri->str) : NULL; +} + void -gtk_math_view_control_data_set_id_attribute(GtkMathViewControlData* cd, - const char* ns_uri, const char* name) +gtk_math_view_control_data_set_id_ns_uri(GtkMathViewControlData* cd, const gchar* ns_uri) { 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); + if (cd->id_ns_uri != NULL) gdome_str_unref(cd->id_ns_uri); + cd->id_ns_uri = (ns_uri != NULL) ? gdome_str_mkref_dup(ns_uri) : NULL; +} + +gchar* +gtk_math_view_control_data_get_id_name(GtkMathViewControlData* cd) +{ + g_return_val_if_fail(cd != NULL, NULL); + return (cd->id_name != NULL) ? g_strdup(cd->id_name->str) : NULL; +} + +void +gtk_math_view_control_data_set_id_name(GtkMathViewControlData* cd, const gchar* name) +{ + g_return_if_fail(cd != NULL); + if (cd->id_name != NULL) gdome_str_unref(cd->id_name); + cd->id_name = (name != NULL) ? gdome_str_mkref_dup(name) : NULL; }