diff options
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 98 |
1 files changed, 86 insertions, 12 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 880ae59a65..c74d49ced7 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -8,19 +8,28 @@ */ #include <config.h> +#include <gnome.h> +#include "e-util/e-util.h" #include "folder-browser.h" #define PARENT_TYPE (gtk_table_get_type ()) static GtkObjectClass *folder_browser_parent_class; -#define PROPERTY_FOLDER_URI "folder_uri" +#define PROPERTY_FOLDER_URI "folder_uri" +#define PROPERTY_MESSAGE_PREVIEW "message_preview" static void folder_browser_destroy (GtkObject *object) { FolderBrowser *folder_browser = FOLDER_BROWSER (object); + if (folder_browser->uri) + g_free (folder_browser->uri); + + if (folder_browser->message_list) + bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list)); + folder_browser_parent_class->destroy (object); } @@ -37,10 +46,21 @@ folder_browser_class_init (GtkObjectClass *object_class) void folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri) { - g_free (folder_browser->uri); - folder_browser->uri = g_strudp (uri); + if (folder_browser->uri) + g_free (folder_browser->uri); + + folder_browser->uri = g_strdup (uri); } +void +folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview) +{ + if (folder_browser->preview_shown == show_message_preview) + return; + + g_warning ("FIXME: implement me"); +} + static void folder_browser_property_changed (BonoboPropertyBag *properties, const char *name, @@ -54,33 +74,87 @@ folder_browser_property_changed (BonoboPropertyBag *properties, if (EQUAL (name, PROPERTY_FOLDER_URI)){ folder_browser_set_uri (folder_browser, new_value); return; + } else if (EQUAL (name, PROPERTY_MESSAGE_PREVIEW)){ + folder_browser_set_message_preview (folder_browser, *((gboolean *)new_value)); } } static void -folder_browser_init (GtkObject *object) +folder_browser_properties_init (FolderBrowser *fb) { - FolderBrowser *fb = FOLDER_BROWSER (object); - fb->properties = bonobo_property_bag_new (); bonobo_property_bag_add ( fb->properties, PROPERTY_FOLDER_URI, "string", - NULL, NULL, _("The URI that the Folder Browser will display", 0); + NULL, NULL, _("The URI that the Folder Browser will display"), 0); + bonobo_property_bag_add ( + fb->properties, PROPERTY_MESSAGE_PREVIEW, "boolean", + NULL, NULL, _("Whether a message preview should be shown"), 0); gtk_signal_connect (GTK_OBJECT (fb->properties), "value_changed", - property_changed, fb); + folder_browser_property_changed, fb); +} + +static void +folder_browser_gui_init (FolderBrowser *fb) +{ + /* + * The panned container + */ + fb->vpaned = gtk_vpaned_new (); + gtk_widget_show (fb->vpaned); + + gtk_table_attach ( + GTK_TABLE (fb), fb->vpaned, + 0, 1, 0, 2, + GTK_FILL | GTK_EXPAND, + GTK_FILL | GTK_EXPAND, + 0, 0); + + fb->message_list_w = message_list_get_widget (fb->message_list); + gtk_paned_add1 (GTK_PANED (fb->vpaned), fb->message_list_w); + gtk_widget_show (fb->message_list_w); +#if 0 + gtk_paned_add2 (GTK_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display)); + gtk_widget_show (GTK_WIDGET (fb->mail_display)); + gtk_widget_show (GTK_WIDGET (fb)); +#endif +} + +static void +folder_browser_init (GtkObject *object) +{ +} + +static void +my_folder_browser_init (GtkObject *object) +{ + FolderBrowser *fb = FOLDER_BROWSER (object); + + /* + * Setup parent class fields. + */ + GTK_TABLE (fb)->homogeneous = FALSE; + gtk_table_resize (GTK_TABLE (fb), 1, 2); + + /* + * Our instance data + */ + fb->message_list = MESSAGE_LIST (message_list_new ()); + fb->mail_display = MAIL_DISPLAY (mail_display_new ()); + + folder_browser_properties_init (fb); + folder_browser_gui_init (fb); } GtkWidget * folder_browser_new (void) { FolderBrowser *folder_browser = gtk_type_new (folder_browser_get_type ()); - GtkTable *table = GTK_TABLE (folder_browser); - - table->homogeous = FALSE; - gtk_table_resize (table, 1, 2); + my_folder_browser_init (GTK_OBJECT (folder_browser)); + + printf ("Widget started\n"); return GTK_WIDGET (folder_browser); } |