gmyth/src/gmyth_settings.h
author leo_sobral
Wed Oct 18 20:38:47 2006 +0100 (2006-10-18)
branchtrunk
changeset 32 6b9c77b9817e
parent 18 79f6da40f6e9
child 36 a6559a231dd2
permissions -rw-r--r--
[svn r33] disconnect bug resolved in gmyth_epg and gmyth_scheduler
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_settings.h
     5  * 
     6  * @brief <p> This component contains functions acessing and modifying 
     7  * user and program settings.
     8  * 
     9  * The standard settings file is created in the user home folder, in the
    10  * file ~/.mmyth/settings.dat.  
    11  *
    12  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    13  * @author Alexsandro Jose Virginio dos Santos <alexsandro.santos@indt.org.br>
    14  *
    15  *//*
    16  * 
    17  * This program is free software; you can redistribute it and/or modify
    18  * it under the terms of the GNU Lesser General Public License as published by
    19  * the Free Software Foundation; either version 2 of the License, or
    20  * (at your option) any later version.
    21  *
    22  * This program is distributed in the hope that it will be useful,
    23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    25  * GNU General Public License for more details.
    26  *
    27  * You should have received a copy of the GNU Lesser General Public License
    28  * along with this program; if not, write to the Free Software
    29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    30  */
    31 
    32 #ifndef __GMYTH_SETTINGS_H__
    33 #define __GMYTH_SETTINGS_H__
    34 
    35 #include <glib-object.h>
    36 
    37 G_BEGIN_DECLS
    38 
    39 #define GMYTH_SETTINGS_TYPE               (gmyth_settings_get_type ())
    40 #define GMYTH_SETTINGS(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SETTINGS_TYPE, GMythSettings))
    41 #define GMYTH_SETTINGS_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SETTINGS_TYPE, GMythSettingsClass))
    42 #define IS_GMYTH_SETTINGS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_SETTINGS_TYPE))
    43 #define IS_GMYTH_SETTINGS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_SETTINGS_TYPE))
    44 #define GMYTH_SETTINGS_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_SETTINGS_TYPE, GMythSettingsClass))
    45 
    46 
    47 typedef struct _GMythSettings         GMythSettings;
    48 typedef struct _GMythSettingsClass    GMythSettingsClass;
    49 
    50 struct _GMythSettingsClass
    51 {
    52   GObjectClass parent_class;
    53 
    54   /* callbacks */
    55   /* no one for now */
    56 };
    57 
    58 struct _GMythSettings
    59 {
    60     GObject parent;
    61 
    62 	GString *settings_file;
    63 	
    64     GString *backend_hostname;
    65     int backend_port;
    66 
    67     GString *mysql_dbname;
    68 	GString *mysql_username;
    69     GString *mysql_password;
    70     // FIXME: Why do we need database_type? Do we intend to support other dbs?
    71     GString *database_type;
    72 };
    73 
    74 
    75 GType gmyth_settings_get_type (void);
    76 
    77 GMythSettings* gmyth_settings_new (void);
    78 
    79 gboolean gmyth_settings_load_from_file (GMythSettings *gmyth_settings, 
    80                                         GString *filename);
    81 gboolean gmyth_settings_load (GMythSettings *msettings);
    82 gboolean gmyth_settings_save (GMythSettings *gmyth_settings);
    83 
    84 GString* gmyth_settings_get_backend_hostname (GMythSettings *gmyth_settings);
    85 void     gmyth_settings_set_backend_hostname (GMythSettings *gmyth_settings, 
    86                                               GString *new_hostname);
    87 
    88 GString* gmyth_settings_get_username (GMythSettings *gmyth_settings);
    89 void     gmyth_settings_set_username (GMythSettings *gmyth_settings, 
    90                                       GString *new_username);
    91 
    92 GString* gmyth_settings_get_password (GMythSettings *gmyth_settings);
    93 void     gmyth_settings_set_password (GMythSettings *gmyth_settings, 
    94                                       GString *new_password);
    95 
    96 GString* gmyth_settings_get_dbname (GMythSettings *gmyth_settings);
    97 void     gmyth_settings_set_dbname (GMythSettings *gmyth_settings, 
    98                                     GString *new_dbname);
    99 
   100 int      gmyth_settings_get_backend_port (GMythSettings *gmyth_settings);
   101 void     gmyth_settings_set_backend_port (GMythSettings *gmyth_settings, 
   102                                           gint new_port);
   103 
   104 G_END_DECLS
   105 
   106 #endif /* __GMYTH_SETTINGS_H__ */