diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/Makefile.am | 5 | ||||
-rw-r--r-- | shell/e-folder-mail.c | 50 | ||||
-rw-r--r-- | shell/e-folder-mail.h | 28 | ||||
-rw-r--r-- | shell/e-folder.c | 204 | ||||
-rw-r--r-- | shell/e-folder.h | 74 | ||||
-rw-r--r-- | shell/e-shell.c | 3 | ||||
-rw-r--r-- | shell/e-shell.h | 5 |
7 files changed, 361 insertions, 8 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am index ad231b6352..03848c6110 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -11,6 +11,10 @@ INCLUDES = \ evolution_SOURCES = \ main.c \ + e-folder.c \ + e-folder.h \ + e-folder-mail.c \ + e-folder-mail.h \ e-init.c \ e-init.h \ e-shell.c \ @@ -22,4 +26,3 @@ evolution_LDADD = \ ../e-util/libeutil.a \ $(BONOBO_GNOME_LIBS) - diff --git a/shell/e-folder-mail.c b/shell/e-folder-mail.c new file mode 100644 index 0000000000..72010194c5 --- /dev/null +++ b/shell/e-folder-mail.c @@ -0,0 +1,50 @@ +/* + * e-folder-mail.c: Mail folder + * + * Author: + * Miguel de Icaza (miguel@helixcode.com) + * + * (C) 2000 Helix Code, Inc. + */ +#include <config.h> +#include <glib.h> +#include <libgnome/gnome-defs.h> +#include <libgnome/gnome-i18n.h> +#include "e-util/e-util.h" +#include "e-folder-mail.h" + +#define PARENT_TYPE e_folder_get_type () + +static const char * +efm_get_type_name (EFolder *efolder) +{ + return _("Folder containing Mail Items"); +} + +static void +e_folder_mail_class_init (GtkObjectClass *object_class) +{ + EFolderClass *efc = (EFolderClass *) object_class; + + efc->get_type_name = efm_get_type_name; +} + +static void +e_folder_mail_init (GtkObject *object) +{ +} + +E_MAKE_TYPE (e_folder_mail, "EFolderMail", EFolderMail, e_folder_mail_class_init, e_folder_mail_init, PARENT_TYPE) + +EFolder * +e_folder_mail_new (const char *uri, const char *name, const char *desc, + const char *home_page, const char *view_name) +{ + EFolderMail *efm = gtk_type_new (e_folder_mail_get_type ()); + + e_folder_construct (E_FOLDER (efm), uri, name, desc, home_page, view_name); + + return E_FOLDER (efm); +} + + diff --git a/shell/e-folder-mail.h b/shell/e-folder-mail.h new file mode 100644 index 0000000000..76098c6182 --- /dev/null +++ b/shell/e-folder-mail.h @@ -0,0 +1,28 @@ +#ifndef _E_FOLDER_MAIL_H_ +#define _E_FOLDER_MAIL_H_ + +#include "e-folder.h" + +#define E_FOLDER_MAIL_TYPE (e_folder_mail_get_type ()) +#define E_FOLDER_MAIL(o) (GTK_CHECK_CAST ((o), E_FOLDER_MAIL_TYPE, EFolderMail)) +#define E_FOLDER_MAIL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_FOLDER_MAIL_TYPE, EFolderMailClass)) +#define E_IS_FOLDER_MAIL(o) (GTK_CHECK_TYPE ((o), E_FOLDER_MAIL_TYPE)) +#define E_IS_FOLDER_MAIL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_FOLDER_MAIL_TYPE)) + +typedef struct { + EFolder parent; +} EFolderMail; + +typedef struct { + EFolderClass parent; +} EFolderMailClass; + +GtkType e_folder_mail_get_type (void); +EFolder *e_folder_mail_new (const char *uri, const char *name, const char *desc, + const char *home_page, const char *view_name); + +#endif /* _E_FOLDER_MAIL_H_ */ + + + + diff --git a/shell/e-folder.c b/shell/e-folder.c new file mode 100644 index 0000000000..566ead1274 --- /dev/null +++ b/shell/e-folder.c @@ -0,0 +1,204 @@ +/* + * e-folder.c: Abstract class for Evolution folders + * + * Author: + * Miguel de Icaza (miguel@helixcode.com) + * + * (C) 2000 Helix Code, Inc. + */ +#include <config.h> +#include <gtk/gtksignal.h> +#include "e-util/e-util.h" +#include "e-folder.h" + +#define PARENT_TYPE gtk_object_get_type () + +static GtkObjectClass *parent_class; + +#define EFC(o) E_FOLDER_CLASS (GTK_OBJECT (o)->klass) + +enum { + VIEW_CHANGED, + LAST_SIGNAL +}; +static guint efolder_signals [LAST_SIGNAL] = { 0, }; + +static void +e_folder_destroy (GtkObject *object) +{ + EFolder *efolder = E_FOLDER (object); + + if (efolder->uri) + g_free (efolder->uri); + + if (efolder->desc) + g_free (efolder->desc); + + if (efolder->home_page) + g_free (efolder->home_page); + + parent_class->destroy (object); +} + +static void +e_folder_class_init (GtkObjectClass *object_class) +{ + parent_class = gtk_type_class (PARENT_TYPE); + + object_class->destroy = e_folder_destroy; + + efolder_signals [VIEW_CHANGED] = + gtk_signal_new ("view_changed", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EFolderClass, view_changed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, + 0); + /* Register our signals */ + gtk_object_class_add_signals ( + object_class, efolder_signals, LAST_SIGNAL); +} + +E_MAKE_TYPE (e_folder, "EFolder", EFolder, e_folder_class_init, NULL, PARENT_TYPE) + +void +e_folder_set_uri (EFolder *efolder, const char *uri) +{ + g_return_if_fail (efolder != NULL); + g_return_if_fail (E_IS_FOLDER (efolder)); + g_return_if_fail (uri != NULL); + + if (efolder->uri) + g_free (efolder->uri); + + efolder->uri = g_strdup (uri); +} + +const char * +e_folder_get_uri (EFolder *efolder) +{ + g_return_val_if_fail (efolder != NULL, NULL); + g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); + + return efolder->uri; +} + +void +e_folder_set_description (EFolder *efolder, const char *desc) +{ + g_return_if_fail (efolder != NULL); + g_return_if_fail (E_IS_FOLDER (efolder)); + g_return_if_fail (desc != NULL); + + if (efolder->desc) + g_free (efolder->desc); + + efolder->desc = g_strdup (desc); +} + +const char * +e_folder_get_description (EFolder *efolder) +{ + g_return_val_if_fail (efolder != NULL, NULL); + g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); + + return efolder->desc; +} + +void +e_folder_set_home_page (EFolder *efolder, const char *home_page) +{ + g_return_if_fail (efolder != NULL); + g_return_if_fail (E_IS_FOLDER (efolder)); + g_return_if_fail (home_page != NULL); + + if (efolder->home_page) + g_free (efolder->home_page); + + efolder->home_page = g_strdup (home_page); +} + +const char * +e_folder_get_home_page (EFolder *efolder) +{ + g_return_val_if_fail (efolder != NULL, NULL); + g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); + + return efolder->home_page; +} + +const char * +e_folder_get_type_name (EFolder *efolder) +{ + g_return_val_if_fail (efolder != NULL, NULL); + g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); + + return EFC (efolder)->get_type_name (efolder); +} + +void +e_folder_construct (EFolder *efolder, + const char *uri, const char *name, + const char *desc, const char *home_page, + const char *view_name) +{ + g_return_if_fail (efolder != NULL); + g_return_if_fail (E_IS_FOLDER (efolder)); + + if (uri) + efolder->uri = g_strdup (uri); + if (name) + efolder->name = g_strdup (name); + if (desc) + efolder->desc = g_strdup (desc); + if (home_page) + efolder->home_page = g_strdup (home_page); + if (view_name) + efolder->view_name = g_strdup (view_name); +} + +const char * +e_folder_get_name (EFolder *efolder) +{ + g_return_val_if_fail (efolder != NULL, NULL); + g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); + + return efolder->name; +} + +void +e_folder_set_name (EFolder *efolder, const char *name) +{ + g_return_if_fail (efolder != NULL); + g_return_if_fail (E_IS_FOLDER (efolder)); + + if (efolder->name) + g_free (efolder->name); + + efolder->name = g_strdup (name); +} + +const char * +e_folder_get_view_name (EFolder *efolder) +{ + g_return_val_if_fail (efolder != NULL, NULL); + g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); + + return efolder->view_name; +} + +void +e_folder_set_view_name (EFolder *efolder, const char *view_name) +{ + g_return_if_fail (efolder != NULL); + g_return_if_fail (E_IS_FOLDER (efolder)); + + if (efolder->view_name) + g_free (efolder->view_name); + + efolder->view_name = g_strdup (view_name); + + gtk_signal_emit (GTK_OBJECT (efolder), + efolder_signals [VIEW_CHANGED]); +} diff --git a/shell/e-folder.h b/shell/e-folder.h new file mode 100644 index 0000000000..d41a02e6ce --- /dev/null +++ b/shell/e-folder.h @@ -0,0 +1,74 @@ +#ifndef _E_FOLDER_H_ +#define _E_FOLDER_H_ + +#include <gtk/gtkobject.h> +#include <gdk-pixbuf/gdk-pixbuf.h> + +#define E_FOLDER_TYPE (e_folder_get_type ()) +#define E_FOLDER(o) (GTK_CHECK_CAST ((o), E_FOLDER_TYPE, EFolder)) +#define E_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_FOLDER_TYPE, EFolderClass)) +#define E_IS_FOLDER(o) (GTK_CHECK_TYPE ((o), E_FOLDER_TYPE)) +#define E_IS_FOLDER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_FOLDER_TYPE)) + +typedef enum { + E_FOLDER_DND_AS_FORWARD, + E_FOLDER_DND_AS_MOVE_COPY +} EFolderDragDropAction; + +typedef struct { + GtkObject parent_object; + + /* + * General properties + */ + char *uri; /* Location */ + char *name; /* Short name */ + char *desc; /* Full description */ + char *home_page; /* Home page for this folder */ + + /* + * Administration properties + */ + char *view_name; /* View name */ +} EFolder; + +typedef struct { + GtkObjectClass parent_class; + + /* + * Virtual methods + */ + /* eg: "Folder containing mail items */ + const char *(*get_type_name) (EFolder *efolder); + + /* + * Signals + */ + void (*view_changed) (EFolder *efolder); +} EFolderClass; + +GtkType e_folder_get_type (void); +void e_folder_construct (EFolder *efolder, + const char *uri, const char *name, + const char *desc, const char *home_page, + const char *view_name); + +void e_folder_set_uri (EFolder *efolder, const char *uri); +const char *e_folder_get_uri (EFolder *efolder); + +void e_folder_set_description (EFolder *efolder, const char *desc); +const char *e_folder_get_description (EFolder *efolder); + +void e_folder_set_home_page (EFolder *efolder, const char *desc); +const char *e_folder_get_home_page (EFolder *efolder); + +const char *e_folder_get_name (EFolder *efolder); +void e_folder_set_name (EFolder *efolder, const char *name); + +const char *e_folder_get_view_name (EFolder *efolder); +void e_folder_set_view_name (EFolder *efolder, const char *view_name); + +const char *e_folder_get_type_name (EFolder *efolder); + +#endif /* _E_FOLDER_H_ */ + diff --git a/shell/e-shell.c b/shell/e-shell.c index ef03135102..805d207406 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -59,9 +59,6 @@ e_shell_class_init (GtkObjectClass *object_class) static void e_shell_init (GtkObject *object) { - EShell *eshell = E_SHELL (object); - - eshell->gnome_app = gnome_app_new ("Evolution", "Evolution"); } void diff --git a/shell/e-shell.h b/shell/e-shell.h index 6574e1a6d0..dd408f40dd 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -1,7 +1,6 @@ #ifndef E_SHELL_H #define E_SHELL_H -#include <gnome.h> #include <bonobo/gnome-object.h> #define E_SHELL_GOAD_ID "GOADID:GNOME:Evolution:Shell:1.0" @@ -16,8 +15,6 @@ typedef struct { GnomeObject base_object; - GtkWidget *gnome_app; - char *base_uri; } EShell; @@ -25,7 +22,7 @@ typedef struct { GnomeObjectClass *parent_class; } EShellClass; -EShell *e_shell_new (const char *base_uri); +EShell *e_shell_new (const char *base_uri); void e_shell_set_base_uri (EShell *eshell, const char *base_uri); const char *e_shell_get_base_uri (EShell *eshell); |