~ubuntu-branches/ubuntu/maverick/gwhere/maverick

« back to all changes in this revision

Viewing changes to src/gui/gwsettingsgeneral.c

  • Committer: Bazaar Package Importer
  • Author(s): Sébastien LECACHEUR
  • Date: 2004-09-27 00:41:00 UTC
  • Revision ID: james.westby@ubuntu.com-20040927004100-q23139ty7b94kryi
Tags: upstream-0.1.6
Import upstream version 0.1.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  GWhere
 
2
 *  Copyright (C) 2000  S�bastien LECACHEUR
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
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
 
12
 *  GNU General Public License for more details.
 
13
 *
 
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
 
 
20
#include "../gwsupport.h"
 
21
#include "gwsettingsgeneral.h"
 
22
 
 
23
#include "gwsettingswindowbox.h"
 
24
 
 
25
#include "../gwapplicationmanager.h"
 
26
 
 
27
 
 
28
/*! @define     GW_PLUGIN_SETTINGS_WINDOW       The parent window */
 
29
#define GW_PLUGIN_SETTINGS_WINDOW "gw_plugin_settings_window"
 
30
 
 
31
 
 
32
gint gw_plugin_settings_general_pane_create ( GtkWindow *settings, GtkContainer *parent, GtkWidget **pane);
 
33
gint gw_plugin_settings_general_pane_load ( GtkWidget *pane);
 
34
gint gw_plugin_settings_general_pane_on_change ( GtkEntry *entry, GtkWidget *pane);
 
35
gint gw_plugin_settings_general_pane_apply ( GtkWidget *pane);
 
36
 
 
37
 
 
38
gint gw_plugin_settings_general_init ( GWSettingsModule **module)
 
39
{
 
40
        gint result = -1;
 
41
 
 
42
        if ( (*module = gw_settings_module_new ( )) != NULL )
 
43
        {
 
44
                (*module)->name = g_strdup ( _( "Generals options"));
 
45
                (*module)->create = &gw_plugin_settings_general_pane_create;
 
46
                (*module)->load = &gw_plugin_settings_general_pane_load;
 
47
                (*module)->on_change = &gw_plugin_settings_general_pane_on_change;
 
48
                (*module)->apply = &gw_plugin_settings_general_pane_apply;
 
49
 
 
50
                result = 0;
 
51
        }
 
52
 
 
53
        return result;
 
54
}
 
55
 
 
56
 
 
57
gint gw_plugin_settings_general_pane_create ( GtkWindow *settings, GtkContainer *parent, GtkWidget **pane)
 
58
{
 
59
        gint result = -1;
 
60
        GtkWidget *table_pane;
 
61
        GtkTooltips *tooltips;
 
62
 
 
63
 
 
64
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
 
65
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
66
#endif
 
67
 
 
68
        tooltips = gtk_tooltips_new ( );
 
69
 
 
70
        if ( settings != NULL && parent != NULL )
 
71
        {
 
72
                table_pane = gtk_table_new ( 0, 2, FALSE);
 
73
                gtk_widget_ref ( GTK_WIDGET ( settings));
 
74
                gtk_object_set_data_full ( GTK_OBJECT ( table_pane), GW_PLUGIN_SETTINGS_WINDOW, settings, (GtkDestroyNotify) gtk_widget_unref);
 
75
                gtk_container_set_border_width ( GTK_CONTAINER ( table_pane), 5);
 
76
                gtk_table_set_row_spacings ( GTK_TABLE (table_pane), 5);
 
77
                gtk_table_set_col_spacings ( GTK_TABLE (table_pane), 5);
 
78
 
 
79
                *pane = table_pane;
 
80
 
 
81
                gw_plugin_settings_general_pane_load ( table_pane);
 
82
 
 
83
                result = 0;
 
84
        }
 
85
 
 
86
        return result;
 
87
}
 
88
 
 
89
 
 
90
gint gw_plugin_settings_general_pane_load ( GtkWidget *pane)
 
91
{
 
92
        gint result = -1;
 
93
 
 
94
 
 
95
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
 
96
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
97
#endif
 
98
 
 
99
        if ( pane != NULL )
 
100
        {
 
101
                result = 0;
 
102
        }
 
103
 
 
104
        return result;
 
105
}
 
106
 
 
107
 
 
108
gint gw_plugin_settings_general_pane_on_change ( GtkEntry *entry, GtkWidget *pane)
 
109
{
 
110
        gint result = -1;
 
111
        GtkWindow *settings = NULL;
 
112
 
 
113
 
 
114
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
 
115
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
116
#endif
 
117
 
 
118
        if ( pane != NULL )
 
119
        {
 
120
                if ( (settings = GTK_WINDOW ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_WINDOW))) != NULL )
 
121
                {
 
122
                        gw_settings_window_box_set_modified ( settings, TRUE);
 
123
 
 
124
                        result = 0;
 
125
                }
 
126
        }
 
127
 
 
128
        return result;
 
129
}
 
130
 
 
131
 
 
132
gint gw_plugin_settings_general_pane_apply ( GtkWidget *pane)
 
133
{
 
134
        gint result = -1;
 
135
        GtkWindow *settings = NULL;
 
136
 
 
137
 
 
138
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
 
139
        g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
140
#endif
 
141
 
 
142
        if ( pane != NULL )
 
143
        {
 
144
                if ( (settings = GTK_WINDOW ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_WINDOW))) != NULL )
 
145
                {
 
146
                        gw_settings_window_box_set_modified ( settings, FALSE);
 
147
                }
 
148
 
 
149
                result = 0;
 
150
        }
 
151
 
 
152
        return result;
 
153
}