/* * register.cc * This file is part of him-arabic * * Copyright (C) 2007 Mohammed Sameer * * 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 2 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ #include "utils.hh" #include #include // TODO: free memory ? int main(int argc, char *argv[]) { if (argc < 2) { std::cerr << "Usage: " << argv[0] << " ..." << std::endl; return 1; } g_type_init(); GSList *list = get_languages_as_slist(); if (!list) { // Add the language. for (int x = 1; x < argc; x++) { list = g_slist_append(list, g_strdup(argv[x])); } if (set_languages(list)) { return 0; } else { std::cerr << "Failed to obtain a GConf client." << std::endl; return 1; } } for (int x = 1; x < argc; x++) { // If not found: if (!g_slist_find_custom(list, argv[x], (GCompareFunc)strcmp)) { list = g_slist_append(list, argv[x]); } } if (set_languages(list)) { return 0; } std::cerr << "Failed to obtain a GConf client." << std::endl; return 1; }