aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/ChangeLog11
-rw-r--r--e-util/Makefile.am2
-rw-r--r--e-util/e-pilot-settings.c150
-rw-r--r--e-util/e-pilot-settings.h73
-rw-r--r--e-util/e-pilot-util.c44
-rw-r--r--e-util/e-pilot-util.h7
6 files changed, 62 insertions, 225 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index d88e57cbda..0cd49c9fe6 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,14 @@
+2004-08-01 JP Rosevear <jpr@novell.com>
+
+ * e-pilot-util.c (e_pilot_get_sync_source): find the source with
+ the pilot-sync property
+ (e_pilot_set_sync_source): give the source the pilot-sync property
+ and make sure its the only one
+
+ * e-pilot-util.h: add prototypes
+
+ * Makefile.am (eutilincludedir): don't build pilot settings
+
2004-07-20 Not Zed <NotZed@Ximian.com>
* e-dialog-utils.c: include config.h. See #61395.
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 481c2dbe74..25e2d6a5a6 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -95,13 +95,11 @@ libeutil_la_LIBADD = $(E_UTIL_LIBS)
econdinclude_HEADERS = \
e-pilot-map.h \
- e-pilot-settings.h \
e-pilot-util.h
pilot_sources = \
$(econdinclude_HEADERS) \
e-pilot-map.c \
- e-pilot-settings.c \
e-pilot-util.c
if ENABLE_PILOT_CONDUITS
diff --git a/e-util/e-pilot-settings.c b/e-util/e-pilot-settings.c
deleted file mode 100644
index 7649f60287..0000000000
--- a/e-util/e-pilot-settings.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-pilot-settings.c
- *
- * Copyright (C) 2001 JP Rosevear
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: JP Rosevear
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <libgnome/gnome-i18n.h>
-#include "e-pilot-settings.h"
-
-struct _EPilotSettingsPrivate
-{
- GtkWidget *secret;
- GtkWidget *cat;
- GtkWidget *cat_btn;
-};
-
-
-static void class_init (EPilotSettingsClass *klass);
-static void init (EPilotSettings *ps);
-
-static GObjectClass *parent_class = NULL;
-
-
-GType
-e_pilot_settings_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static GTypeInfo info = {
- sizeof (EPilotSettingsClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) class_init,
- NULL, NULL,
- sizeof (EPilotSettings),
- 0,
- (GInstanceInitFunc) init
- };
- type = g_type_register_static (GTK_TYPE_TABLE, "EPilotSettings", &info, 0);
- }
-
- return type;
-}
-
-static void
-class_init (EPilotSettingsClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (GTK_TYPE_TABLE);
-}
-
-
-static void
-init (EPilotSettings *ps)
-{
- EPilotSettingsPrivate *priv;
- GtkWidget *lbl;
-
- priv = g_new0 (EPilotSettingsPrivate, 1);
-
- ps->priv = priv;
-
- gtk_table_resize (GTK_TABLE (ps), 2, 2);
- gtk_container_set_border_width (GTK_CONTAINER (ps), 4);
- gtk_table_set_col_spacings (GTK_TABLE (ps), 4);
-
- lbl = gtk_label_new (_("Sync Private Records:"));
- gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
- priv->secret = gtk_check_button_new ();
- gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, 0, 1);
- gtk_table_attach_defaults (GTK_TABLE (ps), priv->secret, 1, 2, 0, 1);
- gtk_widget_show (lbl);
- gtk_widget_show (priv->secret);
-
-#if 0
- lbl = gtk_label_new (_("Sync Categories:"));
- gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
- priv->cat = gtk_check_button_new ();
- gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, 1, 2);
- gtk_table_attach_defaults (GTK_TABLE (ps), priv->cat, 1, 2, 1, 2);
- gtk_widget_show (lbl);
- gtk_widget_show (priv->cat);
-#endif
-}
-
-
-
-GtkWidget *
-e_pilot_settings_new (void)
-{
- GtkWidget *w = g_object_new (E_TYPE_PILOT_SETTINGS, NULL);
- g_object_ref (w);
- gtk_object_sink (GTK_OBJECT (w));
-
- return w;
-}
-
-gboolean
-e_pilot_settings_get_secret (EPilotSettings *ps)
-{
- EPilotSettingsPrivate *priv;
-
- g_return_val_if_fail (ps != NULL, FALSE);
- g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), FALSE);
-
- priv = ps->priv;
-
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->secret));
-}
-
-void
-e_pilot_settings_set_secret (EPilotSettings *ps, gboolean secret)
-{
- EPilotSettingsPrivate *priv;
-
- g_return_if_fail (ps != NULL);
- g_return_if_fail (E_IS_PILOT_SETTINGS (ps));
-
- priv = ps->priv;
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->secret),
- secret);
-}
-
diff --git a/e-util/e-pilot-settings.h b/e-util/e-pilot-settings.h
deleted file mode 100644
index 908f9e1836..0000000000
--- a/e-util/e-pilot-settings.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-pilot-settings.h
- *
- * Copyright (C) 2001 JP Rosevear
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: JP Rosevear
- */
-
-#ifndef _E_PILOT_SETTINGS_H_
-#define _E_PILOT_SETTINGS_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_PILOT_SETTINGS (e_pilot_settings_get_type ())
-#define E_PILOT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_PILOT_SETTINGS, EPilotSettings))
-#define E_PILOT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_PILOT_SETTINGS, EPilotSettingsClass))
-#define E_IS_PILOT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_PILOT_SETTINGS))
-#define E_IS_PILOT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_PILOT_SETTINGS))
-
-
-typedef struct _EPilotSettings EPilotSettings;
-typedef struct _EPilotSettingsPrivate EPilotSettingsPrivate;
-typedef struct _EPilotSettingsClass EPilotSettingsClass;
-
-#define E_PILOT_SETTINGS_TABLE_ROWS 2
-#define E_PILOT_SETTINGS_TABLE_COLS 2
-
-struct _EPilotSettings {
- GtkTable parent;
-
- EPilotSettingsPrivate *priv;
-};
-
-struct _EPilotSettingsClass {
- GtkTableClass parent_class;
-};
-
-
-GType e_pilot_settings_get_type (void);
-GtkWidget *e_pilot_settings_new (void);
-
-gboolean e_pilot_settings_get_secret (EPilotSettings *ps);
-void e_pilot_settings_set_secret (EPilotSettings *ps, gboolean secret);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_PILOT_SETTINGS_H_ */
diff --git a/e-util/e-pilot-util.c b/e-util/e-pilot-util.c
index 7ce6f3cbdc..7d82ef290b 100644
--- a/e-util/e-pilot-util.c
+++ b/e-util/e-pilot-util.c
@@ -61,3 +61,47 @@ e_pilot_utf8_from_pchar (const char *string)
return ustring;
}
+
+ESource *
+e_pilot_get_sync_source (ESourceList *source_list)
+{
+ GSList *g;
+
+ g_return_val_if_fail (source_list != NULL, NULL);
+ g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
+
+ for (g = e_source_list_peek_groups (source_list); g; g = g->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (g->data);
+ GSList *s;
+
+ for (s = e_source_group_peek_sources (group); s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+
+ if (e_source_get_property (source, "pilot-sync"))
+ return source;
+ }
+ }
+
+ return NULL;
+}
+
+void
+e_pilot_set_sync_source (ESourceList *source_list, ESource *source)
+{
+ GSList *g;
+
+ g_return_if_fail (source_list != NULL);
+ g_return_if_fail (E_IS_SOURCE_LIST (source_list));
+
+ for (g = e_source_list_peek_groups (source_list); g; g = g->next) {
+ GSList *s;
+ for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data));
+ s; s = s->next) {
+ e_source_set_property (E_SOURCE (s->data), "pilot-sync", NULL);
+ }
+ }
+
+ if (source)
+ e_source_set_property (source, "pilot-sync", "true");
+ e_source_list_sync (source_list, NULL);
+}
diff --git a/e-util/e-pilot-util.h b/e-util/e-pilot-util.h
index 059b113694..7953536a5b 100644
--- a/e-util/e-pilot-util.h
+++ b/e-util/e-pilot-util.h
@@ -20,10 +20,17 @@
* Boston, MA 02111-1307, USA.
*/
+#include <libedataserver/e-source-list.h>
+#include <libedataserver/e-source.h>
+
#ifndef E_PILOT_UTIL_H
#define E_PILOT_UTIL_H
char *e_pilot_utf8_to_pchar (const char *string);
char *e_pilot_utf8_from_pchar (const char *string);
+ESource *e_pilot_get_sync_source (ESourceList *source_list);
+void e_pilot_set_sync_source (ESourceList *source_list, ESource *source);
+
+
#endif /* E_PILOT_UTIL_H */