Re: [evolution-patches] Pilot Settings



On Mon, 2004-08-02 at 00:35 +0200, Rodrigo Moya wrote:
> On Sun, 2004-08-01 at 15:45 -0400, JP Rosevear wrote:
> > On Fri, 2004-07-23 at 08:28 +0200, Rodrigo Moya wrote: 
> > > why do we _ref the object in one case and not in the other? I guess you
> > > then _unref it somewhere, so if it's being ref'ed only in one case, the
> > > _unref might fail, right?
> > > 
> > > the rest of the calendar part looks ok.
> > 
> > Yep.  Should never add a "fix" at the last second.
> > 
> > Hopefully the attached is correct.
> > 
> calendar part looks ok to me

One more ref update pointed out by toshok.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
? addr-conduit.patch
? addr-name.patch
? contact-string.patch
? gui/component/ldap-config.gladep
? gui/component/select-names/select-names.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1801
diff -u -r1.1801 ChangeLog
--- ChangeLog	30 Jul 2004 18:06:17 -0000	1.1801
+++ ChangeLog	2 Aug 2004 17:21:27 -0000
@@ -1,3 +1,18 @@
+2004-08-01  JP Rosevear  <jpr novell com>
+
+	* conduit/address-conduit.c (addrconduit_load_configuration): get
+	source uid
+	(addrconduit_dupe_configuration): copy source_uid
+	(addrconduit_destroy_configuration): free source_uid
+	(e_addr_context_new): get the source list
+	(e_addr_context_destroy): unref the source list
+	(pre_sync): open the source that was set earlier
+	(fill_widgets): set the source option menu value
+	(create_settings_window): pass source list to pilot settings
+	(save_settings): save source uid
+
+	* conduit/Makefile.am: link to and include misc. widgets
+
 2004-07-30  Chris Toshok  <toshok ximian com>
 
 	[ fixes #61365 and other misc issues with the addressbook source
Index: conduit/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/conduit/Makefile.am,v
retrieving revision 1.38
diff -u -r1.38 Makefile.am
--- conduit/Makefile.am	1 Dec 2003 19:49:07 -0000	1.38
+++ conduit/Makefile.am	2 Aug 2004 17:21:27 -0000
@@ -5,6 +5,8 @@
 	-I$(top_builddir)/addressbook/backend	\
 	-I$(top_srcdir)/e-util			\
 	-I$(top_builddir)/e-util		\
+	-I$(top_srcdir)/widgets/misc		\
+	-I$(top_builddir)/widgets/misc		\
 	$(EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS)
 
 # Address Conduit
@@ -17,6 +19,7 @@
 libeaddress_conduit_la_LIBADD = 					\
 	$(top_builddir)/e-util/libeutil.la				\
 	$(top_builddir)/e-util/libeconduit.la		 		\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la		 	\
 	$(top_builddir)/camel/libcamel.la	 			\
 	$(EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS)
 
Index: conduit/address-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/conduit/address-conduit.c,v
retrieving revision 1.85
diff -u -r1.85 address-conduit.c
--- conduit/address-conduit.c	21 Jun 2004 15:01:38 -0000	1.85
+++ conduit/address-conduit.c	2 Aug 2004 17:21:27 -0000
@@ -143,6 +143,8 @@
 	guint32 pilot_id;
 	GnomePilotConduitSyncType  sync_type;
 
+	ESourceList *source_list;
+	ESource *source;
 	gboolean secret;
 	EContactField default_address;
 
@@ -177,6 +179,20 @@
 	/* Custom settings */
 	gnome_config_push_prefix (prefix);
 
+	if (!e_book_get_addressbooks (&c->source_list, NULL))
+		c->source_list = NULL;
+	if (c->source_list) {
+		c->source = e_pilot_get_sync_source (c->source_list);
+		if (!c->source)
+			c->source = e_source_list_peek_source_any (c->source_list);
+		if (c->source) {
+			g_object_ref (c->source);
+		} else {
+			g_object_unref (c->source_list);
+			c->source_list = NULL;
+		}
+	}
+	
 	c->secret = gnome_config_get_bool ("secret=FALSE");
 	address = gnome_config_get_string ("default_address=business");
 	if (!strcmp (address, "business"))
@@ -202,6 +218,7 @@
 		    c->pilot_id);
 
 	gnome_config_push_prefix (prefix);
+	e_pilot_set_sync_source (c->source_list, c->source);
 	gnome_config_set_bool ("secret", c->secret);
 	switch (c->default_address) {
 	case E_CONTACT_ADDRESS_WORK:
@@ -234,6 +251,10 @@
 	retval->sync_type = c->sync_type;
 	retval->pilot_id = c->pilot_id;
 
+	if (c->source_list)	
+		retval->source_list = g_object_ref (c->source_list);
+	if (c->source)
+		retval->source = g_object_ref (c->source);
 	retval->secret = c->secret;
 	retval->default_address = c->default_address;
 	retval->last_uri = g_strdup (c->last_uri);
@@ -246,6 +267,8 @@
 {
 	g_return_if_fail (c != NULL);
 
+	g_object_unref (c->source_list);
+	g_object_unref (c->source);
 	g_free (c->last_uri);
 	g_free (c);
 }
@@ -1149,13 +1172,15 @@
 
 	ctxt->dbi = dbi;
 	
-	/* FIXME Need to allow our own concept of "local" */
-	ctxt->ebook = e_book_new_system_addressbook  (NULL);
-	if (!ctxt->ebook
-	    || !e_book_open (ctxt->ebook, FALSE, NULL)) {
+	if (ctxt->cfg->source) {
+		ctxt->ebook = e_book_new (ctxt->cfg->source, NULL);
+	} else {
+		ctxt->ebook = e_book_new_default_addressbook (NULL);
+	}
+	if (!ctxt->ebook || !e_book_open (ctxt->ebook, TRUE, NULL)) {
 		WARN(_("Could not load addressbook"));
 		gnome_pilot_conduit_error (conduit, _("Could not load addressbook"));
-
+		
 		return -1;
 	}
 
@@ -1617,6 +1642,9 @@
 static void
 fill_widgets (EAddrConduitContext *ctxt)
 {
+	if (ctxt->cfg->source)
+		e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps),
+					     ctxt->cfg->source);
 	e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps),
 				     ctxt->cfg->secret);
 
@@ -1629,8 +1657,11 @@
 			EAddrConduitContext *ctxt)
 {
 	LOG (g_message ( "create_settings_window" ));
+	
+	if (!ctxt->cfg->source_list)
+		return -1;
 
-	ctxt->ps = e_pilot_settings_new ();
+	ctxt->ps = e_pilot_settings_new (ctxt->cfg->source_list);
 	ctxt->gui = e_addr_gui_new (E_PILOT_SETTINGS (ctxt->ps));
 
 	gtk_container_add (GTK_CONTAINER (parent), ctxt->ps);
@@ -1651,8 +1682,12 @@
 static void
 save_settings    (GnomePilotConduit *conduit, EAddrConduitContext *ctxt)
 {
-	LOG (g_message ( "save_settings" ));
+        LOG (g_message ( "save_settings" ));
 
+       if (ctxt->new_cfg->source)
+               g_object_unref (ctxt->new_cfg->source);
+	ctxt->new_cfg->source = e_pilot_settings_get_source (E_PILOT_SETTINGS (ctxt->ps));
+	g_object_ref (ctxt->new_cfg->source);
 	ctxt->new_cfg->secret =
 		e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
 	e_addr_gui_fill_config (ctxt->gui, ctxt->new_cfg);
? 61451.patch
? cal-conduits.patch
? cal-name.patch
? nav-scroll-2.patch
? nav-scroll-3.patch
? nav-scroll.patch
? gui/Helgdagar_2004.ics
? gui/cal-comp.patch
? gui/month.patch
? gui/monthview.patch
? gui/nav-scroll.patch
? gui/navigator.patch
? gui/new-editor-2.patch
? gui/new-editor.patch
? gui/old-e-cal-model.h
? gui/old.c
? gui/scroll.patch
? gui/sel.patch
? gui/summary.patch
? gui/temp2.c
? gui/alarm-notify/alarm.patch
? gui/dialogs/alarm-dialog.gladep
? gui/dialogs/alarm-list-dialog.gladep
? gui/dialogs/calendar-setup.gladep
? gui/dialogs/event-page.gladep
? gui/dialogs/meeting-page.gladep
? gui/dialogs/recurrence-page.gladep
? gui/dialogs/temp.c
? gui/dialogs/temp2.c
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2470
diff -u -r1.2470 ChangeLog
--- ChangeLog	2 Aug 2004 07:33:37 -0000	1.2470
+++ ChangeLog	2 Aug 2004 17:21:04 -0000
@@ -1,3 +1,20 @@
+2004-08-01  JP Rosevear  <jpr novell com>
+ 
+ 	* conduits/todo/todo-conduit.c (todoconduit_load_configuration):
+ 	get source list and source
+ 	(todoconduit_dupe_configuration): copy source list and source
+ 	(todoconduit_destroy_configuration): unref source list and source
+ 	(start_calendar_server): open the source that was set earlier
+ 	(fill_widgets): set the source option menu value
+ 	(create_settings_window): pass source list to pilot settings
+ 	(save_settings): mark source with pilot-sync property
+
+ 	* conduits/calendar/calendar-conduit.c: as above
+ 	
+ 	* conduits/todo/Makefile.am: link to and include misc. widgets
+ 
+ 	* conduits/calendar/Makefile.am: ditto	
+	
 2004-07-30  Rodrigo Moya <rodrigo novell com>
 
 	Fixes #57622
Index: conduits/calendar/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/Makefile.am,v
retrieving revision 1.39
diff -u -r1.39 Makefile.am
--- conduits/calendar/Makefile.am	1 Dec 2003 19:46:11 -0000	1.39
+++ conduits/calendar/Makefile.am	2 Aug 2004 17:21:04 -0000
@@ -1,6 +1,8 @@
 INCLUDES = 					\
 	-I$(top_srcdir)/e-util			\
 	-I$(top_builddir)/e-util		\
+	-I$(top_srcdir)/widgets/misc		\
+	-I$(top_builddir)/widgets/misc		\
 	$(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
 
 # Calendar Conduit
@@ -13,6 +15,7 @@
 libecalendar_conduit_la_LIBADD = 					\
 	$(top_builddir)/e-util/libeutil.la				\
 	$(top_builddir)/e-util/libeconduit.la	 			\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la	 		\
 	$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
 
 e-calendar-$(BASE_VERSION).conduit: e-calendar.conduit.in
Index: conduits/calendar/calendar-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/calendar-conduit.c,v
retrieving revision 1.122
diff -u -r1.122 calendar-conduit.c
--- conduits/calendar/calendar-conduit.c	18 Jun 2004 20:45:37 -0000	1.122
+++ conduits/calendar/calendar-conduit.c	2 Aug 2004 17:21:04 -0000
@@ -94,6 +94,8 @@
 	guint32 pilot_id;
 	GnomePilotConduitSyncType  sync_type;
 
+	ESourceList *source_list;
+	ESource *source;
 	gboolean secret;
 	gboolean multi_day_split;
 	
@@ -130,6 +132,19 @@
 	g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", pilot_id);
 	gnome_config_push_prefix (prefix);
 
+	if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_EVENT, NULL))
+		c->source_list = NULL;
+	if (c->source_list) {
+		c->source = e_pilot_get_sync_source (c->source_list);
+		if (!c->source)
+			c->source = e_source_list_peek_source_any (c->source_list);
+		if (c->source) {
+			g_object_ref (c->source);
+		} else {
+			g_object_unref (c->source_list);
+			c->source_list = NULL;
+		}
+	}
 	c->secret = gnome_config_get_bool ("secret=FALSE");
 	c->multi_day_split = gnome_config_get_bool ("multi_day_split=TRUE");
 	if ((c->last_uri = gnome_config_get_string ("last_uri")) && !strncmp (c->last_uri, "file://", 7)) {
@@ -164,6 +179,7 @@
 	g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", c->pilot_id);
 	gnome_config_push_prefix (prefix);
 
+	e_pilot_set_sync_source (c->source_list, c->source);
 	gnome_config_set_bool ("secret", c->secret);
 	gnome_config_set_bool ("multi_day_split", c->multi_day_split);
 	gnome_config_set_string ("last_uri", c->last_uri);
@@ -184,6 +200,11 @@
 	retval = g_new0 (ECalConduitCfg, 1);
 	retval->pilot_id = c->pilot_id;
 	retval->sync_type = c->sync_type;
+
+	if (c->source_list)
+		retval->source_list = g_object_ref (c->source_list);
+	if (c->source)
+		retval->source = g_object_ref (c->source);
 	retval->secret = c->secret;
 	retval->multi_day_split = c->multi_day_split;
 	retval->last_uri = g_strdup (c->last_uri);
@@ -196,6 +217,8 @@
 {
 	g_return_if_fail (c != NULL);
 
+	g_object_unref (c->source_list);
+	g_object_unref (c->source);
 	g_free (c->last_uri);
 	g_free (c);
 }
@@ -407,14 +430,17 @@
 start_calendar_server (ECalConduitContext *ctxt)
 {
 	g_return_val_if_fail (ctxt != NULL, -2);
-	
-	/* FIXME Need a mechanism for the user to select uri's */
-	/* FIXME Can we use the cal model? */
-	
-	if (!e_cal_open_default (&ctxt->client, E_CAL_SOURCE_TYPE_EVENT, NULL, NULL, NULL))
+
+	if (ctxt->cfg->source) {
+		ctxt->client = e_cal_new (ctxt->cfg->source, E_CAL_SOURCE_TYPE_EVENT);
+		if (!e_cal_open (ctxt->client, TRUE, NULL))
+			return -1;
+	} else if (!e_cal_open_default (&ctxt->client, E_CAL_SOURCE_TYPE_EVENT, NULL, NULL, NULL)) {
 		return -1;
-	
-	return 0;
+	}
+
+        return 0;
+
 }
 
 /* Utility routines */
@@ -1801,6 +1827,9 @@
 static void
 fill_widgets (ECalConduitContext *ctxt)
 {
+	if (ctxt->cfg->source)
+		e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps),
+					     ctxt->cfg->source);	
 	e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps),
 				     ctxt->cfg->secret);
 
@@ -1813,8 +1842,11 @@
 			ECalConduitContext *ctxt)
 {
 	LOG (g_message ( "create_settings_window" ));
+	
+	if (!ctxt->cfg->source_list)
+		return -1;
 
-	ctxt->ps = e_pilot_settings_new ();
+	ctxt->ps = e_pilot_settings_new (ctxt->cfg->source_list);
 	ctxt->gui = e_cal_gui_new (E_PILOT_SETTINGS (ctxt->ps));
 
 	gtk_container_add (GTK_CONTAINER (parent), ctxt->ps);
@@ -1835,8 +1867,12 @@
 static void
 save_settings    (GnomePilotConduit *conduit, ECalConduitContext *ctxt)
 {
-	LOG (g_message ( "save_settings" ));
+        LOG (g_message ( "save_settings" ));
 
+	if (ctxt->new_cfg->source)
+		g_object_unref (ctxt->new_cfg->source);
+	ctxt->new_cfg->source = g_object_ref (e_pilot_settings_get_source (E_PILOT_SETTINGS (ctxt->ps)));
+	g_object_ref (ctxt->new_cfg->source);
 	ctxt->new_cfg->secret =
 		e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
 	e_cal_gui_fill_config (ctxt->gui, ctxt->new_cfg);
Index: conduits/todo/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/todo/Makefile.am,v
retrieving revision 1.41
diff -u -r1.41 Makefile.am
--- conduits/todo/Makefile.am	1 Dec 2003 19:46:12 -0000	1.41
+++ conduits/todo/Makefile.am	2 Aug 2004 17:21:04 -0000
@@ -1,6 +1,8 @@
 INCLUDES = 					\
 	-I$(top_srcdir)/e-util			\
 	-I$(top_builddir)/e-util		\
+	-I$(top_srcdir)/widgets/misc		\
+	-I$(top_builddir)/widgets/misc		\
 	$(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
 
 # ToDo Conduit
@@ -13,6 +15,7 @@
 libetodo_conduit_la_LIBADD = 						\
 	$(top_builddir)/e-util/libeutil.la				\
 	$(top_builddir)/e-util/libeconduit.la		 		\
+	$(top_builddir)/widgets/misc/libemiscwidgets.la		 	\
 	$(EVOLUTION_CALENDAR_CONDUIT_LIBS)
 
 e-todo-$(BASE_VERSION).conduit: e-todo.conduit.in
Index: conduits/todo/todo-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/todo/todo-conduit.c,v
retrieving revision 1.92
diff -u -r1.92 todo-conduit.c
--- conduits/todo/todo-conduit.c	23 Jun 2004 17:54:00 -0000	1.92
+++ conduits/todo/todo-conduit.c	2 Aug 2004 17:21:05 -0000
@@ -48,7 +48,7 @@
 GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
 void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
 
-#define CONDUIT_VERSION "0.1.5"
+#define CONDUIT_VERSION "0.1.6"
 
 #define DEBUG_TODOCONDUIT 1
 /* #undef DEBUG_TODOCONDUIT */
@@ -96,6 +96,8 @@
 	guint32 pilot_id;
 	GnomePilotConduitSyncType  sync_type;
 
+	ESourceList *source_list;
+	ESource *source;
 	gboolean secret;
 	gint priority;
 
@@ -109,6 +111,8 @@
 	GnomePilotConduitManagement *management;
 	GnomePilotConduitConfig *config;
 	gchar prefix[256];
+
+
 	g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
 		    pilot_id);
 	
@@ -130,7 +134,21 @@
 	
 	/* Custom settings */
 	gnome_config_push_prefix (prefix);
-
+	
+	if (!e_cal_get_sources (&c->source_list, E_CAL_SOURCE_TYPE_TODO, NULL))
+		c->source_list = NULL;
+	if (c->source_list) {
+		c->source = e_pilot_get_sync_source (c->source_list);
+		if (!c->source)
+			c->source = e_source_list_peek_source_any (c->source_list);
+		if (c->source) {
+			g_object_ref (c->source);
+		} else {
+			g_object_unref (c->source_list);
+			c->source_list = NULL;
+		}
+	}
+	
 	c->secret = gnome_config_get_bool ("secret=FALSE");
 	c->priority = gnome_config_get_int ("priority=3");
 	c->last_uri = gnome_config_get_string ("last_uri");
@@ -149,6 +167,7 @@
 		    c->pilot_id);
 
 	gnome_config_push_prefix (prefix);
+	e_pilot_set_sync_source (c->source_list, c->source);
 	gnome_config_set_bool ("secret", c->secret);
 	gnome_config_set_int ("priority", c->priority);
 	gnome_config_set_string ("last_uri", c->last_uri);
@@ -169,6 +188,10 @@
 	retval->sync_type = c->sync_type;
 	retval->pilot_id = c->pilot_id;
 
+	if (c->source_list)
+		retval->source_list = g_object_ref (c->source_list);
+	if (c->source)
+		retval->source = g_object_ref (c->source);
 	retval->secret = c->secret;
 	retval->priority = c->priority;
 	retval->last_uri = g_strdup (c->last_uri);
@@ -181,6 +204,8 @@
 {
 	g_return_if_fail (c != NULL);
 
+	g_object_unref (c->source_list);
+	g_object_unref (c->source);
 	g_free (c->last_uri);
 	g_free (c);
 }
@@ -270,7 +295,7 @@
 e_todo_context_new (guint32 pilot_id) 
 {
 	EToDoConduitContext *ctxt = g_new0 (EToDoConduitContext, 1);
-
+	
 	ctxt->cfg = todoconduit_load_configuration (pilot_id);
 	ctxt->new_cfg = todoconduit_dupe_configuration (ctxt->cfg);
 	ctxt->gui = NULL;
@@ -399,13 +424,15 @@
 start_calendar_server (EToDoConduitContext *ctxt)
 {
 	g_return_val_if_fail (ctxt != NULL, -2);
-	
-	/* FIXME Need a mechanism for the user to select uri's */
-	/* FIXME Can we use the cal model? */
-	
-	if (!e_cal_open_default (&ctxt->client, E_CAL_SOURCE_TYPE_TODO, NULL, NULL, NULL))
+
+	if (ctxt->cfg->source) {
+		ctxt->client = e_cal_new (ctxt->cfg->source, E_CAL_SOURCE_TYPE_TODO);
+		if (!e_cal_open (ctxt->client, TRUE, NULL)) 
+			return -1;
+	} else if (!e_cal_open_default (&ctxt->client, E_CAL_SOURCE_TYPE_TODO, NULL, NULL, NULL)) {
 		return -1;
-	
+	}
+
 	return 0;
 }
 
@@ -1292,6 +1319,9 @@
 static void
 fill_widgets (EToDoConduitContext *ctxt)
 {
+	if (ctxt->cfg->source)
+		e_pilot_settings_set_source (E_PILOT_SETTINGS (ctxt->ps), 
+					     ctxt->cfg->source);
 	e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps),
 				     ctxt->cfg->secret);
 
@@ -1304,8 +1334,11 @@
 			EToDoConduitContext *ctxt)
 {
 	LOG (g_message ( "create_settings_window" ));
+	
+	if (!ctxt->cfg->source_list)	
+		return -1;
 
-	ctxt->ps = e_pilot_settings_new ();
+	ctxt->ps = e_pilot_settings_new (ctxt->cfg->source_list);
 	ctxt->gui = e_todo_gui_new (E_PILOT_SETTINGS (ctxt->ps));
 
 	gtk_container_add (GTK_CONTAINER (parent), ctxt->ps);
@@ -1315,6 +1348,7 @@
 	
 	return 0;
 }
+
 static void
 display_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
 {
@@ -1328,6 +1362,10 @@
 {
 	LOG (g_message ( "save_settings" ));
 
+	if (ctxt->new_cfg->source)
+		g_object_unref (ctxt->new_cfg->source);
+	ctxt->new_cfg->source = e_pilot_settings_get_source (E_PILOT_SETTINGS (ctxt->ps));
+	g_object_ref (ctxt->new_cfg->source);
 	ctxt->new_cfg->secret = e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
 	e_todo_gui_fill_config (ctxt->gui, ctxt->new_cfg);
 	


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]