Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

mlview-settings-management.h

Go to the documentation of this file.
00001 /*
00002  *This file is part of MlView.
00003  *
00004  *MlView is free software; you can redistribute it and/or modify it under the terms of 
00005  *the GNU General Public License as published by the Free Software Foundation; either version 2, 
00006  *or (at your option) any later version.
00007  *
00008  *MlView is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
00009  *without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00010  *See the GNU General Public License for more details.
00011  *
00012  *You should have received a copy of the GNU General Public License along with MlView; 
00013  *see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00014  *
00015  *
00016  *Copyright 2001 dodji seketeli
00017  */
00018 
00019 #ifndef __MLVIEW_SETTINGS_MANAGEMENT_H__
00020 #define __MLVIEW_SETTINGS_MANAGEMENT_H__
00021 
00022 #include <gnome.h>
00023 #include <libxml/tree.h>
00024 #include <libxml/xpath.h>
00025 #include <libxml/xpathInternals.h>
00026 #include "mlview-app-context.h"
00027 
00028 typedef struct _MlViewSettingsEntryHandlers MlViewSettingsEntryHandlers ;
00029 typedef struct _MlViewSettingsEntry MlViewSettingsEntry ;
00030 typedef struct _MlViewSettingsEntryPrivate MlViewSettingsEntryPrivate ;
00031 
00032 /*===============================================================
00033  *These are the interfaces that each part of MlView must implement
00034  *to install a settings entry.
00035  *==============================================================*/
00036 
00037 /*Callback that is called by the settings manager when the settings have been modified by the user*/
00038 typedef void (*NotifySettingsChanged) (MlViewSettingsEntry *a_settings, void * a_user_data) ;
00039 
00040 /*Function used to load the settings from an xml doc into a given MlViewSettingsEntry->settings structure.
00041  *This function is called by the settings manager before at MlView load time and each time, it is asked to reread
00042  *the MlView Settings.
00043  */
00044 typedef void (*LoadSettingsFromXMLDocIntoSettingsEntry)(MlViewSettingsEntry *a_settings, xmlDoc * a_xml_doc) ;
00045 
00046 /*Function used to get the settings from the settings UI and set populate the custom settings struct.
00047  *This function is called by the settings manager each time the user modifies the settings via the UI.
00048  */
00049 typedef void (*GetSettingsFromSettingsWidget)(MlViewSettingsEntry *a_settings) ;
00050 
00051 /*Function used to get the settings from the custom settings struct and to populate the UI.
00052  *This function is called by the settings manager each time the user wants to visualize a settings entry.
00053  */
00054 typedef void (*SetSettingsToSettingsWidget)(MlViewSettingsEntry *a_settings) ;
00055 
00056 /*Each part of the application that wants to define a set of settings
00057  *must add field to this enum.
00058  */
00059 
00060 typedef enum {
00061         MLVIEW_EDITOR_SETTINGS=1, /*The settings of the MlViewEditor widget*/
00062         MLVIEW_EDITOR_VALIDATION_SETTINGS, /*a subset of the MLVIEW_EDITOR_SETTINGS*/
00063         MLVIEW_TREE_EDITOR_SETTINGS,
00064 
00065 /*=========This field must be the last one !!!!*/
00066         MLVIEW_SETTINGS_ROOT /*The parent of all the settings. This type _MUST NOT_ be used !!!*/
00067 } MlViewSettingsType;
00068 
00069 
00070 /*This structs contains the handlers called by the Settings manager to perform the
00071  *tasks of load/update/notify needed for the settings entries.
00072  */
00073 struct _MlViewSettingsEntryHandlers{
00074         /*Settings modif callback and the custom data passed to it*/
00075         NotifySettingsChanged notify_settings_changed ;
00076         gpointer settings_changed_notifier_data ;
00077 
00078         /*function called to populate the "settings" custom stucture from an xml document. Each app has to overloead this function*/
00079         LoadSettingsFromXMLDocIntoSettingsEntry load_settings_from_xml_doc_into_settings_entry ;
00080 
00081         /*Function called to populate the "settings" custom stucture from the settings UI. Each app has to overload this function*/
00082         GetSettingsFromSettingsWidget get_settings_from_settings_widget ;
00083 
00084         /*Function used to populate the settings widget from the "settings" custom structure. Each app has to overload this function*/
00085         SetSettingsToSettingsWidget set_settings_to_settings_widget ;
00086 } ;
00087 
00088 /*
00089  * Each entry of the setting dialog box is described by this
00090  * Structure that inherits GNode.
00091  */
00092 struct _MlViewSettingsEntry{
00093         GNode * tree_node;
00094         MlViewSettingsType settings_type ;
00095         MlViewSettingsEntryPrivate *private ;
00096 } ;
00097 
00098 MlViewSettingsEntry * mlview_settings_entry_new(gchar * a_name,
00099                                                 gpointer a_settings,
00100                                                 GtkWidget *a_settings_widget,
00101                                                 gpointer a_settings_widget_structure) ;
00102 
00103 void mlview_settings_add_child_entry(MlViewSettingsEntry *a_parent_entry, MlViewSettingsEntry *a_child_entry) ;
00104 void mlview_settings_add_previous_sibling_entry(MlViewSettingsEntry *a_parent_entry,
00105                                                 MlViewSettingsEntry *a_sibling_entry,
00106                                                 MlViewSettingsEntry *a_node) ;
00107 
00108 MlViewSettingsEntry * mlview_settings_unlink_entry(MlViewSettingsEntry * a_entry) ;
00109 void mlview_settings_entry_destroy(MlViewSettingsEntry * a_settings_entry) ;
00110 MlViewSettingsEntryHandlers * mlview_settings_entry_get_handlers(MlViewSettingsEntry *a_settings_entry) ;
00111 void mlview_settings_entry_entry_set_handlers(MlViewSettingsEntry *a_settings_entry, MlViewSettingsEntryHandlers *a_handlers) ;
00112 
00113 
00114 /*--------------MlViewSettingsEntry accessors--------------*/
00115 gchar * mlview_settings_entry_get_name(MlViewSettingsEntry *a_settings_entry) ;
00116 void mlview_settings_entry_set_name(MlViewSettingsEntry *a_settings_entry, gchar * a_name) ;
00117 gint mlview_settings_entry_get_type(MlViewSettingsEntry *a_settings_entry) ;
00118 void mlview_settings_entry_set_type(MlViewSettingsEntry *a_settings_entry, MlViewSettingsType a_type) ;
00119 void * mlview_settings_entry_get_settings (MlViewSettingsEntry * a_settings_entry) ;
00120 void mlview_settings_entry_set_settings (MlViewSettingsEntry * a_settings_entry, void * a_settings_struct) ;
00121 GtkWidget * mlview_settings_entry_get_settings_widget(MlViewSettingsEntry * a_settings_entry) ;
00122 void * mlview_settings_entry_get_settings_widgets_struct(MlViewSettingsEntry * a_settings_entry) ;
00123 MlViewSettingsEntryHandlers * mlview_settings_entry_get_handlers(MlViewSettingsEntry * a_settings_entry) ;
00124 void mlview_settings_entry_set_handlers(MlViewSettingsEntry * a_settings_entry, MlViewSettingsEntryHandlers *a_handlers) ;
00125 /*-------------------------------
00126  * Settings manager definition.
00127  *-------------------------------*/
00128 typedef struct _MlViewSettingsManager MlViewSettingsManager ;
00129 typedef struct _MlViewSettingsManagerPrivate MlViewSettingsManagerPrivate ;
00130 
00131 struct _MlViewSettingsManager{
00132         MlViewSettingsManagerPrivate *private ;
00133 } ;
00134 
00135 MlViewSettingsManager *  mlview_settings_manager_new(MlViewAppContext *a_app_context) ;
00136 
00137 GnomeDialog *  mlview_settings_manager_get_settings_dialog(MlViewSettingsManager *a_manager) ;
00138 void mlview_settings_manager_edit_settings_interactive(MlViewSettingsManager *a_manager) ;
00139 gint  mlview_settings_manager_install_settings(MlViewSettingsManager *a_settings_manager,
00140                                                MlViewSettingsEntry *a_entry) ;
00141 MlViewSettingsEntry * mlview_settings_manager_uninstall_settings(MlViewSettingsManager *a_settings_manager,
00142                                                                  MlViewSettingsEntry *a_entry) ;
00143 xmlDoc * mlview_settings_manager_load_settings_from_disk(MlViewSettingsManager *a_manager) ;
00144 void mlview_settings_manager_set_settings_dialog_proportions(MlViewSettingsManager *a_manager,
00145                                                              guint a_percentage) ;
00146 gint mlview_settings_manager_create_personal_settings_file(xmlDoc ** a_xml_doc) ;
00147 gboolean mlview_settings_manager_personal_settings_file_exists(void) ;
00148 xmlDoc * mlview_settings_manager_load_settings_from_disk(MlViewSettingsManager *a_manager) ;
00149 void mlview_settings_manager_post_settings_install_init(MlViewSettingsManager *a_manager, xmlDoc * a_settings_doc) ;
00150 void mlview_settings_manager_destroy(MlViewSettingsManager *a_manager) ;
00151 
00152 
00153 /*Settings management Utils funtions*/
00154 gint mlview_settings_management_get_settings_xml_nodes(xmlXPathObject **a_xpath_object, 
00155                                                        gchar * a_xpath_expression, 
00156                                                        xmlDoc * a_xml_doc) ;
00157 
00158 
00159 #endif /*__MLVIEW_PROPERTIES_MANAGEMENT_H__*/

Generated on Sat Jul 6 09:57:35 2002 for Gnome-MlView by doxygen1.2.16