From ac6299d7a485294d6090835b9942ea061c5279cf Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 15 Mar 2002 14:05:33 +0000 Subject: use bonobo exception macros to tidy 2002-03-15 JP Rosevear * gui/main.c: use bonobo exception macros to tidy * gui/itip-control-factory.c: ditto * gui/gnome-cal.c: ditto * gui/comp-editor-factory.c: ditto * gui/calendar-commands.c: ditto svn path=/trunk/; revision=16172 --- calendar/ChangeLog | 12 ++++++++++++ calendar/gui/calendar-commands.c | 5 +++-- calendar/gui/comp-editor-factory.c | 10 +++------- calendar/gui/gnome-cal.c | 24 ++++++++++-------------- calendar/gui/itip-bonobo-control.c | 14 ++++++-------- calendar/gui/itip-control-factory.c | 14 ++++++-------- calendar/gui/main.c | 5 +++-- 7 files changed, 43 insertions(+), 41 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index ba6521c843..5d21a09727 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,15 @@ +2002-03-15 JP Rosevear + + * gui/main.c: use bonobo exception macros to tidy + + * gui/itip-control-factory.c: ditto + + * gui/gnome-cal.c: ditto + + * gui/comp-editor-factory.c: ditto + + * gui/calendar-commands.c: ditto + 2002-03-14 JP Rosevear * idl/evolution-calendar.idl: add all day event editor mode diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 4aa9eb7248..8eb6a540e8 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include "shell/Evolution.h" #include "calendar-commands.h" @@ -339,7 +340,7 @@ get_shell_view_interface (BonoboControl *control) shell_view = Bonobo_Unknown_queryInterface (control_frame, "IDL:GNOME/Evolution/ShellView:1.0", &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_message ("get_shell_view_interface(): " "Could not queryInterface() on the control frame"); shell_view = CORBA_OBJECT_NIL; @@ -464,7 +465,7 @@ control_util_set_folder_bar_label (BonoboControl *control, char *label) CORBA_exception_init (&ev); GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, label, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_EX (&ev)) g_message ("control_util_set_folder_bar_label(): Could not set the folder bar label"); CORBA_exception_free (&ev); diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c index 54f0f00569..805e0a5c0b 100644 --- a/calendar/gui/comp-editor-factory.c +++ b/calendar/gui/comp-editor-factory.c @@ -22,6 +22,7 @@ #include #endif +#include #include #include #include @@ -589,9 +590,7 @@ lookup_open_client (CompEditorFactory *factory, const char *str_uri, CORBA_Envir uri = e_uri_new (str_uri); if (!uri) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_CompEditorFactory_InvalidURI, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CompEditorFactory_InvalidURI); return NULL; } e_uri_free (uri); @@ -600,10 +599,7 @@ lookup_open_client (CompEditorFactory *factory, const char *str_uri, CORBA_Envir if (!oc) { oc = open_client (factory, str_uri); if (!oc) { - CORBA_exception_set ( - ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_CompEditorFactory_BackendContactError, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_CompEditorFactory_BackendContactError); return NULL; } } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 0799c6a218..9ff815211e 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include "e-util/e-url.h" @@ -1801,7 +1802,7 @@ add_alarms (const char *uri) CORBA_exception_init (&ev); an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_message ("add_alarms(): Could not activate the alarm notification service"); CORBA_exception_free (&ev); return; @@ -1813,18 +1814,13 @@ add_alarms (const char *uri) CORBA_exception_init (&ev); GNOME_Evolution_Calendar_AlarmNotify_addCalendar (an, uri, &ev); - if (ev._major == CORBA_USER_EXCEPTION) { - char *ex_id; - - ex_id = CORBA_exception_id (&ev); - if (strcmp (ex_id, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI) == 0) - g_message ("add_calendar(): Invalid URI reported from the " - "alarm notification service"); - else if (strcmp (ex_id, - ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError) == 0) - g_message ("add_calendar(): The alarm notification service could " - "not contact the backend"); - } else if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI)) + g_message ("add_calendar(): Invalid URI reported from the " + "alarm notification service"); + else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError)) + g_message ("add_calendar(): The alarm notification service could " + "not contact the backend"); + else if (BONOBO_EX (&ev)) g_message ("add_calendar(): Could not issue the addCalendar request"); CORBA_exception_free (&ev); @@ -1833,7 +1829,7 @@ add_alarms (const char *uri) CORBA_exception_init (&ev); bonobo_object_release_unref (an, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_EX (&ev)) g_message ("add_alarms(): Could not unref the alarm notification service"); CORBA_exception_free (&ev); diff --git a/calendar/gui/itip-bonobo-control.c b/calendar/gui/itip-bonobo-control.c index 54681346cc..d05cee6d9a 100644 --- a/calendar/gui/itip-bonobo-control.c +++ b/calendar/gui/itip-bonobo-control.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "e-itip-control.h" @@ -63,7 +64,7 @@ stream_read (Bonobo_Stream stream) Bonobo_Stream_read (stream, READ_CHUNK_SIZE, &buffer, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { CORBA_exception_free (&ev); return NULL; } @@ -101,15 +102,13 @@ pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream, gchar *text; if (type && g_strcasecmp (type, "text/calendar") != 0 && - g_strcasecmp (type, "text/x-calendar") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); + g_strcasecmp (type, "text/x-calendar") != 0) { + bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType); return; } if ((text = stream_read (stream)) == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_FileNotFound, NULL); + bonobo_exception_set (ev, ex_Bonobo_Persist_FileNotFound); return; } @@ -130,8 +129,7 @@ pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream, if (type && g_strcasecmp (type, "text/calendar") != 0 && g_strcasecmp (type, "text/x-calendar") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); + bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType); return; } diff --git a/calendar/gui/itip-control-factory.c b/calendar/gui/itip-control-factory.c index 54681346cc..d05cee6d9a 100644 --- a/calendar/gui/itip-control-factory.c +++ b/calendar/gui/itip-control-factory.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "e-itip-control.h" @@ -63,7 +64,7 @@ stream_read (Bonobo_Stream stream) Bonobo_Stream_read (stream, READ_CHUNK_SIZE, &buffer, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { CORBA_exception_free (&ev); return NULL; } @@ -101,15 +102,13 @@ pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream, gchar *text; if (type && g_strcasecmp (type, "text/calendar") != 0 && - g_strcasecmp (type, "text/x-calendar") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); + g_strcasecmp (type, "text/x-calendar") != 0) { + bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType); return; } if ((text = stream_read (stream)) == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_FileNotFound, NULL); + bonobo_exception_set (ev, ex_Bonobo_Persist_FileNotFound); return; } @@ -130,8 +129,7 @@ pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream, if (type && g_strcasecmp (type, "text/calendar") != 0 && g_strcasecmp (type, "text/x-calendar") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); + bonobo_exception_set (ev, ex_Bonobo_Persist_WrongDataType); return; } diff --git a/calendar/gui/main.c b/calendar/gui/main.c index b74b1040cd..5c7a2bc08f 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -103,7 +104,7 @@ launch_alarm_daemon (void) CORBA_exception_init (&ev); an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_message ("add_alarms(): Could not activate the alarm notification service"); CORBA_exception_free (&ev); return; @@ -114,7 +115,7 @@ launch_alarm_daemon (void) CORBA_exception_init (&ev); bonobo_object_release_unref (an, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_EX (&ev)) g_message ("add_alarms(): Could not unref the alarm notification service"); CORBA_exception_free (&ev); -- cgit v1.2.3