From f36f2d1fcf5851aa1d00ab8096ca0b362880475b Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 6 Nov 2002 00:42:52 +0000 Subject: #include . * metar.c: #include . * main.c (main): Use gnome_program_init(). * e-summary-tasks.c (e_summary_tasks_protocol): Use bonobo-activation. * e-summary-table.c (set_value_at): Use g_signal_emit() instead of gtk_signal_emit(). * e-summary-shown.c (e_summary_shown_class_init): GObjectified. (construct_pixmap_button): Use gtk_image_new_from_stock() instead of gnome_stock_pixmap_new(). * e-summary-preferences.c (e_summary_preferences_restore): Use EConfigListener. (add_dialog_clicked_cb): Add some missing consts. (factory_fn): Pass NULL as the domain arg to glade_xml_new(). (factory_fn): Add id arg. (e_summary_preferences_register_config_control_factory): * e-summary-mail.c (e_summary_folder_init_folder_store): Use bonobo-activation. * e-summary-factory.c (control_activate): Pass NULL ev arg to bonobo functions that now need it. (control_deactivate): Likewise. (control_activate_cb): Likewise. (e_summary_factory_new_control): Use g_signal_connect() instead of gtk_signal_connect(). * e-summary-calendar.c (e_summary_calendar_protocol): Use bonobo_activation. * e-summary.c: Update gnome-print #includes. Added some missing #includes. (e_summary_url_clicked): Pass NULL as the error arg to gnome_url_show(). (do_summary_print): Use GnomePrintConfig instead of GnomePrinter et al. * e-cell-tri.h: Removed BEGIN_GNOME_DECLS/END_GNOME_DECLS. * e-summary.c: Removed #include . Ported to e-config-listener.c. * e-cell-tri.h: Removed #include . * component-factory.c: #include . (create_component): Use g_signal_connect. Match prototype with the one required by bonobo_generic_factory(). * Makefile.am: Add @INTLTOOL_SERVER_RULE@. ($(MAIL_GENERATED)): Update with new ORBit rules. svn path=/trunk/; revision=18574 --- my-evolution/e-summary-preferences.c | 145 ++++++++++++----------------------- 1 file changed, 48 insertions(+), 97 deletions(-) (limited to 'my-evolution/e-summary-preferences.c') diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c index b231da9263..3f11ae4b4e 100644 --- a/my-evolution/e-summary-preferences.c +++ b/my-evolution/e-summary-preferences.c @@ -26,13 +26,11 @@ #include -#include #include #include #include #include -#include #include #include @@ -44,10 +42,12 @@ #include #include -#include - #include +#include + +#include "e-util/e-config-listener.h" + #include "e-summary.h" #include "e-summary-preferences.h" #include "e-summary-table.h" @@ -238,98 +238,62 @@ vector_from_folder_list (GList *flist) gboolean e_summary_preferences_restore (ESummaryPrefs *prefs) { - Bonobo_ConfigDatabase db; - CORBA_Environment ev; + EConfigListener *config_listener; char *vector; + gboolean used_default; g_return_val_if_fail (prefs != NULL, FALSE); - CORBA_exception_init (&ev); - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Error getting Wombat. Using defaults"); - CORBA_exception_free (&ev); - return FALSE; - } + config_listener = e_config_listener_new (); - CORBA_exception_free (&ev); - vector = bonobo_config_get_string (db, "My-Evolution/Mail/display_folders-1.2", &ev); - if (BONOBO_EX (&ev)) { + vector = e_config_listener_get_string (config_listener, "My-Evolution/Mail/display_folders-1.2"); + if (vector == NULL) { g_warning ("Error getting Mail/display_folders. Using defaults"); - CORBA_exception_free (&ev); make_initial_mail_list (prefs); } else { prefs->display_folders = folder_list_from_vector (vector); g_free (vector); } - prefs->show_full_path = bonobo_config_get_boolean (db, "My-Evolution/Mail/show_full_path", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Error getting Mail/show_full_path. Using defaults"); - bonobo_object_release_unref (db, NULL); - CORBA_exception_free (&ev); - return FALSE; - } + prefs->show_full_path = e_config_listener_get_boolean (config_listener, "My-Evolution/Mail/show_full_path"); - - vector = bonobo_config_get_string (db, "My-Evolution/RDF/rdf_urls", &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Error getting RDF/rdf_urls"); - CORBA_exception_free (&ev); - bonobo_object_release_unref (db, NULL); + vector = e_config_listener_get_string (config_listener, "My-Evolution/RDF/rdf_urls"); + if (vector == NULL) return FALSE; - } + prefs->rdf_urls = str_list_from_vector (vector); - g_free (vector); + g_free (vector); - prefs->rdf_refresh_time = bonobo_config_get_long_with_default (db, "My-Evolution/RDF/rdf_refresh_time", 600, NULL); + prefs->rdf_refresh_time = e_config_listener_get_long_with_default (config_listener, "My-Evolution/RDF/rdf_refresh_time", 600, NULL); - prefs->limit = bonobo_config_get_long_with_default (db, "My-Evolution/RDF/limit", 10, NULL); + prefs->limit = e_config_listener_get_long_with_default (config_listener, "My-Evolution/RDF/limit", 10, NULL); - vector = bonobo_config_get_string (db, "My-Evolution/Weather/stations", &ev); - if (BONOBO_EX (&ev)) { - g_warning ("Error getting Weather/stations"); - CORBA_exception_free (&ev); - bonobo_object_release_unref (db, NULL); + vector = e_config_listener_get_string (config_listener, "My-Evolution/Weather/stations"); + if (vector == NULL) return FALSE; - } + prefs->stations = str_list_from_vector (vector); - g_free (vector); + g_free (vector); - prefs->units = bonobo_config_get_long (db, "My-Evolution/Weather/units", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Error getting Weather/units. Using defaults"); - bonobo_object_release_unref (db, NULL); - CORBA_exception_free (&ev); + prefs->units = e_config_listener_get_long_with_default (config_listener, "My-Evolution/Weather/units", -1, &used_default); + if (used_default) return FALSE; - } - prefs->weather_refresh_time = bonobo_config_get_long (db, "My-Evolution/Weather/weather_refresh_time", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Error getting Weather/weather_refresh_time. Using defaults"); - bonobo_object_release_unref (db, NULL); - CORBA_exception_free (&ev); + prefs->weather_refresh_time = e_config_listener_get_long_with_default (config_listener, + "My-Evolution/Weather/weather_refresh_time", + -1, &used_default); + if (used_default) return FALSE; - } - - prefs->days = bonobo_config_get_long (db, "My-Evolution/Schedule/days", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Error getting Schedule/days. Using defaults"); - bonobo_object_release_unref (db, NULL); - CORBA_exception_free (&ev); + prefs->days = e_config_listener_get_long_with_default (config_listener, "My-Evolution/Schedule/days", -1, &used_default); + if (used_default) return FALSE; - } - prefs->show_tasks = bonobo_config_get_long (db, "My-Evolution/Schedule/show_tasks", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Error getting Schedule/show_tasks. Using defaults"); - bonobo_object_release_unref (db, NULL); - CORBA_exception_free (&ev); + prefs->show_tasks = e_config_listener_get_long_with_default (config_listener, "My-Evolution/Schedule/show_tasks", -1, &used_default); + if (&used_default) return FALSE; - } - bonobo_object_release_unref (db, NULL); + g_object_unref (config_listener); return TRUE; } @@ -337,49 +301,35 @@ e_summary_preferences_restore (ESummaryPrefs *prefs) void e_summary_preferences_save (ESummaryPrefs *prefs) { - Bonobo_ConfigDatabase db; - CORBA_Environment ev; + EConfigListener *config_listener; char *vector; - g_return_if_fail (prefs != NULL); - - CORBA_exception_init (&ev); - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - g_warning ("Cannot save preferences"); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); + config_listener = e_config_listener_new (); vector = vector_from_folder_list (prefs->display_folders); - bonobo_config_set_string (db, "My-Evolution/Mail/display_folders-1.2", vector, NULL); + e_config_listener_set_string (config_listener, "My-Evolution/Mail/display_folders-1.2", vector); g_free (vector); - bonobo_config_set_boolean (db, "My-Evolution/Mail/show_full_path", prefs->show_full_path, NULL); + e_config_listener_set_boolean (config_listener, "My-Evolution/Mail/show_full_path", prefs->show_full_path); vector = vector_from_str_list (prefs->rdf_urls); - bonobo_config_set_string (db, "My-Evolution/RDF/rdf_urls", vector, NULL); + e_config_listener_set_string (config_listener, "My-Evolution/RDF/rdf_urls", vector); g_free (vector); - bonobo_config_set_long (db, "My-Evolution/RDF/rdf_refresh_time", prefs->rdf_refresh_time, NULL); - bonobo_config_set_long (db, "My-Evolution/RDF/limit", prefs->limit, NULL); + e_config_listener_set_long (config_listener, "My-Evolution/RDF/rdf_refresh_time", prefs->rdf_refresh_time); + e_config_listener_set_long (config_listener, "My-Evolution/RDF/limit", prefs->limit); vector = vector_from_str_list (prefs->stations); - bonobo_config_set_string (db, "My-Evolution/Weather/stations", vector, NULL); + e_config_listener_set_string (config_listener, "My-Evolution/Weather/stations", vector); g_free (vector); - bonobo_config_set_long (db, "My-Evolution/Weather/units", prefs->units, NULL); - bonobo_config_set_long (db, "My-Evolution/Weather/weather_refresh_time", prefs->weather_refresh_time, NULL); - - bonobo_config_set_long (db, "My-Evolution/Schedule/days", prefs->days, NULL); - bonobo_config_set_long (db, "My-Evolution/Schedule/show_tasks", prefs->show_tasks, NULL); + e_config_listener_set_long (config_listener, "My-Evolution/Weather/units", prefs->units); + e_config_listener_set_long (config_listener, "My-Evolution/Weather/weather_refresh_time", prefs->weather_refresh_time); - CORBA_exception_init (&ev); - Bonobo_ConfigDatabase_sync (db, &ev); - CORBA_exception_free (&ev); + e_config_listener_set_long (config_listener, "My-Evolution/Schedule/days", prefs->days); + e_config_listener_set_long (config_listener, "My-Evolution/Schedule/show_tasks", prefs->show_tasks); - bonobo_object_release_unref (db, NULL); + g_object_unref (config_listener); } static void @@ -786,8 +736,8 @@ add_dialog_clicked_cb (GtkWidget *widget, PropertyData *pd) { if (button == 0) { - char *url; - char *name; + const char *url; + const char *name; name = gtk_entry_get_text (GTK_ENTRY (pd->new_name_entry)); url = gtk_entry_get_text (GTK_ENTRY (pd->new_url_entry)); @@ -1482,6 +1432,7 @@ config_control_destroy_cb (EvolutionConfigControl *config_control, static BonoboObject * factory_fn (BonoboGenericFactory *generic_factory, + const char *id, void *data) { PropertyData *pd; @@ -1489,7 +1440,7 @@ factory_fn (BonoboGenericFactory *generic_factory, pd = g_new0 (PropertyData, 1); - pd->xml = glade_xml_new (EVOLUTION_GLADEDIR "/my-evolution.glade", NULL); + pd->xml = glade_xml_new (EVOLUTION_GLADEDIR "/my-evolution.glade", NULL, NULL); g_return_val_if_fail (pd->xml != NULL, NULL); widget = glade_xml_get_widget (pd->xml, "notebook"); -- cgit v1.2.3