]> git.pld-linux.org Git - packages/evolution.git/blob - evolution-e-pilot-settings.c
- up to version 1.5.92.2
[packages/evolution.git] / evolution-e-pilot-settings.c
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* e-pilot-settings.c
3  *
4  * Copyright (C) 2001  JP Rosevear
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  * Author: JP Rosevear
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include <gtk/gtk.h>
29 #include <libgnome/gnome-i18n.h>
30 #include "e-source-option-menu.h"
31 #include "e-pilot-settings.h"
32
33 struct _EPilotSettingsPrivate 
34 {
35         GtkWidget *source;
36         GtkWidget *secret;
37         GtkWidget *cat;
38         GtkWidget *cat_btn;
39 };
40
41
42 static void class_init (EPilotSettingsClass *klass);
43 static void init (EPilotSettings *ps);
44
45 static GObjectClass *parent_class = NULL;
46
47
48 GType
49 e_pilot_settings_get_type (void)
50 {
51         static GType type = 0;
52
53         if (!type) {
54                 static GTypeInfo info = {
55                         sizeof (EPilotSettingsClass),
56                         (GBaseInitFunc) NULL,
57                         (GBaseFinalizeFunc) NULL,
58                         (GClassInitFunc) class_init,
59                         NULL, NULL,
60                         sizeof (EPilotSettings),
61                         0,
62                         (GInstanceInitFunc) init
63                 };
64                 type = g_type_register_static (GTK_TYPE_TABLE, "EPilotSettings", &info, 0);
65         }
66
67         return type;
68 }
69
70 static void
71 class_init (EPilotSettingsClass *klass)
72 {
73         GObjectClass *object_class;
74
75         object_class = G_OBJECT_CLASS (klass);
76
77         parent_class = g_type_class_ref (GTK_TYPE_TABLE);
78 }
79
80 static void
81 init (EPilotSettings *ps)
82 {
83         EPilotSettingsPrivate *priv;
84         
85         priv = g_new0 (EPilotSettingsPrivate, 1);
86
87         ps->priv = priv;
88 }
89
90
91 static void
92 build_ui (EPilotSettings *ps, ESourceList *source_list)
93 {
94         EPilotSettingsPrivate *priv;
95         GtkWidget *lbl;
96         
97         priv = ps->priv;
98
99         gtk_table_resize (GTK_TABLE (ps), 2, 2);
100         gtk_container_set_border_width (GTK_CONTAINER (ps), 4);
101         gtk_table_set_col_spacings (GTK_TABLE (ps), 6);
102
103         lbl = gtk_label_new (_("Sync with:"));
104         gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
105         priv->source = e_source_option_menu_new (source_list);
106         gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, 0, 1);
107         gtk_table_attach_defaults (GTK_TABLE (ps), priv->source, 1, 2, 0, 1);
108         gtk_widget_show (lbl);
109         gtk_widget_show (priv->source);
110
111         lbl = gtk_label_new (_("Sync Private Records:"));
112         gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
113         priv->secret = gtk_check_button_new ();
114         gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, 1, 2);
115         gtk_table_attach_defaults (GTK_TABLE (ps), priv->secret, 1, 2, 1, 2);
116         gtk_widget_show (lbl);
117         gtk_widget_show (priv->secret);
118
119 #if 0
120         lbl = gtk_label_new (_("Sync Categories:"));
121         gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
122         priv->cat = gtk_check_button_new ();
123         gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, 2, 3);
124         gtk_table_attach_defaults (GTK_TABLE (ps), priv->cat, 1, 2, 2, 3);
125         gtk_widget_show (lbl);
126         gtk_widget_show (priv->cat);
127 #endif
128 }
129
130 \f
131
132 GtkWidget *
133 e_pilot_settings_new (ESourceList *source_list)
134 {
135         EPilotSettings *ps;
136         EPilotSettingsPrivate *priv;
137         
138         ps = g_object_new (E_TYPE_PILOT_SETTINGS, NULL);
139         priv = ps->priv;
140
141         build_ui (ps, source_list);
142         
143         return GTK_WIDGET (ps);
144 }
145
146 ESource *
147 e_pilot_settings_get_source (EPilotSettings *ps)
148 {
149         EPilotSettingsPrivate *priv;
150         
151         g_return_val_if_fail (ps != NULL, FALSE);
152         g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), FALSE);
153
154         priv = ps->priv;
155         
156         return e_source_option_menu_peek_selected (E_SOURCE_OPTION_MENU (priv->source));
157 }
158
159 void
160 e_pilot_settings_set_source (EPilotSettings *ps, ESource *source)
161 {
162         EPilotSettingsPrivate *priv;
163         
164         g_return_if_fail (ps != NULL);
165         g_return_if_fail (E_IS_PILOT_SETTINGS (ps));
166
167         priv = ps->priv;
168
169         e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source), source);
170 }
171
172 gboolean
173 e_pilot_settings_get_secret (EPilotSettings *ps)
174 {
175         EPilotSettingsPrivate *priv;
176         
177         g_return_val_if_fail (ps != NULL, FALSE);
178         g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), FALSE);
179
180         priv = ps->priv;
181         
182         return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->secret));
183 }
184
185 void
186 e_pilot_settings_set_secret (EPilotSettings *ps, gboolean secret)
187 {
188         EPilotSettingsPrivate *priv;
189         
190         g_return_if_fail (ps != NULL);
191         g_return_if_fail (E_IS_PILOT_SETTINGS (ps));
192
193         priv = ps->priv;
194
195         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->secret),
196                                       secret);
197 }
198
This page took 0.12178 seconds and 3 git commands to generate.