2 * Copyright (C) 2001, 2002 Anders Carlsson <andersca@gnu.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <glib/gi18n.h>
23 #include <gconf/gconf.h>
25 #include "gconf-editor-application.h"
26 #include "gconf-stock-icons.h"
27 #include "gconf-editor-window.h"
30 build_accel_filename (void)
32 return g_build_filename (g_get_home_dir (), ".gnome2", "accels", PACKAGE, NULL);
40 map = build_accel_filename ();
41 gtk_accel_map_load (map);
51 map = build_accel_filename ();
52 gtk_accel_map_save (map);
58 main (gint argc, gchar **argv)
60 GOptionContext *context;
64 static gchar **remaining_args = NULL;
65 gchar *initial_key = NULL;
67 const GOptionEntry entries[] =
69 { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, N_("[KEY]") },
73 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
74 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
75 textdomain (GETTEXT_PACKAGE);
77 context = g_option_context_new (N_("- Directly edit your entire configuration database"));
79 g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
80 g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
81 g_option_context_add_group (context, gtk_get_option_group (TRUE));
83 if (!g_option_context_parse (context, &argc, &argv, &error)) {
84 g_critical ("Failed to parse arguments: %s", error->message);
86 g_option_context_free (context);
90 g_option_context_free (context);
92 /* Register our stock icons */
93 gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), ICONDIR);
94 gconf_stock_icons_register ();
97 gtk_window_set_default_icon_name ("gconf-editor");
99 window = gconf_editor_application_create_editor_window (GCONF_EDITOR_WINDOW_TYPE_NORMAL);
100 gtk_widget_show_now (window);
102 /* get the key specified on the command line if any. Ignore the rest */
103 initial_key = remaining_args != NULL ? remaining_args[0] : NULL;
105 if (initial_key != NULL)
106 gconf_editor_window_go_to (GCONF_EDITOR_WINDOW (window),initial_key);
111 g_strfreev (remaining_args);