X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fgconf-editor-application.c;fp=src%2Fgconf-editor-application.c;h=d1c63e0f48331fffa5dd3bf4b825ab13261d06ea;hb=34f89e89320f83ec38ebf7257ddfe4d4a84b7cf0;hp=0000000000000000000000000000000000000000;hpb=3a0d577474f47cb857051247625d9fb7911d0f50;p=gconf-editor diff --git a/src/gconf-editor-application.c b/src/gconf-editor-application.c new file mode 100644 index 0000000..d1c63e0 --- /dev/null +++ b/src/gconf-editor-application.c @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2001, 2002 Anders Carlsson + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include "gconf-editor-application.h" + +#include "gconf-util.h" +#include "gconf-editor-window.h" +#include "gconf-tree-model.h" +#include "gconf-list-model.h" +#include + + +static GSList *editor_windows = NULL; + +static void +gconf_editor_application_window_destroyed (GtkObject *window) +{ + editor_windows = g_slist_remove (editor_windows, window); + + if (editor_windows == NULL) + gtk_main_quit (); +} + +GtkWidget * +gconf_editor_application_create_editor_window (int type) +{ + GtkWidget *window; + GConfEditorWindow *gconfwindow; + + window = g_object_new (GCONF_TYPE_EDITOR_WINDOW, "type", type, NULL); + + gconfwindow = GCONF_EDITOR_WINDOW (window); + + if (gconfwindow->client == NULL) { + gconf_editor_application_window_destroyed (GTK_OBJECT (window)); + return NULL; + } + + gconf_tree_model_set_client (GCONF_TREE_MODEL (gconfwindow->tree_model), gconfwindow->client); + gconf_list_model_set_client (GCONF_LIST_MODEL (gconfwindow->list_model), gconfwindow->client); + + if (!gconf_util_can_edit_defaults ()) + gtk_action_set_sensitive (gtk_ui_manager_get_action (gconfwindow->ui_manager, "/GConfEditorMenu/FileMenu/NewDefaultsWindow"), + FALSE); + + if (!gconf_util_can_edit_mandatory ()) + gtk_action_set_sensitive (gtk_ui_manager_get_action (gconfwindow->ui_manager, "/GConfEditorMenu/FileMenu/NewMandatoryWindow"), + FALSE); + + g_signal_connect (window, "destroy", + G_CALLBACK (gconf_editor_application_window_destroyed), NULL); + + editor_windows = g_slist_prepend (editor_windows, window); + + gconf_editor_window_expand_first (gconfwindow); + + return window; +} +