Ported.
2002-11-11 Jeffrey Stedfast <fejj@ximian.com> * mail-account-editor.c: Ported. svn path=/trunk/; revision=18700
This commit is contained in:
committed by
Jeffrey Stedfast
parent
eefc354fcc
commit
ba61233a0c
@ -1,5 +1,7 @@
|
||||
2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-account-editor.c: Ported.
|
||||
|
||||
* folder-browser-ui.c: Ported.
|
||||
|
||||
* folder-browser-factory.c: Ported.
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
#include "Mailer.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <libgnome/gnome-defs.h>
|
||||
|
||||
#include <bonobo/bonobo-xobject.h>
|
||||
#include <bonobo/bonobo-generic-factory.h>
|
||||
@ -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),
|
||||
|
||||
@ -32,16 +32,15 @@
|
||||
#include <libgnomeui/gnome-messagebox.h>
|
||||
#include <libgnomeui/gnome-stock.h>
|
||||
#include <camel/camel-url.h>
|
||||
#include <gal/widgets/e-unicode.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 (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;
|
||||
MailAccountEditor *editor = user_data;
|
||||
|
||||
apply_changes (editor);
|
||||
}
|
||||
|
||||
static void
|
||||
ok_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
MailAccountEditor *editor = data;
|
||||
|
||||
if (apply_changes (editor))
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
@ -28,9 +28,9 @@ extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <gtk/gtkwindow.h>
|
||||
#include <libgnomeui/gnome-dialog.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libgnomeui/gnome-file-entry.h>
|
||||
|
||||
#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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user