/* * Copyright (C) 2012 - Juan Ferrer Toribio * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "glade-vn.h" gboolean glade_vn_set_first_catalog (gpointer catalog_name) { GList * l, * catalogs = glade_app_get_catalogs (), * clone = NULL; GladeCatalog * catalog = NULL; for (l = catalogs; l; l = l->next) if (!g_strcmp0 (catalog_name, glade_catalog_get_name (l->data))) catalog = l->data; else clone = g_list_prepend (clone, l->data); if (catalog) { GList * trash = catalogs->next; catalogs->data = catalog; clone = g_list_reverse (clone); catalogs->next = clone; if (clone) clone->prev = catalogs; if (trash) { trash->prev = NULL; g_list_free (trash); } return G_SOURCE_REMOVE; } g_list_free (clone); return G_SOURCE_CONTINUE; } void glade_vn_init () { g_message ("Hedera objects loaded!"); g_idle_add (glade_vn_set_first_catalog, "vn"); } //+++++++++++++++++++++++++++++++++++++++++++++++++++ GladeDbList G_DEFINE_BOXED_TYPE (GladeVnList, glade_vn_list, glade_vn_list_copy, glade_vn_list_free); void glade_vn_list_free (GladeVnList * list) { if (!list) return; if (list->list) g_object_unref (list->list); g_free (list); list = NULL; } GladeVnList * glade_vn_list_copy (const GladeVnList * list) { GladeVnList * l = g_new (GladeVnList, 1); l->list = list->list ? g_object_ref (list->list) : NULL; return l; } //+++++++++++++++++++++++++++++++++++++++++++++++++ Internal children GObject * glade_vn_field_get_internal_child (GladeWidgetAdaptor * adaptor, GObject * parent, const gchar * name) { return G_OBJECT (vn_field_get_widget (VN_FIELD (parent))); } GObject * glade_vn_column_get_internal_child (GladeWidgetAdaptor * adaptor, GObject * parent, const gchar * name) { return G_OBJECT (vn_column_get_cell_renderer (VN_COLUMN (parent))); }