
2002-11-13 Not Zed <NotZed@Ximian.com> * GNOME_Evolution_Mail.server.in.in: Added to cvs. Currently contains no configurable stuff, but maybe it will one day. * Makefile.am (server_DATA): change oaf stuff to server stuff for bonobo activation. * mail-preferences.c (mail_preferences_apply): handle const entry text. * mail-composer-prefs.c (url_requested): Fixed typo. (mail_composer_prefs_construct): gnomepixmap->gtkimage. * mail-callbacks.c (configure_mail): destroy dialogue before dealing with response. (mail_generate_reply): Fix a typo. (popup_listener_cb): fix prototype. (tag_editor_response): Handle gtk dialog response. (flag_for_followup): Change gnome dialog to gtk dialog stuff. (tag_editor_destroy_cb): (tag_editor_cancel): (tag_editor_ok): Removed, handled in _response(). (filter_editor_response): renamed from _clicked, handle gtk dialogue signal. (filter_editor_destroy): Removed. (footer_info_new): gnome font api changes. (do_mail_print): port to gnome print 2. * mail-autofilter.c (mail_filter_delete_uri): message_dialog uses a specific button enum, not the stock ones. * mail-accounts.c (mail_accounts_tab_get_type): gobjectify. (account_delete_clicked): gdkdialogise. * mail-account-gui.c (mail_account_gui_setup): Hack around font metric determination code. * mail-account-editor.c (mail_account_editor_get_type): gobjectise. (mail_account_editor_new): "" * folder-info.c (evolution_folder_info_notify_ready): use pbclient interface. * folder-browser-factory.c (control_destroy_cb): fix a typo. (folder_browser_factory_new_control): More typos. * folder-browser.c (on_right_click): cast around const warning. (context_menu_position_func): fix for api change. * e-searching-tokenizer.c (e_searching_tokenizer_finalise): Changed from destroy since it only frees memory. (e_searching_tokenizer_get_type): glibify. * component-factory.c (request_quit): gtkdialogise. (send_receive_cb): " (create_component): gdk_pixbuf api. (component_factory_init): bonobo activation stuff. (warning_response): renamed from warning_clicked. (owner_set_cb): gtkdialogise. svn path=/trunk/; revision=18731
176 lines
4.9 KiB
C
176 lines
4.9 KiB
C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
|
/*
|
|
* Authors:
|
|
* Jeffrey Stedfast <fejj@ximian.com>
|
|
* Dan Winship <danw@ximian.com>
|
|
*
|
|
* Copyright 2001 Ximian, Inc. (www.ximian.com)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of version 2 of the GNU General Public
|
|
* License as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public
|
|
* License along with this program; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <camel/camel-url.h>
|
|
#include <gal/widgets/e-gui-utils.h>
|
|
|
|
#include "mail-account-editor.h"
|
|
#include "mail-session.h"
|
|
|
|
static void mail_account_editor_class_init (MailAccountEditorClass *class);
|
|
static void mail_account_editor_finalize (GObject *obj);
|
|
|
|
static GtkDialogClass *parent_class = NULL;
|
|
|
|
|
|
GType
|
|
mail_account_editor_get_type ()
|
|
{
|
|
static GtkType type = 0;
|
|
|
|
if (!type) {
|
|
GTypeInfo type_info = {
|
|
sizeof (MailAccountEditorClass),
|
|
NULL, NULL,
|
|
(GClassInitFunc) mail_account_editor_class_init,
|
|
NULL, NULL,
|
|
sizeof (MailAccountEditor),
|
|
0,
|
|
NULL
|
|
};
|
|
|
|
type = g_type_register_static (gtk_dialog_get_type (), "MailAccountEditor", &type_info, 0);
|
|
}
|
|
|
|
return type;
|
|
}
|
|
|
|
static void
|
|
mail_account_editor_class_init (MailAccountEditorClass *klass)
|
|
{
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
parent_class = g_type_class_ref(gtk_dialog_get_type ());
|
|
|
|
gobject_class->finalize = mail_account_editor_finalize;
|
|
}
|
|
|
|
static void
|
|
mail_account_editor_finalize (GObject *obj)
|
|
{
|
|
MailAccountEditor *editor = (MailAccountEditor *) obj;
|
|
|
|
mail_account_gui_destroy (editor->gui);
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
|
}
|
|
|
|
static gboolean
|
|
apply_changes (MailAccountEditor *editor)
|
|
{
|
|
GtkWidget *incomplete;
|
|
int page = -1;
|
|
|
|
if (!mail_account_gui_identity_complete (editor->gui, &incomplete) ||
|
|
!mail_account_gui_management_complete (editor->gui, &incomplete))
|
|
page = 0;
|
|
else if (!mail_account_gui_source_complete (editor->gui, &incomplete))
|
|
page = 1;
|
|
else if (!mail_account_gui_transport_complete (editor->gui, &incomplete))
|
|
page = 3;
|
|
|
|
if (page != -1) {
|
|
gtk_notebook_set_page (editor->notebook, page);
|
|
gtk_widget_grab_focus (incomplete);
|
|
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("You have not filled in all of the required information."));
|
|
return FALSE;
|
|
}
|
|
|
|
if (mail_account_gui_save (editor->gui) == FALSE)
|
|
return FALSE;
|
|
|
|
/* save any changes we may have */
|
|
mail_config_write ();
|
|
|
|
/* FIXME: #1549: if the account was a remote store, delete it from the folder-tree and re-add it */
|
|
/* FIXME: preferably, we'd only do this if there were changes... oh well */
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
static void
|
|
editor_response_cb (GtkWidget *widget, int button, gpointer user_data)
|
|
{
|
|
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
|
|
construct (MailAccountEditor *editor, MailConfigAccount *account, MailAccountsTab *dialog)
|
|
{
|
|
MailConfigService *source = account->source;
|
|
|
|
editor->gui = mail_account_gui_new (account, dialog);
|
|
|
|
/* get our toplevel widget and reparent it */
|
|
editor->notebook = GTK_NOTEBOOK (glade_xml_get_widget (editor->gui->xml, "account_editor_notebook"));
|
|
gtk_widget_reparent (GTK_WIDGET (editor->notebook), GNOME_DIALOG (editor)->vbox);
|
|
|
|
/* give our dialog an OK button and title */
|
|
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);
|
|
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", G_CALLBACK (editor_response_cb), editor);
|
|
|
|
mail_account_gui_setup (editor->gui, GTK_WIDGET (editor));
|
|
|
|
mail_account_gui_build_extra_conf (editor->gui, source->url);
|
|
|
|
gtk_widget_grab_focus (GTK_WIDGET (editor->gui->account_name));
|
|
}
|
|
|
|
MailAccountEditor *
|
|
mail_account_editor_new (MailConfigAccount *account, GtkWindow *parent, MailAccountsTab *dialog)
|
|
{
|
|
MailAccountEditor *new;
|
|
|
|
new = (MailAccountEditor *) g_object_new(mail_account_editor_get_type (), NULL);
|
|
gtk_widget_set_parent_window ((GtkWidget *) new, ((GtkWidget *)parent)->window);
|
|
construct (new, account, dialog);
|
|
|
|
return new;
|
|
}
|