1 /* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView.
2 * Copyright (C) 2003 Luca Padovani <lpadovan@cs.unibo.it>
3 * Pouria Masoudi <pmasoudi@cs.unibo.it>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * For more information, please visit the project's home page
20 * http://helm.cs.unibo.it/gtkmathview-bonobo
21 * or send an email to <lpadovan@cs.unibo.it>
28 #include "control-data.h"
30 GtkMathViewControlData*
31 gtk_math_view_control_data_new(GtkMathView *math_view)
33 GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1);
34 cd->math_view = math_view;
35 cd->first_selected = NULL;
36 cd->root_selected = NULL;
37 cd->id_ns_uri = gdome_str_mkref("http://www.cs.unibo.it/helm");
38 cd->id_name = gdome_str_mkref("xref");
43 gtk_math_view_control_data_destroy(GtkMathViewControlData* cd)
45 GdomeException exc = 0;
46 //gtk_object_unref(cd->math_view);
48 if (cd->first_selected != NULL)
50 gdome_el_unref(cd->first_selected, &exc);
52 cd->first_selected = NULL;
54 if (cd->root_selected != NULL)
56 gdome_el_unref(cd->root_selected, &exc);
58 cd->root_selected = NULL;
60 if (cd->id_ns_uri != NULL)
62 gdome_str_unref(cd->id_ns_uri);
65 if (cd->id_name != NULL)
67 gdome_str_unref(cd->id_name);
74 gtk_math_view_control_data_get_id_ns_uri(GtkMathViewControlData* cd)
76 g_return_val_if_fail(cd != NULL, NULL);
77 return (cd->id_ns_uri != NULL) ? g_strdup(cd->id_ns_uri->str) : NULL;
81 gtk_math_view_control_data_set_id_ns_uri(GtkMathViewControlData* cd, const gchar* ns_uri)
83 g_return_if_fail(cd != NULL);
84 if (cd->id_ns_uri != NULL) gdome_str_unref(cd->id_ns_uri);
85 cd->id_ns_uri = (ns_uri != NULL) ? gdome_str_mkref_dup(ns_uri) : NULL;
89 gtk_math_view_control_data_get_id_name(GtkMathViewControlData* cd)
91 g_return_val_if_fail(cd != NULL, NULL);
92 return (cd->id_name != NULL) ? g_strdup(cd->id_name->str) : NULL;
96 gtk_math_view_control_data_set_id_name(GtkMathViewControlData* cd, const gchar* name)
98 g_return_if_fail(cd != NULL);
99 if (cd->id_name != NULL) gdome_str_unref(cd->id_name);
100 cd->id_name = (name != NULL) ? gdome_str_mkref_dup(name) : NULL;