From fe4a9b93de19146309bf95f3ebaf1314069c1503 Mon Sep 17 00:00:00 2001 From: Eskil Heyn Olsen Date: Wed, 6 Oct 1999 15:23:18 +0000 Subject: checks return values from gpilotd_init/connect. * *conduit*[ch]: checks return values from gpilotd_init/connect. * calender.c (vcalendar_create_from_calendar): removed a set of cleanVObject cleanStrTbl, since the freed memory that the function returned. svn path=/trunk/; revision=1319 --- calendar/Makefile.am | 16 ++++--- calendar/calendar-conduit-control-applet.c | 51 +++++++++++++--------- calendar/calendar-conduit.c | 2 +- calendar/calendar.c | 5 +-- .../calendar/calendar-conduit-control-applet.c | 51 +++++++++++++--------- calendar/conduits/calendar/calendar-conduit.c | 2 +- .../conduits/todo/todo-conduit-control-applet.c | 13 +++++- calendar/gui/Makefile.am | 16 ++++--- calendar/gui/calendar-conduit-control-applet.c | 51 +++++++++++++--------- calendar/gui/calendar-conduit.c | 2 +- calendar/gui/calendar.c | 5 +-- calendar/gui/todo-conduit-control-applet.c | 13 +++++- calendar/todo-conduit-control-applet.c | 13 +++++- 13 files changed, 150 insertions(+), 90 deletions(-) (limited to 'calendar') diff --git a/calendar/Makefile.am b/calendar/Makefile.am index 5ed3d8fbae..1b4927e0aa 100644 --- a/calendar/Makefile.am +++ b/calendar/Makefile.am @@ -9,7 +9,11 @@ gnorba_DATA = gnomecal.gnorba help_base = $(datadir)/gnome/help/cal if HAVE_GNOME_PILOT -bin_PROGRAMS = gnomecal todo-conduit-control-applet calendar-conduit-control-appleta calendar-pilot-sync +bin_PROGRAMS = \ + gnomecal \ + todo-conduit-control-applet \ + calendar-conduit-control-applet \ + calendar-pilot-sync else bin_PROGRAMS = gnomecal endif @@ -115,21 +119,22 @@ calendar_pilot_sync_LDADD = \ $(LINK_FLAGS) -if HAVE_GNOME_PILOT #calendar_conduit calendar_conduitsdir=$(libdir)/gnome-pilot/conduits calendar_conduits_LTLIBRARIES = libcalendar_conduit.la libcalendar_conduit_la_SOURCES = \ + GnomeCal-common.c \ + GnomeCal-stubs.c \ calendar-conduit.c \ calobj.c \ alarm.c \ - GnomeCal-common.c \ - GnomeCal-stubs.c \ calendar.c \ timeutil.c +calendar-conduit.c: my_gnomecal_idl + libcalendar_conduit_la_LDFLAGS = \ -rpath $(libdir) @@ -167,6 +172,8 @@ libtodo_conduit_la_LIBADD = \ libtodo_conduit_la_SOURCES = \ todo-conduit.c +todo-conduit.c: GnomeCal.h + todo_conduit_control_applet_SOURCES = \ todo-conduit-control-applet.c @@ -179,7 +186,6 @@ todo_conduit_control_applet_LDADD = \ $(PISOCK_LIBS) \ $(GNOME_PILOT_LIBS) \ $(INTLLIBS) -endif # HAVE_GNOME_PILOT gnomecal_LDADD = $(LINK_FLAGS) diff --git a/calendar/calendar-conduit-control-applet.c b/calendar/calendar-conduit-control-applet.c index 44ca3d7898..4b18ae920f 100644 --- a/calendar/calendar-conduit-control-applet.c +++ b/calendar/calendar-conduit-control-applet.c @@ -251,29 +251,38 @@ gchar *get_pilot_id_from_gpilotd() { int main( int argc, char *argv[] ) { - /* we're a capplet */ - gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv, - NULL, - 0, NULL); - - /* put all code to set things up in here */ - conduit = gpilotd_conduit_mgmt_new("calendar_conduit"); - - /* get pilot name from gpilotd */ - /* 1. initialize the gpilotd connection */ - gpilotd_init(&argc,argv); - /* 2 connect to gpilotd */ - if(!gpilotd_connect()) g_error("Cannot connect to gpilotd"); + /* we're a capplet */ + gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv, + NULL, + 0, NULL); + + /* put all code to set things up in here */ + conduit = gpilotd_conduit_mgmt_new("calendar_conduit"); + + /* get pilot name from gpilotd */ + /* 1. initialize the gpilotd connection */ + if (gpilotd_init(&argc,argv)!=0) { + run_error_dialog(_("Cannot initialze the GnomePilot Daemon")); + g_error(_("Cannot initialze the GnomePilot Daemon")); + return -1; + } + + /* 2 connect to gpilotd */ + if (gpilotd_connect()!=0) { + run_error_dialog(_("Cannot connect to the GnomePilot Daemon")); + g_error(_("Cannot connect to the GnomePilot Daemon")); + return -1; + } - pilotId = get_pilot_id_from_gpilotd(); - if(!pilotId) return -1; - org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId); + pilotId = get_pilot_id_from_gpilotd(); + if(!pilotId) return -1; + org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId); - pilot_capplet_setup(); + pilot_capplet_setup(); - /* done setting up, now run main loop */ - capplet_gtk_main(); - g_free(pilotId); - return 0; + /* done setting up, now run main loop */ + capplet_gtk_main(); + g_free(pilotId); + return 0; } diff --git a/calendar/calendar-conduit.c b/calendar/calendar-conduit.c index bf6b99a278..eced34396f 100644 --- a/calendar/calendar-conduit.c +++ b/calendar/calendar-conduit.c @@ -1063,7 +1063,7 @@ conduit_get_gpilot_conduit (guint32 pilotId) retval = gnome_pilot_conduit_standard_abs_new ("DatebookDB", 0x64617465); g_assert (retval != NULL); - /*gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"calendar");*/ + gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"calendar"); cfg = g_new0(ConduitCfg,1); g_assert(cfg != NULL); diff --git a/calendar/calendar.c b/calendar/calendar.c index cffd2476c4..d8b56160e8 100644 --- a/calendar/calendar.c +++ b/calendar/calendar.c @@ -391,9 +391,6 @@ vcalendar_create_from_calendar (Calendar *cal) addVObjectProp (vcal, obj); } - cleanVObject (vcal); - cleanStrTbl (); - return vcal; } @@ -437,7 +434,7 @@ calendar_save (Calendar *cal, char *fname) gtk_widget_show(dlg); } - cleanVObject (vcal); + cleanVObject (vcal); cleanStrTbl (); } diff --git a/calendar/conduits/calendar/calendar-conduit-control-applet.c b/calendar/conduits/calendar/calendar-conduit-control-applet.c index 44ca3d7898..4b18ae920f 100644 --- a/calendar/conduits/calendar/calendar-conduit-control-applet.c +++ b/calendar/conduits/calendar/calendar-conduit-control-applet.c @@ -251,29 +251,38 @@ gchar *get_pilot_id_from_gpilotd() { int main( int argc, char *argv[] ) { - /* we're a capplet */ - gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv, - NULL, - 0, NULL); - - /* put all code to set things up in here */ - conduit = gpilotd_conduit_mgmt_new("calendar_conduit"); - - /* get pilot name from gpilotd */ - /* 1. initialize the gpilotd connection */ - gpilotd_init(&argc,argv); - /* 2 connect to gpilotd */ - if(!gpilotd_connect()) g_error("Cannot connect to gpilotd"); + /* we're a capplet */ + gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv, + NULL, + 0, NULL); + + /* put all code to set things up in here */ + conduit = gpilotd_conduit_mgmt_new("calendar_conduit"); + + /* get pilot name from gpilotd */ + /* 1. initialize the gpilotd connection */ + if (gpilotd_init(&argc,argv)!=0) { + run_error_dialog(_("Cannot initialze the GnomePilot Daemon")); + g_error(_("Cannot initialze the GnomePilot Daemon")); + return -1; + } + + /* 2 connect to gpilotd */ + if (gpilotd_connect()!=0) { + run_error_dialog(_("Cannot connect to the GnomePilot Daemon")); + g_error(_("Cannot connect to the GnomePilot Daemon")); + return -1; + } - pilotId = get_pilot_id_from_gpilotd(); - if(!pilotId) return -1; - org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId); + pilotId = get_pilot_id_from_gpilotd(); + if(!pilotId) return -1; + org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId); - pilot_capplet_setup(); + pilot_capplet_setup(); - /* done setting up, now run main loop */ - capplet_gtk_main(); - g_free(pilotId); - return 0; + /* done setting up, now run main loop */ + capplet_gtk_main(); + g_free(pilotId); + return 0; } diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index bf6b99a278..eced34396f 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -1063,7 +1063,7 @@ conduit_get_gpilot_conduit (guint32 pilotId) retval = gnome_pilot_conduit_standard_abs_new ("DatebookDB", 0x64617465); g_assert (retval != NULL); - /*gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"calendar");*/ + gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"calendar"); cfg = g_new0(ConduitCfg,1); g_assert(cfg != NULL); diff --git a/calendar/conduits/todo/todo-conduit-control-applet.c b/calendar/conduits/todo/todo-conduit-control-applet.c index 06f068b787..973a6192c8 100644 --- a/calendar/conduits/todo/todo-conduit-control-applet.c +++ b/calendar/conduits/todo/todo-conduit-control-applet.c @@ -260,9 +260,18 @@ main( int argc, char *argv[] ) /* get pilot name from gpilotd */ /* 1. initialize the gpilotd connection */ - gpilotd_init(&argc,argv); + if (gpilotd_init(&argc,argv)!=0) { + run_error_dialog(_("Cannot initialze the GnomePilot Daemon")); + g_error(_("Cannot initialze the GnomePilot Daemon")); + return -1; + } + /* 2 connect to gpilotd */ - if(!gpilotd_connect()) g_error("Cannot connect to gpilotd"); + if (gpilotd_connect()!=0) { + run_error_dialog(_("Cannot connect to the GnomePilot Daemon")); + g_error(_("Cannot connect to the GnomePilot Daemon")); + return -1; + } pilotId = get_pilot_id_from_gpilotd(); if(!pilotId) return -1; diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 5ed3d8fbae..1b4927e0aa 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -9,7 +9,11 @@ gnorba_DATA = gnomecal.gnorba help_base = $(datadir)/gnome/help/cal if HAVE_GNOME_PILOT -bin_PROGRAMS = gnomecal todo-conduit-control-applet calendar-conduit-control-appleta calendar-pilot-sync +bin_PROGRAMS = \ + gnomecal \ + todo-conduit-control-applet \ + calendar-conduit-control-applet \ + calendar-pilot-sync else bin_PROGRAMS = gnomecal endif @@ -115,21 +119,22 @@ calendar_pilot_sync_LDADD = \ $(LINK_FLAGS) -if HAVE_GNOME_PILOT #calendar_conduit calendar_conduitsdir=$(libdir)/gnome-pilot/conduits calendar_conduits_LTLIBRARIES = libcalendar_conduit.la libcalendar_conduit_la_SOURCES = \ + GnomeCal-common.c \ + GnomeCal-stubs.c \ calendar-conduit.c \ calobj.c \ alarm.c \ - GnomeCal-common.c \ - GnomeCal-stubs.c \ calendar.c \ timeutil.c +calendar-conduit.c: my_gnomecal_idl + libcalendar_conduit_la_LDFLAGS = \ -rpath $(libdir) @@ -167,6 +172,8 @@ libtodo_conduit_la_LIBADD = \ libtodo_conduit_la_SOURCES = \ todo-conduit.c +todo-conduit.c: GnomeCal.h + todo_conduit_control_applet_SOURCES = \ todo-conduit-control-applet.c @@ -179,7 +186,6 @@ todo_conduit_control_applet_LDADD = \ $(PISOCK_LIBS) \ $(GNOME_PILOT_LIBS) \ $(INTLLIBS) -endif # HAVE_GNOME_PILOT gnomecal_LDADD = $(LINK_FLAGS) diff --git a/calendar/gui/calendar-conduit-control-applet.c b/calendar/gui/calendar-conduit-control-applet.c index 44ca3d7898..4b18ae920f 100644 --- a/calendar/gui/calendar-conduit-control-applet.c +++ b/calendar/gui/calendar-conduit-control-applet.c @@ -251,29 +251,38 @@ gchar *get_pilot_id_from_gpilotd() { int main( int argc, char *argv[] ) { - /* we're a capplet */ - gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv, - NULL, - 0, NULL); - - /* put all code to set things up in here */ - conduit = gpilotd_conduit_mgmt_new("calendar_conduit"); - - /* get pilot name from gpilotd */ - /* 1. initialize the gpilotd connection */ - gpilotd_init(&argc,argv); - /* 2 connect to gpilotd */ - if(!gpilotd_connect()) g_error("Cannot connect to gpilotd"); + /* we're a capplet */ + gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv, + NULL, + 0, NULL); + + /* put all code to set things up in here */ + conduit = gpilotd_conduit_mgmt_new("calendar_conduit"); + + /* get pilot name from gpilotd */ + /* 1. initialize the gpilotd connection */ + if (gpilotd_init(&argc,argv)!=0) { + run_error_dialog(_("Cannot initialze the GnomePilot Daemon")); + g_error(_("Cannot initialze the GnomePilot Daemon")); + return -1; + } + + /* 2 connect to gpilotd */ + if (gpilotd_connect()!=0) { + run_error_dialog(_("Cannot connect to the GnomePilot Daemon")); + g_error(_("Cannot connect to the GnomePilot Daemon")); + return -1; + } - pilotId = get_pilot_id_from_gpilotd(); - if(!pilotId) return -1; - org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId); + pilotId = get_pilot_id_from_gpilotd(); + if(!pilotId) return -1; + org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId); - pilot_capplet_setup(); + pilot_capplet_setup(); - /* done setting up, now run main loop */ - capplet_gtk_main(); - g_free(pilotId); - return 0; + /* done setting up, now run main loop */ + capplet_gtk_main(); + g_free(pilotId); + return 0; } diff --git a/calendar/gui/calendar-conduit.c b/calendar/gui/calendar-conduit.c index bf6b99a278..eced34396f 100644 --- a/calendar/gui/calendar-conduit.c +++ b/calendar/gui/calendar-conduit.c @@ -1063,7 +1063,7 @@ conduit_get_gpilot_conduit (guint32 pilotId) retval = gnome_pilot_conduit_standard_abs_new ("DatebookDB", 0x64617465); g_assert (retval != NULL); - /*gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"calendar");*/ + gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"calendar"); cfg = g_new0(ConduitCfg,1); g_assert(cfg != NULL); diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c index cffd2476c4..d8b56160e8 100644 --- a/calendar/gui/calendar.c +++ b/calendar/gui/calendar.c @@ -391,9 +391,6 @@ vcalendar_create_from_calendar (Calendar *cal) addVObjectProp (vcal, obj); } - cleanVObject (vcal); - cleanStrTbl (); - return vcal; } @@ -437,7 +434,7 @@ calendar_save (Calendar *cal, char *fname) gtk_widget_show(dlg); } - cleanVObject (vcal); + cleanVObject (vcal); cleanStrTbl (); } diff --git a/calendar/gui/todo-conduit-control-applet.c b/calendar/gui/todo-conduit-control-applet.c index 06f068b787..973a6192c8 100644 --- a/calendar/gui/todo-conduit-control-applet.c +++ b/calendar/gui/todo-conduit-control-applet.c @@ -260,9 +260,18 @@ main( int argc, char *argv[] ) /* get pilot name from gpilotd */ /* 1. initialize the gpilotd connection */ - gpilotd_init(&argc,argv); + if (gpilotd_init(&argc,argv)!=0) { + run_error_dialog(_("Cannot initialze the GnomePilot Daemon")); + g_error(_("Cannot initialze the GnomePilot Daemon")); + return -1; + } + /* 2 connect to gpilotd */ - if(!gpilotd_connect()) g_error("Cannot connect to gpilotd"); + if (gpilotd_connect()!=0) { + run_error_dialog(_("Cannot connect to the GnomePilot Daemon")); + g_error(_("Cannot connect to the GnomePilot Daemon")); + return -1; + } pilotId = get_pilot_id_from_gpilotd(); if(!pilotId) return -1; diff --git a/calendar/todo-conduit-control-applet.c b/calendar/todo-conduit-control-applet.c index 06f068b787..973a6192c8 100644 --- a/calendar/todo-conduit-control-applet.c +++ b/calendar/todo-conduit-control-applet.c @@ -260,9 +260,18 @@ main( int argc, char *argv[] ) /* get pilot name from gpilotd */ /* 1. initialize the gpilotd connection */ - gpilotd_init(&argc,argv); + if (gpilotd_init(&argc,argv)!=0) { + run_error_dialog(_("Cannot initialze the GnomePilot Daemon")); + g_error(_("Cannot initialze the GnomePilot Daemon")); + return -1; + } + /* 2 connect to gpilotd */ - if(!gpilotd_connect()) g_error("Cannot connect to gpilotd"); + if (gpilotd_connect()!=0) { + run_error_dialog(_("Cannot connect to the GnomePilot Daemon")); + g_error(_("Cannot connect to the GnomePilot Daemon")); + return -1; + } pilotId = get_pilot_id_from_gpilotd(); if(!pilotId) return -1; -- cgit v1.2.3