This repository has been archived on 2024-07-15. You can view files and clone it, but cannot push or open issues or pull requests.
hedera/glade/glade-vn.c

61 lines
1.5 KiB
C

/*
* 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 <http://www.gnu.org/licenses/>.
*/
#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");
}