From ba61233a0c4f67e607c8ca5f545b135bdf57f88e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 11 Nov 2002 18:53:56 +0000 Subject: Ported. 2002-11-11 Jeffrey Stedfast * mail-account-editor.c: Ported. svn path=/trunk/; revision=18700 --- mail/ChangeLog | 2 ++ mail/folder-info.c | 39 +++++++++++----------- mail/mail-account-editor.c | 81 ++++++++++++++++++---------------------------- mail/mail-account-editor.h | 8 ++--- 4 files changed, 56 insertions(+), 74 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 5fa615e530..99738063b0 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,7 @@ 2002-11-11 Jeffrey Stedfast + * mail-account-editor.c: Ported. + * folder-browser-ui.c: Ported. * folder-browser-factory.c: Ported. diff --git a/mail/folder-info.c b/mail/folder-info.c index e9db9a22fc..eca156d1f0 100644 --- a/mail/folder-info.c +++ b/mail/folder-info.c @@ -15,7 +15,6 @@ #include "Mailer.h" #include -#include #include #include @@ -76,7 +75,7 @@ do_get_info (struct _mail_msg *mm) { struct _folder_info_msg *m = (struct _folder_info_msg *) mm; CamelFolder *folder; - + folder = mail_tool_uri_to_folder (m->foldername, 0, NULL); if (folder) { m->read = camel_folder_get_message_count (folder); @@ -91,16 +90,16 @@ do_got_info (struct _mail_msg *mm) CORBA_Environment ev; CORBA_any a; GNOME_Evolution_FolderInfo_MessageCount count; - + /* g_print ("You've got mail: %d, %d\n", m->read, m->unread); */ - + count.path = m->foldername; count.count = m->read; count.unread = m->unread; - + a._type = (CORBA_TypeCode) TC_GNOME_Evolution_FolderInfo_MessageCount; a._value = &count; - + CORBA_exception_init (&ev); Bonobo_Listener_event (m->listener, "youve-got-mail", &a, &ev); if (BONOBO_EX (&ev)) { @@ -113,7 +112,7 @@ static void do_free_info (struct _mail_msg *mm) { struct _folder_info_msg *m = (struct _folder_info_msg *) mm; - + bonobo_object_release_unref (m->listener, NULL); g_free (m->foldername); } @@ -137,16 +136,16 @@ mail_get_info (const char *foldername, { CORBA_Environment ev; struct _folder_info_msg *m; - + m = mail_msg_new (&get_info_op, NULL, sizeof (*m)); - + /* g_print ("Folder: %s", foldername); */ m->foldername = g_strdup (foldername); - + CORBA_exception_init (&ev); m->listener = bonobo_object_dup_ref (listener, &ev); CORBA_exception_free (&ev); - + e_thread_put (mail_thread_new, (EMsg *) m); } @@ -164,7 +163,7 @@ static void destroy (GtkObject *object) { EvolutionFolderInfo *info = (EvolutionFolderInfo *) object; - + bonobo_object_unref (BONOBO_OBJECT (info->pb)); } #endif @@ -173,7 +172,7 @@ static void evolution_folder_info_class_init (EvolutionFolderInfoClass *klass) { POA_GNOME_Evolution_FolderInfo__epv *epv = &klass->epv; - + parent_class = gtk_type_class (PARENT_TYPE); epv->getInfo = impl_GNOME_Evolution_FolderInfo_getInfo; } @@ -203,7 +202,6 @@ set_prop (BonoboPropertyBag *bag, case PROP_FOLDER_INFO_READY: ready = BONOBO_ARG_GET_BOOLEAN (arg); break; - default: bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound); break; @@ -221,7 +219,6 @@ get_prop (BonoboPropertyBag *bag, case PROP_FOLDER_INFO_READY: BONOBO_ARG_SET_BOOLEAN (arg, ready); break; - default: bonobo_exception_set (ev, ex_Bonobo_PropertyBag_NotFound); break; @@ -246,7 +243,7 @@ evolution_folder_info_factory_fn (BonoboGenericFactory *factory, BONOBO_PROPERTY_WRITEABLE); bonobo_object_add_interface (BONOBO_OBJECT (info), BONOBO_OBJECT (pb)); - + /* Add to the folder info list so we can get at them all afterwards */ folder_infos = g_slist_append (folder_infos, info); @@ -257,19 +254,19 @@ gboolean evolution_folder_info_factory_init (void) { BonoboGenericFactory *factory; - + folder_infos = NULL; ready = FALSE; factory = bonobo_generic_factory_new (FOLDER_INFO_IID, evolution_folder_info_factory_fn, NULL); - + if (factory == NULL) { g_warning ("Error starting FolderInfo"); return FALSE; } - + bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); return TRUE; } @@ -278,14 +275,14 @@ void evolution_folder_info_notify_ready (void) { GSList *p; - + ready = TRUE; for (p = folder_infos; p; p = p->next) { BonoboArg arg; CORBA_boolean b = ready; EvolutionFolderInfo *info = p->data; - + arg._value = &b; arg._type = (CORBA_TypeCode) TC_boolean; bonobo_property_bag_set_value (BONOBO_PROPERTY_BAG (info->pb), diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index 01f4494f0e..69de0a66d4 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -32,16 +32,15 @@ #include #include #include -#include #include #include "mail-account-editor.h" #include "mail-session.h" static void mail_account_editor_class_init (MailAccountEditorClass *class); -static void mail_account_editor_finalize (GtkObject *obj); +static void mail_account_editor_finalize (GObject *obj); -static GnomeDialogClass *parent_class; +static GtkDialogClass *parent_class = NULL; GtkType @@ -56,34 +55,35 @@ mail_account_editor_get_type () sizeof (MailAccountEditorClass), (GtkClassInitFunc) mail_account_editor_class_init, (GtkObjectInitFunc) NULL, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, }; - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); + type = gtk_type_unique (gtk_dialog_get_type (), &type_info); } return type; } static void -mail_account_editor_class_init (MailAccountEditorClass *class) +mail_account_editor_class_init (MailAccountEditorClass *klass) { - GtkObjectClass *object_class; + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gnome_dialog_get_type ()); + parent_class = gtk_type_class (gtk_dialog_get_type ()); - object_class->finalize = mail_account_editor_finalize; + gobject_class->finalize = mail_account_editor_finalize; } static void -mail_account_editor_finalize (GtkObject *obj) +mail_account_editor_finalize (GObject *obj) { MailAccountEditor *editor = (MailAccountEditor *) obj; mail_account_gui_destroy (editor->gui); - ((GtkObjectClass *)(parent_class))->finalize (obj); + + G_OBJECT_CLASS (parent_class)->finalize (obj); } static gboolean @@ -120,28 +120,19 @@ apply_changes (MailAccountEditor *editor) } static void -apply_clicked (GtkWidget *widget, gpointer data) +editor_response_cb (GtkWidget *widget, int button, gpointr user_data) { - MailAccountEditor *editor = data; - - apply_changes (editor); -} - -static void -ok_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditor *editor = data; - - if (apply_changes (editor)) + MailAccountEditor *editor = user_data; + + switch (button) { + case GTK_RESPONSE_APPLY: + apply_changes (editor); + return; + case GTK_RESPONSE_OK: + apply_changes (editor); + default: gtk_widget_destroy (GTK_WIDGET (editor)); -} - -static void -cancel_clicked (GtkWidget *widget, gpointer data) -{ - MailAccountEditor *editor = data; - - gtk_widget_destroy (GTK_WIDGET (editor)); + } } static void @@ -159,21 +150,13 @@ construct (MailAccountEditor *editor, MailConfigAccount *account, MailAccountsTa gtk_window_set_title (GTK_WINDOW (editor), _("Evolution Account Editor")); gtk_window_set_policy (GTK_WINDOW (editor), FALSE, TRUE, TRUE); gtk_window_set_modal (GTK_WINDOW (editor), FALSE); - gnome_dialog_append_buttons (GNOME_DIALOG (editor), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_APPLY, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gnome_dialog_button_connect (GNOME_DIALOG (editor), 0 /* OK */, - GTK_SIGNAL_FUNC (ok_clicked), - editor); - gnome_dialog_button_connect (GNOME_DIALOG (editor), 1 /* APPLY */, - GTK_SIGNAL_FUNC (apply_clicked), - editor); - gnome_dialog_button_connect (GNOME_DIALOG (editor), 2 /* CANCEL */, - GTK_SIGNAL_FUNC (cancel_clicked), - editor); + gtk_dialog_add_buttons (GTK_DIALOG (editor), + GTK_STOCK_OK, GTK_RESPONSE_OK, + GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL); + + g_signal_connect (editor, "response", GTK_SIGNAL_FUNC (editor_response_cb), editor); mail_account_gui_setup (editor->gui, GTK_WIDGET (editor)); @@ -188,7 +171,7 @@ mail_account_editor_new (MailConfigAccount *account, GtkWindow *parent, MailAcco MailAccountEditor *new; new = (MailAccountEditor *) gtk_type_new (mail_account_editor_get_type ()); - gnome_dialog_set_parent (GNOME_DIALOG (new), parent); + gtk_widget_set_parent_window ((GtkWidget *) new, parent->window); construct (new, account, dialog); return new; diff --git a/mail/mail-account-editor.h b/mail/mail-account-editor.h index 84b183b65d..ce550f1fde 100644 --- a/mail/mail-account-editor.h +++ b/mail/mail-account-editor.h @@ -28,9 +28,9 @@ extern "C" { #pragma } #endif /* __cplusplus */ -#include -#include +#include #include + #include "mail-account-gui.h" #include "mail-accounts.h" @@ -41,7 +41,7 @@ extern "C" { #define MAIL_IS_ACCOUNT_EDITOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_ACCOUNT_EDITOR_TYPE)) struct _MailAccountEditor { - GnomeDialog parent; + GtkDialog parent_object; MailAccountGui *gui; GtkNotebook *notebook; @@ -50,7 +50,7 @@ struct _MailAccountEditor { typedef struct _MailAccountEditor MailAccountEditor; typedef struct { - GnomeDialogClass parent_class; + GtkDialogClass parent_class; /* signals */ -- cgit