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.
20 #include "gconf-editor-application.h"
22 #include "gconf-util.h"
23 #include "gconf-editor-window.h"
24 #include "gconf-tree-model.h"
25 #include "gconf-list-model.h"
29 static GSList *editor_windows = NULL;
32 gconf_editor_application_window_destroyed (GtkObject *window)
34 editor_windows = g_slist_remove (editor_windows, window);
36 if (editor_windows == NULL)
41 gconf_editor_application_create_editor_window (int type)
44 GConfEditorWindow *gconfwindow;
46 window = g_object_new (GCONF_TYPE_EDITOR_WINDOW, "type", type, NULL);
48 gconfwindow = GCONF_EDITOR_WINDOW (window);
50 if (gconfwindow->client == NULL) {
51 gconf_editor_application_window_destroyed (GTK_OBJECT (window));
55 gconf_tree_model_set_client (GCONF_TREE_MODEL (gconfwindow->tree_model), gconfwindow->client);
56 gconf_list_model_set_client (GCONF_LIST_MODEL (gconfwindow->list_model), gconfwindow->client);
58 if (!gconf_util_can_edit_defaults ())
59 gtk_action_set_sensitive (gtk_ui_manager_get_action (gconfwindow->ui_manager, "/GConfEditorMenu/FileMenu/NewDefaultsWindow"),
62 if (!gconf_util_can_edit_mandatory ())
63 gtk_action_set_sensitive (gtk_ui_manager_get_action (gconfwindow->ui_manager, "/GConfEditorMenu/FileMenu/NewMandatoryWindow"),
66 g_signal_connect (window, "destroy",
67 G_CALLBACK (gconf_editor_application_window_destroyed), NULL);
69 editor_windows = g_slist_prepend (editor_windows, window);
71 gconf_editor_window_expand_first (gconfwindow);