From 415efc9901808bf6013daaa1d821b1ff013c6b46 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 5 Nov 2002 13:49:19 +0000 Subject: use libxml2 headers. 2002-11-05 Rodrigo Moya * pcs/cal-backend.c: use libxml2 headers. * gui/alarm-notify/Makefile.am: * gui/dialogs/Makefile.am: * gui/Makefile.am: s/XML_I18N/INTLTOOL. Fixed execution of $(ORBIT_IDL). * gui/alarm-notify/alarm-notify.[ch]: converted to BonoboObject. * gui/alarm-notify/alarm-notify-dialog.c: compilation fixes. (alarm_notify_dialog): adapted to new glade_xml_new signature. * gui/alarm-notify/alarm-queue.c: ported to BonoboActivation and GtkStock and GtkDialog. * gui/alarm-notify/notify-main.c: ported to BonoboActivation and use GObject functions instead of GtkObject ones. * gui/alarm-notify/save.h: removed BonoboConfig related functions. * gui/alarm-notify/config-data.c: use GObject functions instead of GtkObject ones. * TODO.port: added file for keeping track of disabled things while we port. svn path=/trunk/; revision=18550 --- calendar/gui/alarm-notify/Makefile.am | 4 +- calendar/gui/alarm-notify/alarm-notify-dialog.c | 16 ++++--- calendar/gui/alarm-notify/alarm-notify.c | 64 +++++++++++++------------ calendar/gui/alarm-notify/alarm-notify.h | 16 +++---- calendar/gui/alarm-notify/alarm-queue.c | 47 ++++++++++-------- calendar/gui/alarm-notify/config-data.c | 2 +- calendar/gui/alarm-notify/notify-main.c | 23 ++++----- calendar/gui/alarm-notify/save.h | 4 -- 8 files changed, 91 insertions(+), 85 deletions(-) (limited to 'calendar/gui/alarm-notify') diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am index 6d77398ade..ca28d1c10b 100644 --- a/calendar/gui/alarm-notify/Makefile.am +++ b/calendar/gui/alarm-notify/Makefile.am @@ -6,7 +6,7 @@ CORBA_GENERATED = \ idls = $(top_srcdir)/calendar/idl/evolution-calendar.idl -idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl +idl_flags = $(IDL_INCLUDES) $(CORBA_GENERATED): $(idls) $(ORBIT_IDL) $(idl_flags) $(top_srcdir)/calendar/idl/evolution-calendar.idl @@ -72,7 +72,7 @@ oaf_in_files = \ oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) -@XML_I18N_MERGE_OAF_RULE@ +@INTLTOOL_OAF_RULE@ EXTRA_DIST = \ $(oaf_DATA) \ diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index 2ad6783cf9..46d6eca39e 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -26,13 +26,13 @@ #include #include #include -#include #include -#include +#if 0 +# include +#endif #include #include #include -#include #include #include #include @@ -213,9 +213,9 @@ static void write_times (GtkHTMLStream *stream, char *start, char *end) { if (start) - gtk_html_stream_printf (stream, "%s %s
", U_("Starting:"), start); + gtk_html_stream_printf (stream, "%s %s
", _("Starting:"), start); if (end) - gtk_html_stream_printf (stream, "%s %s
", U_("Ending:"), end); + gtk_html_stream_printf (stream, "%s %s
", _("Ending:"), end); } @@ -273,7 +273,7 @@ write_html_heading (GtkHTMLStream *stream, const char *message, "", bg_path, image_path, - U_("Evolution Alarm")); + _("Evolution Alarm")); gtk_html_stream_printf (stream, "

%s

", message); @@ -335,7 +335,7 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, an->func = func; an->func_data = func_data; - an->xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-notify.glade", NULL); + an->xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-notify.glade", NULL, NULL); if (!an->xml) { g_message ("alarm_notify_dialog(): Could not load the Glade XML file!"); g_free (an); @@ -402,9 +402,11 @@ alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, if (!GTK_WIDGET_REALIZED (an->dialog)) gtk_widget_realize (an->dialog); +#if 0 gnome_win_hints_set_state (an->dialog, WIN_STATE_STICKY); gnome_win_hints_set_layer (an->dialog, WIN_LAYER_ONTOP); gnome_window_icon_set_from_file (GTK_WINDOW (an->dialog), EVOLUTION_ICONSDIR "/alarm.png"); +#endif gtk_widget_show (an->dialog); return TRUE; diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index a2b3d1ae9d..8cba059431 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -58,9 +58,9 @@ struct _AlarmNotifyPrivate { -static void alarm_notify_class_init (AlarmNotifyClass *class); -static void alarm_notify_init (AlarmNotify *an); -static void alarm_notify_destroy (GtkObject *object); +static void alarm_notify_class_init (AlarmNotifyClass *klass); +static void alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass); +static void alarm_notify_finalize (GObject *object); static void AlarmNotify_addCalendar (PortableServer_Servant servant, const CORBA_char *str_uri, @@ -70,34 +70,34 @@ static void AlarmNotify_removeCalendar (PortableServer_Servant servant, CORBA_Environment *ev); -static BonoboXObjectClass *parent_class; +static BonoboObjectClass *parent_class; -BONOBO_X_TYPE_FUNC_FULL (AlarmNotify, - GNOME_Evolution_Calendar_AlarmNotify, - BONOBO_X_OBJECT_TYPE, - alarm_notify); +BONOBO_TYPE_FUNC_FULL (AlarmNotify, + GNOME_Evolution_Calendar_AlarmNotify, + BONOBO_TYPE_OBJECT, + alarm_notify); /* Class initialization function for the alarm notify service */ static void -alarm_notify_class_init (AlarmNotifyClass *class) +alarm_notify_class_init (AlarmNotifyClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) class; + object_class = (GObjectClass *) klass; - parent_class = gtk_type_class (BONOBO_X_OBJECT_TYPE); + parent_class = g_type_class_peek_parent (klass); - class->epv.addCalendar = AlarmNotify_addCalendar; - class->epv.removeCalendar = AlarmNotify_removeCalendar; + klass->epv.addCalendar = AlarmNotify_addCalendar; + klass->epv.removeCalendar = AlarmNotify_removeCalendar; - object_class->destroy = alarm_notify_destroy; + object_class->finalize = alarm_notify_finalize; } /* Object initialization function for the alarm notify system */ static void -alarm_notify_init (AlarmNotify *an) +alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass) { AlarmNotifyPrivate *priv; @@ -118,14 +118,14 @@ destroy_loaded_client_cb (gpointer key, gpointer value, gpointer data) lc = value; g_free (str_uri); - gtk_object_unref (GTK_OBJECT (lc->client)); + g_object_unref (G_OBJECT (lc->client)); e_uri_free (lc->uri); g_free (lc); } -/* Destroy handler for the alarm notify system */ +/* Finalize handler for the alarm notify system */ static void -alarm_notify_destroy (GtkObject *object) +alarm_notify_finalize (GObject *object) { AlarmNotify *an; AlarmNotifyPrivate *priv; @@ -144,8 +144,8 @@ alarm_notify_destroy (GtkObject *object) g_free (priv); an->priv = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -329,11 +329,13 @@ AlarmNotify_removeCalendar (PortableServer_Servant servant, g_hash_table_remove (priv->uri_client_hash, str_uri); g_free (orig_str); - gtk_signal_disconnect_by_data (GTK_OBJECT (lc->client), lc); + g_signal_handlers_disconnect_matched (GTK_OBJECT (lc->client), + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, lc); if (lc->timeout_id != -1) g_source_remove (lc->timeout_id); alarm_queue_remove_client (lc->client); - gtk_object_unref (GTK_OBJECT (lc->client)); + g_object_unref (G_OBJECT (lc->client)); e_uri_free (lc->uri); g_free (lc); } @@ -353,7 +355,7 @@ alarm_notify_new (void) { AlarmNotify *an; - an = gtk_type_new (TYPE_ALARM_NOTIFY); + an = g_object_new (TYPE_ALARM_NOTIFY, NULL); return an; } @@ -431,11 +433,13 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a if (g_hash_table_lookup_extended (priv->uri_client_hash, str_uri, &s, &lc)) { g_hash_table_remove (priv->uri_client_hash, str_uri); - gtk_signal_disconnect_by_data (GTK_OBJECT (lc->client), lc); + g_signal_handlers_disconnect_matched (G_OBJECT (lc->client), + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, lc); if (lc->timeout_id != -1) g_source_remove (lc->timeout_id); alarm_queue_remove_client (lc->client); - gtk_object_unref (GTK_OBJECT (lc->client)); + g_object_unref (G_OBJECT (lc->client)); e_uri_free (lc->uri); g_free (lc); @@ -449,9 +453,9 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a correctly */ lc = g_new (LoadedClient, 1); - gtk_signal_connect (GTK_OBJECT (client), "cal_opened", - GTK_SIGNAL_FUNC (cal_opened_cb), - lc); + g_signal_connect (G_OBJECT (client), "cal_opened", + G_CALLBACK (cal_opened_cb), + lc); if (cal_client_open_calendar (client, str_uri, FALSE)) { lc->client = client; @@ -462,7 +466,7 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a g_strdup (str_uri), lc); } else { g_free (lc); - gtk_object_unref (GTK_OBJECT (client)); + g_object_unref (G_OBJECT (client)); client = NULL; } } diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index 858c3a7d87..f3157000c0 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -22,17 +22,17 @@ #ifndef ALARM_NOTIFY_H #define ALARM_NOTIFY_H -#include +#include #include "evolution-calendar.h" #define TYPE_ALARM_NOTIFY (alarm_notify_get_type ()) -#define ALARM_NOTIFY(obj) (GTK_CHECK_CAST ((obj), TYPE_ALARM_NOTIFY, AlarmNotify)) -#define ALARM_NOTIFY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_ALARM_NOTIFY, \ +#define ALARM_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ALARM_NOTIFY, AlarmNotify)) +#define ALARM_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ALARM_NOTIFY, \ AlarmNotifyClass)) -#define IS_ALARM_NOTIFY(obj) (GTK_CHECK_TYPE ((obj), TYPE_ALARM_NOTIFY)) -#define IS_ALARM_NOTIFY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_ALARM_NOTIFY)) +#define IS_ALARM_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ALARM_NOTIFY)) +#define IS_ALARM_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ALARM_NOTIFY)) typedef struct _AlarmNotify AlarmNotify; typedef struct _AlarmNotifyClass AlarmNotifyClass; @@ -40,19 +40,19 @@ typedef struct _AlarmNotifyClass AlarmNotifyClass; typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate; struct _AlarmNotify { - BonoboXObject xobject; + BonoboObject xobject; /* Private data */ AlarmNotifyPrivate *priv; }; struct _AlarmNotifyClass { - BonoboXObjectClass parent_class; + BonoboObjectClass parent_class; POA_GNOME_Evolution_Calendar_AlarmNotify__epv epv; }; -GtkType alarm_notify_get_type (void); +GType alarm_notify_get_type (void); AlarmNotify *alarm_notify_new (void); diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 6782c91a2d..9dbaec56d7 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -23,19 +23,18 @@ #endif #include -#include +#include #include #include #include +#include #include #include -#include +#include #include #include #include -#include #include -#include #include #include #include "alarm.h" @@ -566,8 +565,8 @@ edit_component (CompQueuedAlarms *cqa) /* Get the factory */ CORBA_exception_init (&ev); - factory = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", - 0, NULL, &ev); + factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", + 0, NULL, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_message ("edit_component(): Could not activate the component editor factory"); @@ -733,16 +732,23 @@ static void mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) { GtkWidget *dialog; + GtkWidget *label; /* FIXME */ display_notification (trigger, cqa, alarm_id, FALSE); - dialog = gnome_warning_dialog (_("Evolution does not support calendar reminders with\n" - "email notifications yet, but this reminder was\n" - "configured to send an email. Evolution will display\n" - "a normal reminder dialog box instead.")); - gnome_dialog_run (GNOME_DIALOG (dialog)); + dialog = gtk_dialog_new_with_buttons (_("Warning"), + NULL, 0, + GTK_STOCK_OK, GTK_RESPONSE_CANCEL, + NULL); + label = gtk_label_new (_("Evolution does not support calendar reminders with\n" + "email notifications yet, but this reminder was\n" + "configured to send an email. Evolution will display\n" + "a normal reminder dialog box instead.")); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4); + + gtk_dialog_run (GTK_DIALOG (dialog)); } /* Performs notification of a procedure alarm */ @@ -756,10 +762,11 @@ procedure_notification_dialog (const char *cmd, const char *url) if (is_blessed_program (url)) return TRUE; - dialog = gnome_dialog_new (_("Warning"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); + dialog = gtk_dialog_new_with_buttons (_("Warning"), + NULL, 0, + GTK_STOCK_NO, GTK_RESPONSE_CANCEL, + GTK_STOCK_YES, GTK_RESPONSE_OK, + NULL); str = g_strdup_printf (_("An Evolution Calendar reminder is about to trigger. " "This reminder is configured to run the following program:\n\n" @@ -770,21 +777,21 @@ procedure_notification_dialog (const char *cmd, const char *url) gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4); g_free (str); checkbox = gtk_check_button_new_with_label (_("Do not ask me about this program again.")); gtk_widget_show (checkbox); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4); /* Run the dialog */ - btn = gnome_dialog_run (GNOME_DIALOG (dialog)); - if (btn == GNOME_YES && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))) + btn = gtk_dialog_run (GTK_DIALOG (dialog)); + if (btn == GTK_RESPONSE_OK && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))) save_blessed_program (url); - gnome_dialog_close (GNOME_DIALOG (dialog)); + gtk_widget_destroy (dialog); return (btn == GNOME_YES); } diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index 0e2846308f..babb387e7a 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -49,7 +49,7 @@ locale_supports_12_hour_format (void) static void do_cleanup (void) { - gtk_object_unref (GTK_OBJECT (config)); + g_object_unref (G_OBJECT (config)); config = NULL; inited = FALSE; } diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index c0af3ea51a..b4eb59ce1c 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -24,14 +24,14 @@ #endif #include -#include #include -#include +#include +#include #include #include #include #include -#include +#include #include "alarm.h" #include "alarm-queue.h" #include "alarm-notify.h" @@ -82,15 +82,15 @@ set_session_parameters (char **argv) gnome_client_set_restart_command (master_client, 1, args); - gtk_signal_connect (GTK_OBJECT (master_client), "die", - GTK_SIGNAL_FUNC (client_die_cb), NULL); + g_signal_connect (G_OBJECT (master_client), "die", + G_CALLBACK (client_die_cb), NULL); } /* Factory function for the alarm notify service; just creates and references a * singleton service object. */ static BonoboObject * -alarm_notify_factory_fn (BonoboGenericFactory *factory, void *data) +alarm_notify_factory_fn (BonoboGenericFactory *factory, const char *component_id, void *data) { if (!alarm_notify_service) { alarm_notify_service = alarm_notify_new (); @@ -164,13 +164,10 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); textdomain (PACKAGE); - if (gnome_init_with_popt_table ("evolution-alarm-notify", VERSION, argc, argv, - oaf_popt_options, 0, NULL) != 0) - g_error (_("Could not initialize GNOME")); + gnome_program_init ("evolution-alarm-notify", VERSION, LIBGNOME_MODULE, argc, argv, NULL); + bonobo_activation_init (argc, argv); - oaf_init (argc, argv); - - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) + if (bonobo_init (&argc, argv) == FALSE) g_error (_("Could not initialize Bonobo")); if (!gnome_vfs_init ()) @@ -179,7 +176,7 @@ main (int argc, char **argv) glade_gnome_init (); factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory", - alarm_notify_factory_fn, NULL); + (BonoboFactoryCallback) alarm_notify_factory_fn, NULL); if (!factory) g_error (_("Could not create the alarm notify service factory")); diff --git a/calendar/gui/alarm-notify/save.h b/calendar/gui/alarm-notify/save.h index 50371e0a5b..f7cc75955c 100644 --- a/calendar/gui/alarm-notify/save.h +++ b/calendar/gui/alarm-notify/save.h @@ -22,10 +22,6 @@ #define SAVE_H #include -#include - -Bonobo_ConfigDatabase get_config_db (void); -void discard_config_db (Bonobo_ConfigDatabase db); void save_notification_time (time_t t); time_t get_saved_notification_time (void); -- cgit