From abda9814844d31daaf4c6355da9a886c69bda9be Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 18 Nov 2002 11:29:35 +0000 Subject: from clicked_cb. (start_import): gtkdialogise. 2002-11-18 Not Zed * importer/importer.c (dialog_response_cb): from clicked_cb. (start_import): gtkdialogise. * e-shell-importer.c: removed redundant header. (create_html): Removed utf8 from locale stuff. (get_name_from_component_info): oaf->bonobo activation. (get_iid_for_filetype): " (create_plugin_menu): Likewise, and change oafiid to bonoboiid (get_intelligent_importers): " (prepare_intelligent_page): " (show_import_wizard): add null domain to glade_xml_new. (choose_importer_from_list): gtkdialogise. (dialog_response_cb): changed from dialog_clicked_cb. (start_import): gtkdialogise. (show_error): use gtk message box. (error_response_cb): callback to close error box. (show_import_wizard): gnome_druid_page_start/finish -> gnome_druid_page_edge. (prepare_file_page): (filename_changed): set HELP button insensitive. (create_plugin_menu): casts for warnings and fix a typo, set_data->set_data_full. (import_druid_finish): folder_selection_dialog api change(?), allow create. (dialog_weak_notify): renamed from close_dialog(). (show_import_wizard): remove gnome_dialog_close_hides -> its a gtkwindow anyway(!). * Makefile.am (evolution_LDADD): Added back importer. (evolution_SOURCES): Added back importer. * importer/intelligent.c (get_intelligent_importers): bonobo-activationised. (create_gui): gtkdialogise. (intelligent_importer_init): gtkdialogise. (create_gui): remove gnome_util_user_home(). (intelligent_importer_init): " * importer/evolution-importer.c (finalise): from destroy. (evolution_importer_new): type_new->object_new. * importer/evolution-importer-listener.c (finalise): from destroy. (evolution_importer_listener_new): type_new->object_new. * importer/evolution-importer-client.c (destroy): removed, as it wasn't used anyway. (evolution_importer_client_new): g_object_new. (finalise): added, tho doesn't do anythign yet, should it unref the client->objref? This whole class doesn't seem much use. * importer/evolution-importer-client.h: removed bonobo-object-client, change to g_object. * importer/*.[ch]: ran fix script over everything. * importer/evolution-intelligent-importer.c: gobjectise. (finalise): renamed from destroy. (evolution_intelligent_importer_new): gtk_type_new -> g_object_new svn path=/trunk/; revision=18821 --- shell/ChangeLog | 61 ++++++++++++ shell/Makefile.am | 14 +-- shell/e-shell-importer.c | 123 ++++++++++++------------ shell/importer/evolution-importer-client.c | 24 ++--- shell/importer/evolution-importer-client.h | 15 ++- shell/importer/evolution-importer-listener.c | 16 +-- shell/importer/evolution-importer-listener.h | 10 +- shell/importer/evolution-importer.c | 14 +-- shell/importer/evolution-importer.h | 10 +- shell/importer/evolution-intelligent-importer.c | 14 +-- shell/importer/evolution-intelligent-importer.h | 10 +- shell/importer/intelligent.c | 80 ++++++++------- 12 files changed, 222 insertions(+), 169 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 593c9affac..073ab4ab62 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,64 @@ +2002-11-18 Not Zed + + * importer/importer.c (dialog_response_cb): from clicked_cb. + (start_import): gtkdialogise. + + * e-shell-importer.c: removed redundant header. + (create_html): Removed utf8 from locale stuff. + (get_name_from_component_info): oaf->bonobo activation. + (get_iid_for_filetype): " + (create_plugin_menu): Likewise, and change oafiid to bonoboiid + (get_intelligent_importers): " + (prepare_intelligent_page): " + (show_import_wizard): add null domain to glade_xml_new. + (choose_importer_from_list): gtkdialogise. + (dialog_response_cb): changed from dialog_clicked_cb. + (start_import): gtkdialogise. + (show_error): use gtk message box. + (error_response_cb): callback to close error box. + (show_import_wizard): gnome_druid_page_start/finish -> + gnome_druid_page_edge. + (prepare_file_page): + (filename_changed): set HELP button insensitive. + (create_plugin_menu): casts for warnings and fix a typo, + set_data->set_data_full. + (import_druid_finish): folder_selection_dialog api change(?), + allow create. + (dialog_weak_notify): renamed from close_dialog(). + (show_import_wizard): remove gnome_dialog_close_hides -> its a + gtkwindow anyway(!). + + * Makefile.am (evolution_LDADD): Added back importer. + (evolution_SOURCES): Added back importer. + + * importer/intelligent.c (get_intelligent_importers): + bonobo-activationised. + (create_gui): gtkdialogise. + (intelligent_importer_init): gtkdialogise. + (create_gui): remove gnome_util_user_home(). + (intelligent_importer_init): " + + * importer/evolution-importer.c (finalise): from destroy. + (evolution_importer_new): type_new->object_new. + + * importer/evolution-importer-listener.c (finalise): from destroy. + (evolution_importer_listener_new): type_new->object_new. + + * importer/evolution-importer-client.c (destroy): removed, as it + wasn't used anyway. + (evolution_importer_client_new): g_object_new. + (finalise): added, tho doesn't do anythign yet, should it unref + the client->objref? This whole class doesn't seem much use. + + * importer/evolution-importer-client.h: removed + bonobo-object-client, change to g_object. + + * importer/*.[ch]: ran fix script over everything. + + * importer/evolution-intelligent-importer.c: gobjectise. + (finalise): renamed from destroy. + (evolution_intelligent_importer_new): gtk_type_new -> g_object_new + 2002-11-18 Chris Toshok * importer/import.glade: run libglade-convert. diff --git a/shell/Makefile.am b/shell/Makefile.am index 838e582237..8e38448ad5 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -1,6 +1,4 @@ -SUBDIRS = glade - -# FIXME importer +SUBDIRS = glade importer INCLUDES = \ -I$(top_srcdir)/widgets \ @@ -177,6 +175,8 @@ evolution_SOURCES = \ e-shell-folder-selection-dialog.h \ e-shell-folder-title-bar.c \ e-shell-folder-title-bar.h \ + e-shell-importer.c \ + e-shell-importer.h \ e-shell-offline-handler.c \ e-shell-offline-handler.h \ e-shell-offline-sync.c \ @@ -225,15 +225,13 @@ evolution_SOURCES = \ evolution_LDADD = \ libeshell.la \ + importer/libevolution-importer.la \ $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/libical/src/libical/libical-evolution.la \ $(SHELL_LIBS) -# FIXME -# importer/libevolution-importer.la \ - # Test component noinst_PROGRAMS = \ @@ -323,7 +321,3 @@ if HAVE_DTAPPINTEGRATE bin_SCRIPTS = evolution-nognome endif - -# FIXME TODO: -# e-shell-importer.c -# e-shell-importer.h diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index b2bb3b00c1..284b7d292d 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -28,11 +28,14 @@ #include #include +#include + #include #include #include +#include +#include #include -#include #include @@ -49,7 +52,6 @@ #include #include #include -#include #include #include "e-util/e-html-utils.h" @@ -95,8 +97,8 @@ typedef struct _ImportData { GtkWidget *filedialog; GtkWidget *typedialog; GtkWidget *intelligent; - GnomeDruidPageStart *start; - GnomeDruidPageFinish *finish; + GnomeDruidPageEdge *start; + GnomeDruidPageEdge *finish; GtkWidget *vbox; char *choosen_iid; @@ -161,7 +163,6 @@ create_html (const char *name) GtkWidget *scrolled, *html; GtkHTMLStream *stream; GtkStyle *style; - char *utf8; int i; html = gtk_html_new (); @@ -193,9 +194,7 @@ create_html (const char *name) stream = gtk_html_begin_content (GTK_HTML (html), "text/html; charset=utf-8"); gtk_html_write (GTK_HTML (html), stream, "

", 9); - utf8 = e_utf8_from_locale_string (_(info[i].text)); - gtk_html_write (GTK_HTML (html), stream, utf8, strlen (utf8)); - g_free (utf8); + gtk_html_write (GTK_HTML (html), stream, _(info[i].text), strlen (_(info[i].text))); gtk_html_write (GTK_HTML (html), stream, "

", 11); gtk_html_end (GTK_HTML (html), stream, GTK_HTML_STREAM_OK); @@ -210,7 +209,7 @@ typedef struct _ImporterComponentData { EvolutionImporterListener *listener; char *filename; - GnomeDialog *dialog; + GtkDialog *dialog; GtkWidget *contents; int item; @@ -259,7 +258,7 @@ import_cb (EvolutionImporterListener *listener, g_free (icd->filename); if (icd->dialog != NULL) - gtk_widget_destroy (icd->dialog); + gtk_widget_destroy ((GtkWidget *)icd->dialog); bonobo_object_unref (BONOBO_OBJECT (icd->listener)); g_object_unref (icd->client); g_free (icd); @@ -287,11 +286,11 @@ importer_timeout_fn (gpointer data) } static void -dialog_clicked_cb (GnomeDialog *dialog, +dialog_response_cb (GtkDialog *dialog, int button_number, ImporterComponentData *icd) { - if (button_number != 0) + if (button_number != GTK_RESPONSE_CANCEL) return; /* Interesting... */ icd->stop = TRUE; @@ -325,12 +324,12 @@ free_iid_list (GList *list) } static const char * -get_name_from_component_info (const OAF_ServerInfo *info) +get_name_from_component_info (const Bonobo_ServerInfo *info) { - OAF_Property *property; + Bonobo_ActivationProperty *property; const char *name; - property = oaf_server_info_prop_find ((OAF_ServerInfo *) info, + property = bonobo_server_info_prop_find ((Bonobo_ServerInfo *) info, "evolution:menu-name"); if (property == NULL || property->v._d != Bonobo_ACTIVATION_P_STRING) return NULL; @@ -348,10 +347,10 @@ choose_importer_from_list (GList *importer_list) int ans; char *iid; - dialog = gnome_dialog_new (_("Select importer"), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); + dialog = gtk_dialog_new_with_buttons(_("Select importer"), NULL, GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); clist = gtk_clist_new (1); for (p = importer_list; p; p = p->next) { struct _IIDInfo *iid; @@ -364,13 +363,13 @@ choose_importer_from_list (GList *importer_list) gtk_clist_set_row_data (GTK_CLIST (clist), row, iid->iid); } - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), clist, - TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), clist, TRUE, TRUE, 0); gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE); gtk_widget_show (clist); - - switch (gnome_dialog_run (GNOME_DIALOG (dialog))) { - case 0: + + ans = gtk_dialog_run((GtkDialog *)dialog); + switch (ans) { + case GTK_RESPONSE_OK: ans = GPOINTER_TO_INT (GTK_CLIST (clist)->selection->data); iid = gtk_clist_get_row_data (GTK_CLIST (clist), ans); break; @@ -389,24 +388,24 @@ choose_importer_from_list (GList *importer_list) static char * get_iid_for_filetype (const char *filename) { - OAF_ServerInfoList *info_list; + Bonobo_ServerInfoList *info_list; CORBA_Environment ev; GList *can_handle = NULL; char *ret_iid; int i, len = 0; CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); + info_list = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); for (i = 0; i < info_list->_length; i++) { CORBA_Environment ev2; CORBA_Object importer; - const OAF_ServerInfo *info; + const Bonobo_ServerInfo *info; info = info_list->_buffer + i; CORBA_exception_init (&ev2); - importer = oaf_activate_from_id ((char *) info->iid, 0, NULL, &ev2); + importer = bonobo_activation_activate_from_id ((char *) info->iid, 0, NULL, &ev2); if (ev2._major != CORBA_NO_EXCEPTION) { g_warning ("Error activating %s", info->iid); CORBA_exception_free (&ev2); @@ -455,14 +454,20 @@ get_iid_for_filetype (const char *filename) } } +static void error_response_cb(GtkWidget *w, int button, void *data) +{ + gtk_widget_destroy(w); +} + static void show_error (const char *message, const char *title) { GtkWidget *box; - box = gnome_message_box_new (message, GNOME_MESSAGE_BOX_ERROR, GNOME_STOCK_BUTTON_OK, NULL); + box = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", message); gtk_window_set_title (GTK_WINDOW (box), title); + g_signal_connect(box, "response", G_CALLBACK(error_response_cb), box); gtk_widget_show (box); } @@ -506,21 +511,18 @@ start_import (const char *folderpath, icd = g_new (ImporterComponentData, 1); icd->stop = FALSE; - icd->dialog = GNOME_DIALOG (gnome_dialog_new (_("Importing"), - GNOME_STOCK_BUTTON_CANCEL, - NULL)); - g_signal_connect (icd->dialog, "clicked", - G_CALLBACK (dialog_clicked_cb), icd); + icd->dialog = GTK_DIALOG (gtk_dialog_new_with_buttons(_("Importing"), NULL, 0, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL)); + g_signal_connect (icd->dialog, "response", G_CALLBACK (dialog_response_cb), icd); - g_object_weak_ref (icd->dialog, dialog_destroy_notify, icd); + g_object_weak_ref (G_OBJECT(icd->dialog), dialog_destroy_notify, icd); label = g_strdup_printf (_("Importing %s.\nStarting %s"), filename, real_iid); icd->contents = gtk_label_new (label); g_free (label); - gtk_box_pack_start (GTK_BOX (icd->dialog->vbox), icd->contents, - TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (icd->dialog->vbox), icd->contents, TRUE, TRUE, 0); gtk_widget_show_all (GTK_WIDGET (icd->dialog)); while (gtk_events_pending ()) gtk_main_iteration (); @@ -579,7 +581,7 @@ filename_changed (GtkEntry *entry, ImportData *data) { ImportDialogFilePage *page; - char *filename; + const char *filename; page = data->filepage; @@ -590,7 +592,7 @@ filename_changed (GtkEntry *entry, page->need_filename = TRUE; gnome_druid_set_buttons_sensitive (GNOME_DRUID (data->druid), - TRUE, !page->need_filename, TRUE); + TRUE, !page->need_filename, TRUE, FALSE); } static void @@ -600,7 +602,7 @@ item_selected (GtkWidget *item, char *iid; g_free (data->choosen_iid); - iid = g_object_get_data (G_OBJECT (item), "oafiid"); + iid = g_object_get_data (G_OBJECT (item), "bonoboiid"); if (iid == NULL) data->choosen_iid = g_strdup ("Automatic"); else @@ -610,7 +612,7 @@ item_selected (GtkWidget *item, static GtkWidget * create_plugin_menu (ImportData *data) { - OAF_ServerInfoList *info_list; + Bonobo_ServerInfoList *info_list; CORBA_Environment ev; int i; GtkWidget *menu; @@ -618,13 +620,13 @@ create_plugin_menu (ImportData *data) menu = gtk_menu_new (); item = gtk_menu_item_new_with_label (_("Automatic")); - g_object_set_data_full (item, "oafiid", g_strdup ("Automatic"), g_free); + g_object_set_data_full ((GObject *)item, "bonoboiid", g_strdup ("Automatic"), g_free); gtk_menu_append (GTK_MENU (menu), item); CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); + info_list = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/Importer:1.0')", NULL, &ev); for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; + const Bonobo_ServerInfo *info; char *name = NULL; info = info_list->_buffer + i; @@ -640,7 +642,7 @@ create_plugin_menu (ImportData *data) g_signal_connect (item, "activate", G_CALLBACK (item_selected), data); - g_object_set_data (item, "oafiid", g_strdup (info->iid), g_free); + g_object_set_data_full ((GObject *)item, "bonoboiid", g_strdup (info->iid), g_free); gtk_menu_append (GTK_MENU (menu), item); } CORBA_free (info_list); @@ -738,17 +740,17 @@ importer_importer_page_new (ImportData *data) static GList * get_intelligent_importers (void) { - OAF_ServerInfoList *info_list; + Bonobo_ServerInfoList *info_list; GList *iids_ret = NULL; CORBA_Environment ev; int i; CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev); + info_list = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev); CORBA_exception_free (&ev); for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; + const Bonobo_ServerInfo *info; info = info_list->_buffer + i; iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid)); @@ -812,7 +814,7 @@ prepare_intelligent_page (GnomeDruid *druid, id->iid = g_strdup (l->data); CORBA_exception_init (&ev); - id->object = oaf_activate_from_id ((char *) id->iid, 0, NULL, &ev); + id->object = bonobo_activation_activate_from_id ((char *) id->iid, 0, NULL, &ev); if (BONOBO_EX (&ev)) { g_warning ("Could not start %s:%s", id->iid, CORBA_exception_id (&ev)); @@ -937,10 +939,10 @@ import_druid_cancel (GnomeDruid *druid, } static void -import_druid_weak_notify (void *data, +import_druid_weak_notify (void *blah, GObject *where_the_object_was) { - ImportData *data = (ImportData *) data; + ImportData *data = (ImportData *) blah; g_object_unref (data->wizard); g_free (data->choosen_iid); @@ -1074,7 +1076,7 @@ import_druid_finish (GnomeDruidPage *page, _("Select folder"), _("Select a destination folder for importing this data"), e_shell_view_get_current_uri (data->view), - NULL); + NULL, TRUE); g_signal_connect (folder, "folder_selected", G_CALLBACK (folder_selected), data); @@ -1093,7 +1095,7 @@ prepare_file_page (GnomeDruidPage *page, { gnome_druid_set_buttons_sensitive (druid, TRUE, !data->filepage->need_filename, - TRUE); + TRUE, FALSE); return FALSE; } @@ -1188,8 +1190,8 @@ druid_finish_button_change (GnomeDruid *druid) } static void -close_dialog (void *data, - GObject *where_the_dialog_was) +dialog_weak_notify (void *data, + GObject *where_the_dialog_was) { gboolean *dialog_open = (gboolean *) data; @@ -1213,20 +1215,19 @@ show_import_wizard (BonoboUIComponent *component, data->view = E_SHELL_VIEW (user_data); data->shell = e_shell_view_get_shell (data->view); - data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/import.glade", NULL); + data->wizard = glade_xml_new (EVOLUTION_GLADEDIR "/import.glade", NULL, NULL); data->dialog = glade_xml_get_widget (data->wizard, "importwizard"); gtk_window_set_wmclass (GTK_WINDOW (data->dialog), "importdruid", "Evolution:shell"); gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (user_data)); - g_object_weak_ref (data->dialog, dialog_weak_notify, &dialog_open); - gnome_dialog_close_hides (GNOME_DIALOG (data->dialog), TRUE); + g_object_weak_ref ((GObject *)data->dialog, dialog_weak_notify, &dialog_open); data->druid = glade_xml_get_widget (data->wizard, "druid1"); g_signal_connect (data->druid, "cancel", G_CALLBACK (import_druid_cancel), data); druid_finish_button_change (GNOME_DRUID (data->druid)); - data->start = GNOME_DRUID_PAGE_START (glade_xml_get_widget (data->wizard, "page0")); + data->start = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page0")); data->typedialog = glade_xml_get_widget (data->wizard, "page1"); g_signal_connect (data->typedialog, "next", @@ -1262,7 +1263,7 @@ show_import_wizard (BonoboUIComponent *component, g_signal_connect (data->filedialog, "back", G_CALLBACK (back_file_page), data); - data->finish = GNOME_DRUID_PAGE_FINISH (glade_xml_get_widget (data->wizard, "page3")); + data->finish = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page3")); g_signal_connect (data->finish, "back", G_CALLBACK (back_finish_page), data); @@ -1278,7 +1279,7 @@ show_import_wizard (BonoboUIComponent *component, g_signal_connect (data->finish, "finish", G_CALLBACK (import_druid_finish), data); - g_object_weak_ref (data->dialog, import_druid_weak_notify, data); + g_object_weak_ref ((GObject *)data->dialog, import_druid_weak_notify, data); gtk_widget_show_all (data->dialog); } diff --git a/shell/importer/evolution-importer-client.c b/shell/importer/evolution-importer-client.c index 0597b1127b..99e096a833 100644 --- a/shell/importer/evolution-importer-client.c +++ b/shell/importer/evolution-importer-client.c @@ -32,29 +32,29 @@ #include #include -#include - #include "GNOME_Evolution_Importer.h" -#define PARENT_TYPE gtk_object_get_type () -static GtkObjectClass *parent_class = NULL; +#define PARENT_TYPE G_TYPE_OBJECT +static GObjectClass *parent_class = NULL; static void -destroy (GtkObject *object) +finalise (GObject *object) { - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + /* FIXME: should this unref the client->objref?? */ + + parent_class->finalize(object); } static void class_init (EvolutionImporterClientClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (PARENT_TYPE); + object_class = G_OBJECT_CLASS (klass); + parent_class = g_type_class_ref(PARENT_TYPE); - object_class->destroy = destroy; + object_class->finalize = finalise; } static void @@ -77,7 +77,7 @@ evolution_importer_client_new (const CORBA_Object objref) g_return_val_if_fail (objref != CORBA_OBJECT_NIL, NULL); - client = gtk_type_new (evolution_importer_client_get_type ()); + client = g_object_new (evolution_importer_client_get_type (), NULL); client->objref = objref; return client; @@ -100,7 +100,7 @@ evolution_importer_client_new_from_id (const char *id) g_return_val_if_fail (id != NULL, NULL); CORBA_exception_init (&ev); - objref = oaf_activate_from_id ((char *) id, 0, NULL, &ev); + objref = bonobo_activation_activate_from_id ((char *) id, 0, NULL, &ev); if (ev._major != CORBA_NO_EXCEPTION) { CORBA_exception_free (&ev); g_warning ("Could not start %s.", id); diff --git a/shell/importer/evolution-importer-client.h b/shell/importer/evolution-importer-client.h index 9485c7307f..13d144e076 100644 --- a/shell/importer/evolution-importer-client.h +++ b/shell/importer/evolution-importer-client.h @@ -24,7 +24,6 @@ #define EVOLUTION_IMPORTER_CLIENT_H #include -#include #include #include @@ -34,26 +33,26 @@ extern "C" { #endif #define EVOLUTION_TYPE_IMPORTER_CLIENT (evolution_importer_client_get_type ()) -#define EVOLUTION_IMPORTER_CLIENT(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClient)) -#define EVOLUTION_IMPORTER_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClientClass)) -#define EVOLUTION_IS_IMPORTER_CLIENT(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT)) -#define EVOLUTION_IS_IMPORTER_CLIENT_CLASS(klass) (GTK_CHECK_TYPE ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT)) +#define EVOLUTION_IMPORTER_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClient)) +#define EVOLUTION_IMPORTER_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT, EvolutionImporterClientClass)) +#define EVOLUTION_IS_IMPORTER_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_CLIENT)) +#define EVOLUTION_IS_IMPORTER_CLIENT_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE ((klass), EVOLUTION_TYPE_IMPORTER_CLIENT)) typedef struct _EvolutionImporterClient EvolutionImporterClient; typedef struct _EvolutionImporterClientClass EvolutionImporterClientClass; struct _EvolutionImporterClient { - GtkObject parent_type; + GObject parent_type; GNOME_Evolution_Importer objref; }; struct _EvolutionImporterClientClass { - GtkObjectClass parent_class; + GObjectClass parent_class; }; -GtkType evolution_importer_client_get_type (void); +GType evolution_importer_client_get_type (void); EvolutionImporterClient *evolution_importer_client_new (const CORBA_Object objref); EvolutionImporterClient *evolution_importer_client_new_from_id (const char *id); diff --git a/shell/importer/evolution-importer-listener.c b/shell/importer/evolution-importer-listener.c index f67b963cbb..84bcfe3b7e 100644 --- a/shell/importer/evolution-importer-listener.c +++ b/shell/importer/evolution-importer-listener.c @@ -118,9 +118,9 @@ impl_GNOME_Evolution_ImporterListener_notifyResult (PortableServer_Servant serva } -/* GtkObject methods */ +/* GObject methods */ static void -destroy (GtkObject *object) +finalise (GObject *object) { EvolutionImporterListener *listener; EvolutionImporterListenerPrivate *priv; @@ -134,7 +134,7 @@ destroy (GtkObject *object) g_free (priv); listener->priv = NULL; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->finalize(object); } #if 0 @@ -163,13 +163,13 @@ corba_class_init (void) static void evolution_importer_listener_class_init (EvolutionImporterListenerClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; POA_GNOME_Evolution_ImporterListener__epv *epv = &klass->epv; - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; + object_class = G_OBJECT_CLASS (klass); + object_class->finalize = finalise; - parent_class = gtk_type_class (PARENT_TYPE); + parent_class = g_type_class_ref(PARENT_TYPE); epv->notifyResult = impl_GNOME_Evolution_ImporterListener_notifyResult; } @@ -213,7 +213,7 @@ evolution_importer_listener_new (EvolutionImporterListenerCallback callback, { EvolutionImporterListener *listener; - listener = gtk_type_new (evolution_importer_listener_get_type ()); + listener = g_object_new (evolution_importer_listener_get_type (), NULL); evolution_importer_listener_construct (listener, callback, closure); return listener; diff --git a/shell/importer/evolution-importer-listener.h b/shell/importer/evolution-importer-listener.h index 2c9c28422c..bbdf750140 100644 --- a/shell/importer/evolution-importer-listener.h +++ b/shell/importer/evolution-importer-listener.h @@ -34,10 +34,10 @@ extern "C" { #endif /* cplusplus */ #define EVOLUTION_TYPE_IMPORTER_LISTENER (evolution_importer_listener_get_type ()) -#define EVOLUTION_IMPORTER_LISTENER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListener)) -#define EVOLUTION_IMPORTER_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListenerClass)) -#define EVOLUTION_IS_IMPORTER_LISTENER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) -#define EVOLUTION_IS_IMPORTER_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) +#define EVOLUTION_IMPORTER_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListener)) +#define EVOLUTION_IMPORTER_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER_LISTENER, EvolutionImporterListenerClass)) +#define EVOLUTION_IS_IMPORTER_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) +#define EVOLUTION_IS_IMPORTER_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER_LISTENER)) typedef struct _EvolutionImporterListener EvolutionImporterListener; typedef struct _EvolutionImporterListenerPrivate EvolutionImporterListenerPrivate; @@ -59,7 +59,7 @@ struct _EvolutionImporterListenerClass { POA_GNOME_Evolution_ImporterListener__epv epv; }; -GtkType evolution_importer_listener_get_type (void); +GType evolution_importer_listener_get_type (void); EvolutionImporterListener *evolution_importer_listener_new (EvolutionImporterListenerCallback callback, void *closure); diff --git a/shell/importer/evolution-importer.c b/shell/importer/evolution-importer.c index 8ae67a3e22..3b5603d2e1 100644 --- a/shell/importer/evolution-importer.c +++ b/shell/importer/evolution-importer.c @@ -125,7 +125,7 @@ impl_GNOME_Evolution_Importer_getError (PortableServer_Servant servant, static void -destroy (GtkObject *object) +finalise (GObject *object) { EvolutionImporter *importer; EvolutionImporterPrivate *priv; @@ -139,19 +139,19 @@ destroy (GtkObject *object) g_free (priv); importer->priv = NULL; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void evolution_importer_class_init (EvolutionImporterClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; POA_GNOME_Evolution_Importer__epv *epv = &klass->epv; - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; + object_class = G_OBJECT_CLASS (klass); + object_class->finalize = finalise; - parent_class = gtk_type_class (PARENT_TYPE); + parent_class = g_type_class_ref(PARENT_TYPE); epv->supportFormat = impl_GNOME_Evolution_Importer_supportFormat; epv->loadFile = impl_GNOME_Evolution_Importer_loadFile; epv->processItem = impl_GNOME_Evolution_Importer_processItem; @@ -217,7 +217,7 @@ evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, { EvolutionImporter *importer; - importer = gtk_type_new (evolution_importer_get_type ()); + importer = g_object_new(evolution_importer_get_type (), NULL); evolution_importer_construct (importer, support_format_fn, load_file_fn, process_item_fn, get_error_fn, closure); return importer; diff --git a/shell/importer/evolution-importer.h b/shell/importer/evolution-importer.h index eea1eb6078..b4322d091e 100644 --- a/shell/importer/evolution-importer.h +++ b/shell/importer/evolution-importer.h @@ -33,10 +33,10 @@ extern "C" { #endif /* cplusplus */ #define EVOLUTION_TYPE_IMPORTER (evolution_importer_get_type ()) -#define EVOLUTION_IMPORTER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_IMPORTER, EvolutionImporter)) -#define EVOLUTION_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER, EvolutionImporterClass)) -#define EVOLUTION_IS_IMPORTER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) -#define EVOLUTION_IS_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) +#define EVOLUTION_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_IMPORTER, EvolutionImporter)) +#define EVOLUTION_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_IMPORTER, EvolutionImporterClass)) +#define EVOLUTION_IS_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) +#define EVOLUTION_IS_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_IMPORTER)) typedef struct _EvolutionImporter EvolutionImporter; typedef struct _EvolutionImporterPrivate EvolutionImporterPrivate; @@ -80,7 +80,7 @@ struct _EvolutionImporterClass { POA_GNOME_Evolution_Importer__epv epv; }; -GtkType evolution_importer_get_type (void); +GType evolution_importer_get_type (void); EvolutionImporter *evolution_importer_new (EvolutionImporterSupportFormatFn support_format_fn, EvolutionImporterLoadFileFn load_file_fn, diff --git a/shell/importer/evolution-intelligent-importer.c b/shell/importer/evolution-intelligent-importer.c index 436b019c60..79450a8458 100644 --- a/shell/importer/evolution-intelligent-importer.c +++ b/shell/importer/evolution-intelligent-importer.c @@ -105,7 +105,7 @@ impl_GNOME_Evolution_IntelligentImporter_importData (PortableServer_Servant serv static void -destroy (GtkObject *object) +finalise (GObject *object) { EvolutionIntelligentImporter *ii; @@ -118,19 +118,19 @@ destroy (GtkObject *object) g_free (ii->priv); ii->priv = NULL; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void evolution_intelligent_importer_class_init (EvolutionIntelligentImporterClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; POA_GNOME_Evolution_IntelligentImporter__epv *epv = &klass->epv; - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = destroy; + object_class = G_OBJECT_CLASS (klass); + object_class->finalize = finalise; - parent_class = gtk_type_class (PARENT_TYPE); + parent_class = g_type_class_ref(PARENT_TYPE); epv->_get_importername = impl_GNOME_Evolution_IntelligentImporter__get_importername; epv->_get_message = impl_GNOME_Evolution_IntelligentImporter__get_message; epv->canImport = impl_GNOME_Evolution_IntelligentImporter_canImport; @@ -184,7 +184,7 @@ evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_ { EvolutionIntelligentImporter *ii; - ii = gtk_type_new (evolution_intelligent_importer_get_type ()); + ii = g_object_new (evolution_intelligent_importer_get_type (), NULL); evolution_intelligent_importer_construct (ii, can_import_fn, import_data_fn, importername, message, closure); diff --git a/shell/importer/evolution-intelligent-importer.h b/shell/importer/evolution-intelligent-importer.h index 27aa35fd41..814bb9ad24 100644 --- a/shell/importer/evolution-intelligent-importer.h +++ b/shell/importer/evolution-intelligent-importer.h @@ -33,10 +33,10 @@ extern "C" { #endif /* __cplusplus */ #define EVOLUTION_TYPE_INTELLIGENT_IMPORTER (evolution_intelligent_importer_get_type ()) -#define EVOLUTION_INTELLIGENT_IMPORTER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporter)) -#define EVOLUTION_INTELLIGENT_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporterClass)) -#define EVOLUTION_IS_INTELLIGENT_IMPORTER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) -#define EVOLUTION_IS_INTELLIGENT_IMPORTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) +#define EVOLUTION_INTELLIGENT_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporter)) +#define EVOLUTION_INTELLIGENT_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_INTELLIGENT_IMPORTER, EvolutionIntelligentImporterClass)) +#define EVOLUTION_IS_INTELLIGENT_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) +#define EVOLUTION_IS_INTELLIGENT_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_INTELLIGENT_IMPORTER)) typedef struct _EvolutionIntelligentImporter EvolutionIntelligentImporter; typedef struct _EvolutionIntelligentImporterPrivate EvolutionIntelligentImporterPrivate; @@ -59,7 +59,7 @@ struct _EvolutionIntelligentImporterClass { POA_GNOME_Evolution_IntelligentImporter__epv epv; }; -GtkType evolution_intelligent_importer_get_type (void); +GType evolution_intelligent_importer_get_type (void); EvolutionIntelligentImporter *evolution_intelligent_importer_new (EvolutionIntelligentImporterCanImportFn can_import_fn, EvolutionIntelligentImporterImportDataFn import_data_fn, diff --git a/shell/importer/intelligent.c b/shell/importer/intelligent.c index 44b0be9398..1eee3c238e 100644 --- a/shell/importer/intelligent.c +++ b/shell/importer/intelligent.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -43,15 +44,12 @@ #include #include #include +#include +#include -#include #include +/*#include */ #include -#include -#include -#include - -#include #include #include @@ -138,17 +136,17 @@ start_importers (GList *selected) static GList * get_intelligent_importers (void) { - OAF_ServerInfoList *info_list; + Bonobo_ServerInfoList *info_list; GList *iids_ret = NULL; CORBA_Environment ev; int i; CORBA_exception_init (&ev); - info_list = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev); + info_list = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/IntelligentImporter:1.0')", NULL, &ev); CORBA_exception_free (&ev); for (i = 0; i < info_list->_length; i++) { - const OAF_ServerInfo *info; + const Bonobo_ServerInfo *info; info = info_list->_buffer + i; iids_ret = g_list_prepend (iids_ret, g_strdup (info->iid)); @@ -187,18 +185,19 @@ create_gui (GList *importers) int running = 0; d = g_new (IntelligentImporterDialog, 1); - d->dialog = dialog = gnome_dialog_new (_("Importers"), - NULL); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), - _("Import"), - GNOME_STOCK_PIXMAP_CONVERT); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), - _("Don't import"), - GNOME_STOCK_BUTTON_NO); - gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (dialog), _("Don't ask me again"), - GNOME_STOCK_BUTTON_CANCEL); - - gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE); + d->dialog = dialog = gtk_dialog_new(); + gtk_window_set_title((GtkWindow *)dialog, _("Importers")); + dummy = gtk_button_new_from_stock(GTK_STOCK_CONVERT); + gtk_button_set_label((GtkButton *)dummy, _("Import")); + gtk_dialog_add_action_widget((GtkDialog *)dialog, dummy, GTK_RESPONSE_ACCEPT); + + dummy = gtk_button_new_from_stock(GTK_STOCK_NO); + gtk_button_set_label((GtkButton *)dummy, _("Don't import")); + gtk_dialog_add_action_widget((GtkDialog *)dialog, dummy, GTK_RESPONSE_REJECT); + + dummy = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + gtk_button_set_label((GtkButton *)dummy, _("Don't ask me again")); + gtk_dialog_add_action_widget((GtkDialog *)dialog, dummy, GTK_RESPONSE_CANCEL); d->importers = NULL; d->current = NULL; @@ -207,20 +206,20 @@ create_gui (GList *importers) label = gtk_label_new (_("Evolution can import data from the following files:")); gtk_misc_set_alignment(GTK_MISC(label), 0, .5); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0); hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 2); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_usize (sw, 300, 150); + gtk_widget_set_size_request (sw, 300, 150); gtk_container_add (GTK_CONTAINER (sw), clist); gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0); @@ -239,7 +238,7 @@ create_gui (GList *importers) char *text[1], *prefix; /* Check if we want to show this one again */ - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", gnome_util_user_home ()); + prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", g_get_home_dir ()); gnome_config_push_prefix (prefix); g_free (prefix); @@ -253,7 +252,7 @@ create_gui (GList *importers) data->iid = g_strdup (l->data); CORBA_exception_init (&ev); - data->object = oaf_activate_from_id ((char *) data->iid, 0, + data->object = bonobo_activation_activate_from_id ((char *) data->iid, 0, NULL, &ev); if (ev._major != CORBA_NO_EXCEPTION) { g_warning ("Could not start %s: %s", data->iid, @@ -361,12 +360,12 @@ create_gui (GList *importers) /* Set the start to the blank page */ gtk_notebook_set_page (GTK_NOTEBOOK (d->placeholder), running); - gtk_signal_connect (GTK_OBJECT (clist), "select-row", - GTK_SIGNAL_FUNC (select_row_cb), d); - gtk_signal_connect (GTK_OBJECT (clist), "unselect-row", - GTK_SIGNAL_FUNC (unselect_row_cb), d); + g_signal_connect((clist), "select-row", + G_CALLBACK (select_row_cb), d); + g_signal_connect((clist), "unselect-row", + G_CALLBACK (unselect_row_cb), d); - gtk_widget_show_all (GNOME_DIALOG (dialog)->vbox); + gtk_widget_show_all (GTK_DIALOG (dialog)->vbox); return d; } @@ -377,8 +376,9 @@ intelligent_importer_init (void) IntelligentImporterDialog *d; char *prefix; gboolean dontaskagain; + int resp; - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", gnome_util_user_home ()); + prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", g_get_home_dir()); gnome_config_push_prefix (prefix); g_free (prefix); @@ -399,8 +399,10 @@ intelligent_importer_init (void) return; /* No runnable intelligent importers. */ } - switch (gnome_dialog_run_and_close (GNOME_DIALOG (d->dialog))) { - case 0: /* Okay button */ + resp = gtk_dialog_run((GtkDialog *)d->dialog); + gtk_widget_destroy(d->dialog); + switch (resp) { + case GTK_RESPONSE_ACCEPT: /* Make a list of the importers */ /* FIXME: Sort this list and don't do it a slow way */ @@ -458,13 +460,8 @@ intelligent_importer_init (void) break; - case 1: /* No button */ - free_importer_dialog (d); - break; - - case 2: /* Dont ask again */ - prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", - gnome_util_user_home ()); + case GTK_RESPONSE_CANCEL: /* Dont ask again */ + prefix = g_strdup_printf ("=%s/evolution/config/Shell=/intelligent-importers/", g_get_home_dir()); gnome_config_push_prefix (prefix); g_free (prefix); @@ -478,6 +475,7 @@ intelligent_importer_init (void) break; default: + case GTK_RESPONSE_REJECT: /* No button */ free_importer_dialog (d); break; } -- cgit v1.2.3