From: Dirk-Jan C. Binnema Date: Mon, 17 Jul 2006 12:04:14 +0000 (+0000) Subject: * added beginnings of new experimental non-glade gtk+ UI X-Git-Tag: git_migration_finished~4499 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=a9df2647632882529ecdb2597d9b0ee98cc83710 * added beginnings of new experimental non-glade gtk+ UI pmo-trunk-r377 --- diff --git a/src/gtk2/Makefile.am b/src/gtk2/Makefile.am new file mode 100644 index 0000000..00d07c1 --- /dev/null +++ b/src/gtk2/Makefile.am @@ -0,0 +1,34 @@ +# +# Makefile.am +# Time-stamp: <2006-07-14 12:43:36 (djcb)> +# +# +# use Automake 'trick' ==> convenience static libraries, which +# won't be installed, just for linking +# +INCLUDES=\ + $(MODEST_GSTUFF_CFLAGS) \ + $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS) \ + -DPREFIX=\"@prefix@\" \ + -Wall + +noinst_LTLIBRARIES=\ + libmodest-ui.la + +PIXMAP_FILES=\ + pixmaps/*.png + +libmodest_ui_la_SOURCES=\ + modest-ui.c\ + modest-icon-names.h\ + modest-main-window.h\ + modest-main-window.c + +LDADD = \ + $(MODEST_GSTUFF_LIBS) \ + $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS) + +EXTRA_DIST=pixmaps/* + +pixmapdir = $(prefix)/share/modest/pixmaps +pixmap_DATA = $(PIXMAP_FILES) diff --git a/src/gtk2/modest-icon-names.h b/src/gtk2/modest-icon-names.h new file mode 100644 index 0000000..c51d743 --- /dev/null +++ b/src/gtk2/modest-icon-names.h @@ -0,0 +1,67 @@ +/* Copyright (c) 2006, Nokia Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Nokia Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +/* modest-tny-icon-names.h */ + +/* + * FIXME: this should go the front-end dirs, + * with specific icons + */ + +#ifndef __MODEST_TNY_ICON_NAMES_H__ +#define __MODEST_TNY_ICON_NAMES_H__ + +#define PIXMAP_PREFIX PREFIX "/share/modest/pixmaps/" + +/* icons */ + +#define MODEST_HEADER_ICON_READ PIXMAP_PREFIX "qgn_list_messagin_mail.png" +#define MODEST_HEADER_ICON_UNREAD PIXMAP_PREFIX "qgn_list_messagin_mail_unread.png" +#define MODEST_HEADER_ICON_DELETED PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png" +#define MODEST_HEADER_ICON_ATTACH PIXMAP_PREFIX "qgn_list_gene_attacpap.png" + +#define MODEST_FOLDER_ICON_OPEN PIXMAP_PREFIX "qgn_list_gene_fldr_opn.png" +#define MODEST_FOLDER_ICON_CLOSED PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png" + +#define MODEST_FOLDER_ICON_INBOX PIXMAP_PREFIX "qgn_list_messagin_inbox.png" +#define MODEST_FOLDER_ICON_OUTBOX PIXMAP_PREFIX "qgn_list_messagin_outbox.png" +#define MODEST_FOLDER_ICON_SENT PIXMAP_PREFIX "qgn_list_messagin_sent.png" +#define MODEST_FOLDER_ICON_TRASH PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png" +#define MODEST_FOLDER_ICON_JUNK PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png" +#define MODEST_FOLDER_ICON_DRAFTS PIXMAP_PREFIX "qgn_list_messagin_drafts.png" +#define MODEST_FOLDER_ICON_NORMAL PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png" + +#define MODEST_FOLDER_ICON_CONTACTS PIXMAP_PREFIX "qgn_addr_icon_user_group.png" +#define MODEST_FOLDER_ICON_NOTES PIXMAP_PREFIX "qgn_list_messagin_viewer.png" +#define MODEST_FOLDER_ICON_CALENDAR PIXMAP_PREFIX "qgn_widg_datedit.png" + + + +#endif /*__MODEST_TNY_ICON_NAMES_H__*/ diff --git a/src/gtk2/modest-main-window.c b/src/gtk2/modest-main-window.c new file mode 100644 index 0000000..ee8a1d2 --- /dev/null +++ b/src/gtk2/modest-main-window.c @@ -0,0 +1,296 @@ +/* modest-main-window.c */ + +/* insert (c)/licensing information) */ + +#include "modest-main-window.h" +/* include other impl specific header files */ + +/* 'private'/'protected' functions */ +static void modest_main_window_class_init (ModestMainWindowClass *klass); +static void modest_main_window_init (ModestMainWindow *obj); +static void modest_main_window_finalize (GObject *obj); + +/* list my signals */ +enum { + /* MY_SIGNAL_1, */ + /* MY_SIGNAL_2, */ + LAST_SIGNAL +}; + +typedef struct _ModestMainWindowPrivate ModestMainWindowPrivate; +struct _ModestMainWindowPrivate { + GtkWidget *toolbar; + GtkWidget *menubar; + GtkWidget *progress_bar; + GtkWidget *status_bar; + GtkWidget *folder_paned; + GtkWidget *msg_paned; + + ModestWidgetFactory *widget_factory; + + ModestTnyHeaderTreeView *header_view; + ModestTnyFolderTreeView *folder_view; + ModestTnyMsgView *msg_preview; +}; + + +#define MODEST_MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ + MODEST_TYPE_MAIN_WINDOW, \ + ModestMainWindowPrivate)) +/* globals */ +static GtkWindowClass *parent_class = NULL; + +/* uncomment the following if you have defined any signals */ +/* static guint signals[LAST_SIGNAL] = {0}; */ + +GType +modest_main_window_get_type (void) +{ + static GType my_type = 0; + if (!my_type) { + static const GTypeInfo my_info = { + sizeof(ModestMainWindowClass), + NULL, /* base init */ + NULL, /* base finalize */ + (GClassInitFunc) modest_main_window_class_init, + NULL, /* class finalize */ + NULL, /* class data */ + sizeof(ModestMainWindow), + 1, /* n_preallocs */ + (GInstanceInitFunc) modest_main_window_init, + }; + my_type = g_type_register_static (GTK_TYPE_WINDOW, + "ModestMainWindow", + &my_info, 0); + } + return my_type; +} + +static void +modest_main_window_class_init (ModestMainWindowClass *klass) +{ + GObjectClass *gobject_class; + gobject_class = (GObjectClass*) klass; + + parent_class = g_type_class_peek_parent (klass); + gobject_class->finalize = modest_main_window_finalize; + + g_type_class_add_private (gobject_class, sizeof(ModestMainWindowPrivate)); + + /* signal definitions go here, e.g.: */ +/* signals[MY_SIGNAL_1] = */ +/* g_signal_new ("my_signal_1",....); */ +/* signals[MY_SIGNAL_2] = */ +/* g_signal_new ("my_signal_2",....); */ +/* etc. */ +} + +static void +modest_main_window_init (ModestMainWindow *obj) +{ + ModestMainWindowPrivate *priv; + + priv = MODEST_MAIN_WINDOW_GET_PRIVATE(obj); + + priv->widget_factory = NULL; +} + +static void +modest_main_window_finalize (GObject *obj) +{ + ModestMainWindowPrivate *priv; + + priv = MODEST_MAIN_WINDOW_GET_PRIVATE(obj); + + if (priv->widget_factory) { + g_object_unref (G_OBJECT(priv->widget_factory)); + priv->widget_factory = NULL; + } + + G_OBJECT_CLASS(parent_class)->finalize (obj); +} + +/* Obligatory basic callback */ +static void print_hello( GtkWidget *w, + gpointer data ) +{ + g_message ("Hello, World!\n"); +} + +/* For the check button */ +static void print_toggle( gpointer callback_data, + guint callback_action, + GtkWidget *menu_item ) +{ + g_message ("Check button state - %d\n", + GTK_CHECK_MENU_ITEM (menu_item)->active); +} + +/* For the radio buttons */ +static void print_selected( gpointer callback_data, + guint callback_action, + GtkWidget *menu_item ) +{ + if(GTK_CHECK_MENU_ITEM(menu_item)->active) + g_message ("Radio button %d selected\n", callback_action); +} + +/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */ +static GtkItemFactoryEntry menu_items[] = { + { "/_File", NULL, NULL, 0, "" }, + { "/File/_New", "N", print_hello, 0, "", GTK_STOCK_NEW }, + { "/File/_Open", "O", print_hello, 0, "", GTK_STOCK_OPEN }, + { "/File/_Save", "S", print_hello, 0, "", GTK_STOCK_SAVE }, + { "/File/Save _As", NULL, NULL, 0, "" }, + { "/File/sep1", NULL, NULL, 0, "" }, + { "/File/_Quit", "Q", gtk_main_quit, 0, "", GTK_STOCK_QUIT }, + { "/_Edit", NULL, NULL, 0, "" }, + { "/Edit/_Undo", "Z", print_hello, 0, "", GTK_STOCK_UNDO }, + { "/Edit/_Redo", "Z", print_hello, 0, "", GTK_STOCK_REDO }, + { "/File/sep1", NULL, NULL, 0, "" }, + + { "/Edit/Cut", "S", print_hello, 0, "", GTK_STOCK_SAVE }, + { "/Edit/Copy", NULL, NULL, 0, "" }, + { "/Edit/Paste", NULL, NULL, 0, "" }, + { "/Edit/Delete", "Q", gtk_main_quit, 0, "", GTK_STOCK_QUIT }, + { "/Edit/Select all", "A", gtk_main_quit, 0, "", GTK_STOCK_QUIT }, + { "/Edit/Deelect all", "A", gtk_main_quit, 0, "", GTK_STOCK_QUIT }, + + { "/_Options", NULL, NULL, 0, "" }, + { "/Options/tear", NULL, NULL, 0, "" }, + { "/Options/Check", NULL, print_toggle, 1, "" }, + { "/Options/sep", NULL, NULL, 0, "" }, + { "/Options/Rad1", NULL, print_selected, 1, "" }, + { "/Options/Rad2", NULL, print_selected, 2, "/Options/Rad1" }, + { "/Options/Rad3", NULL, print_selected, 3, "/Options/Rad1" }, + { "/_Help", NULL, NULL, 0, "" }, + { "/_Help/About", NULL, NULL, 0, "" }, +}; +static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); + + +static GtkWidget * +menubar_new (ModestMainWindow *self) +{ + GtkItemFactory *item_factory; + GtkAccelGroup *accel_group; + + /* Make an accelerator group (shortcut keys) */ + accel_group = gtk_accel_group_new (); + + /* Make an ItemFactory (that makes a menubar) */ + item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "
", + accel_group); + + /* This function generates the menu items. Pass the item factory, + the number of items in the array, the array itself, and any + callback data for the the menu items. */ + gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL); + + ///* Attach the new accelerator group to the window. */ + gtk_window_add_accel_group (GTK_WINDOW (self), accel_group); + + /* Finally, return the actual menu bar created by the item factory. */ + return gtk_item_factory_get_widget (item_factory, "
"); +} + + + + +static ModestTnyHeaderTreeView* +header_view_new (ModestMainWindow *self) +{ + int i; + GSList *columns = NULL; + ModestTnyHeaderTreeView *header_view; + ModestMainWindowPrivate *priv; + ModestTnyHeaderTreeViewColumn cols[] = { + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_MSGTYPE, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_ATTACH, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_FROM, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_SUBJECT, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_RECEIVED_DATE + }; + + priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self); + + for (i = 0 ; i != sizeof(cols) / sizeof(ModestTnyHeaderTreeViewColumn); ++i) + columns = g_slist_append (columns, GINT_TO_POINTER(cols[i])); + + header_view = modest_widget_factory_get_header_tree_widget (priv->widget_factory); + modest_tny_header_tree_view_set_columns (header_view, columns); + g_slist_free (columns); + + return header_view; +} + + + +GtkWidget* +modest_main_window_new (ModestWidgetFactory *factory) +{ + GObject *obj; + ModestMainWindowPrivate *priv; + + GtkWidget *main_vbox; + GtkWidget *main_paned; + GtkWidget *status_hbox; + GtkWidget *header_win, *folder_win; + + g_return_val_if_fail (factory, NULL); + + obj = g_object_new(MODEST_TYPE_MAIN_WINDOW, NULL); + priv = MODEST_MAIN_WINDOW_GET_PRIVATE(obj); + + g_object_ref (factory); + priv->widget_factory = factory; + + /* widgets from factory */ + priv->folder_view = modest_widget_factory_get_folder_tree_widget (factory); + priv->header_view = header_view_new (MODEST_MAIN_WINDOW(obj)); + priv->msg_preview = modest_widget_factory_get_msg_preview_widget (factory); + folder_win = gtk_scrolled_window_new (NULL,NULL); + gtk_container_add (GTK_CONTAINER(folder_win), GTK_WIDGET(priv->folder_view)); + header_win = gtk_scrolled_window_new (NULL,NULL); + gtk_container_add (GTK_CONTAINER(header_win), GTK_WIDGET(priv->header_view)); + + /* tool/menubar */ + priv->menubar = menubar_new (MODEST_MAIN_WINDOW(obj)); + priv->toolbar = gtk_toolbar_new (); + + /* paned */ + priv->folder_paned = gtk_vpaned_new (); + priv->msg_paned = gtk_vpaned_new (); + main_paned = gtk_hpaned_new (); + gtk_paned_add1 (GTK_PANED(main_paned), priv->folder_paned); + gtk_paned_add2 (GTK_PANED(main_paned), priv->msg_paned); + gtk_paned_add1 (GTK_PANED(priv->folder_paned), gtk_label_new ("Favourites")); + gtk_paned_add2 (GTK_PANED(priv->folder_paned), folder_win); + gtk_paned_add1 (GTK_PANED(priv->msg_paned), header_win); + gtk_paned_add2 (GTK_PANED(priv->msg_paned), GTK_WIDGET(priv->msg_preview)); + + gtk_widget_show (GTK_WIDGET(priv->header_view)); + + /* status bar / progress */ + priv->status_bar = gtk_statusbar_new (); + priv->progress_bar = gtk_progress_bar_new (); + status_hbox = gtk_hbox_new (TRUE, 5); + gtk_box_pack_start (GTK_BOX(status_hbox), priv->status_bar, FALSE, TRUE, 5); + gtk_box_pack_start (GTK_BOX(status_hbox), priv->progress_bar, FALSE, TRUE, 5); + + + /* putting it all together... */ + main_vbox = gtk_vbox_new (FALSE, 2); + gtk_box_pack_start (GTK_BOX(main_vbox), priv->menubar, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX(main_vbox), priv->toolbar, FALSE, TRUE, 5); + gtk_box_pack_start (GTK_BOX(main_vbox), main_paned, TRUE, TRUE, 2); + gtk_box_pack_start (GTK_BOX(main_vbox), status_hbox, FALSE, FALSE, 5); + + gtk_container_add (GTK_CONTAINER(obj), main_vbox); + gtk_widget_show_all (main_vbox); + + gtk_window_set_title (GTK_WINDOW(obj), "modest"); + gtk_window_set_default_size (GTK_WINDOW(obj), 800, 600); + + return GTK_WIDGET(obj); +} diff --git a/src/gtk2/modest-main-window.h b/src/gtk2/modest-main-window.h new file mode 100644 index 0000000..7640fa0 --- /dev/null +++ b/src/gtk2/modest-main-window.h @@ -0,0 +1,44 @@ +/* modest-main-window.h */ +/* insert (c)/licensing information) */ + +#ifndef __MODEST_MAIN_WINDOW_H__ +#define __MODEST_MAIN_WINDOW_H__ + +#include +#include "../modest-widget-factory.h" + +G_BEGIN_DECLS + +/* convenience macros */ +#define MODEST_TYPE_MAIN_WINDOW (modest_main_window_get_type()) +#define MODEST_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_MAIN_WINDOW,ModestMainWindow)) +#define MODEST_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_MAIN_WINDOW,GtkWindow)) +#define MODEST_IS_MAIN_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_MAIN_WINDOW)) +#define MODEST_IS_MAIN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_MAIN_WINDOW)) +#define MODEST_MAIN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_MAIN_WINDOW,ModestMainWindowClass)) + +typedef struct _ModestMainWindow ModestMainWindow; +typedef struct _ModestMainWindowClass ModestMainWindowClass; + +struct _ModestMainWindow { + GtkWindow parent; + /* insert public members, if any */ +}; + +struct _ModestMainWindowClass { + GtkWindowClass parent_class; + /* insert signal callback declarations, eg. */ + /* void (* my_event) (ModestMainWindow* obj); */ +}; + +/* member functions */ +GType modest_main_window_get_type (void) G_GNUC_CONST; + +/* typical parameter-less _new function */ +/* if this is a kind of GtkWidget, it should probably return at GtkWidget* */ +GtkWidget* modest_main_window_new (ModestWidgetFactory *factory); + +G_END_DECLS + +#endif /* __MODEST_MAIN_WINDOW_H__ */ + diff --git a/src/gtk2/modest-ui.c b/src/gtk2/modest-ui.c new file mode 100644 index 0000000..7a95ca8 --- /dev/null +++ b/src/gtk2/modest-ui.c @@ -0,0 +1,208 @@ +/* Copyright (c) 2006, Nokia Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Nokia Corporation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif /*HAVE_CONFIG_H*/ + +#include "../modest-ui.h" +#include "../modest-account-mgr.h" +#include "../modest-widget-factory.h" +#include "modest-main-window.h" + + +/* 'private'/'protected' functions */ +static void modest_ui_class_init (ModestUIClass *klass); +static void modest_ui_init (ModestUI *obj); +static void modest_ui_finalize (GObject *obj); + +gchar *on_password_requested (TnyAccountIface *, const gchar *, gboolean *); + + +typedef struct _ModestUIPrivate ModestUIPrivate; +struct _ModestUIPrivate { + ModestConf *conf; + ModestAccountMgr *account_mgr; + ModestWidgetFactory *widget_factory; + ModestTnyAccountStore *account_store; +}; + +#define MODEST_UI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ + MODEST_TYPE_UI, \ + ModestUIPrivate)) + + +/* list my signals */ +enum { + /* MY_SIGNAL_1, */ + /* MY_SIGNAL_2, */ + LAST_SIGNAL +}; + +/* globals */ +static GObjectClass *parent_class = NULL; + + +GType +modest_ui_get_type (void) +{ + static GType my_type = 0; + if (!my_type) { + static const GTypeInfo my_info = { + sizeof(ModestUIClass), + NULL, /* base init */ + NULL, /* base finalize */ + (GClassInitFunc) modest_ui_class_init, + NULL, /* class finalize */ + NULL, /* class data */ + sizeof(ModestUI), + 1, /* n_preallocs */ + (GInstanceInitFunc) modest_ui_init, + }; + my_type = g_type_register_static (G_TYPE_OBJECT, + "ModestUI", + &my_info, 0); + } + return my_type; +} + + +static void +modest_ui_class_init (ModestUIClass *klass) +{ + GObjectClass *gobject_class; + gobject_class = (GObjectClass*) klass; + + parent_class = g_type_class_peek_parent (klass); + gobject_class->finalize = modest_ui_finalize; + + g_type_class_add_private (gobject_class, sizeof(ModestUIPrivate)); + +} + + +static void +modest_ui_init (ModestUI *obj) +{ + ModestUIPrivate *priv; + + priv = MODEST_UI_GET_PRIVATE(obj); + + priv->account_store = NULL; + priv->account_mgr = NULL; + priv->conf = NULL; + priv->widget_factory = NULL; +} + + +static void +modest_ui_finalize (GObject *obj) +{ + + ModestUIPrivate *priv = MODEST_UI_GET_PRIVATE(obj); + + if (priv->account_store) { + g_object_unref (G_OBJECT(priv->account_store)); + priv->account_store = NULL; + } + + if (priv->account_mgr) { + g_object_unref (G_OBJECT(priv->account_mgr)); + priv->account_mgr = NULL; + } + + if (priv->widget_factory) { + g_object_unref (G_OBJECT(priv->widget_factory)); + priv->widget_factory = NULL; + } + + if (priv->conf) { + g_object_unref (G_OBJECT(priv->conf)); + priv->conf = NULL; + } +} + + +ModestUI* +modest_ui_new (ModestConf *modest_conf) +{ + GObject *obj; + ModestUIPrivate *priv; + + g_return_val_if_fail (modest_conf, NULL); + + obj = g_object_new(MODEST_TYPE_UI, NULL); + priv = MODEST_UI_GET_PRIVATE(obj); + + g_object_ref (G_OBJECT(modest_conf)); + priv->conf = modest_conf; + + priv->account_mgr = MODEST_ACCOUNT_MGR(modest_account_mgr_new (priv->conf)); + if (!priv->account_mgr) { + g_printerr ("modest: could not create ModestAccountMgr instance\n"); + g_object_unref (obj); + return NULL; + } + + priv->account_store = modest_tny_account_store_new (priv->account_mgr); + if (!priv->account_store) { + g_printerr ("modest: could not initialze ModestTnyAccountStore instance\n"); + return NULL; + } + + priv->widget_factory = modest_widget_factory_new (priv->account_store, TRUE); + if (!priv->account_store) { + g_printerr ("modest: could not initialize widget factory\n"); + return NULL; + } + + return MODEST_UI(obj); +} + + +GtkWidget* +modest_ui_main_window (ModestUI *modest_ui) +{ + GtkWidget* win; + ModestUIPrivate *priv; + + g_return_val_if_fail (modest_ui, NULL); + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + win = modest_main_window_new (priv->widget_factory); + if (!win) + g_printerr ("modest: could not create main window\n"); + + return win; +} diff --git a/src/gtk2/pixmaps/qgn_addr_icon_user_group.png b/src/gtk2/pixmaps/qgn_addr_icon_user_group.png new file mode 100644 index 0000000..c5b9f6c Binary files /dev/null and b/src/gtk2/pixmaps/qgn_addr_icon_user_group.png differ diff --git a/src/gtk2/pixmaps/qgn_list_gene_attacpap.png b/src/gtk2/pixmaps/qgn_list_gene_attacpap.png new file mode 100644 index 0000000..0448a7d Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_gene_attacpap.png differ diff --git a/src/gtk2/pixmaps/qgn_list_gene_fldr_clp.png b/src/gtk2/pixmaps/qgn_list_gene_fldr_clp.png new file mode 100644 index 0000000..0034909 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_gene_fldr_clp.png differ diff --git a/src/gtk2/pixmaps/qgn_list_gene_fldr_cls.png b/src/gtk2/pixmaps/qgn_list_gene_fldr_cls.png new file mode 100644 index 0000000..976155c Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_gene_fldr_cls.png differ diff --git a/src/gtk2/pixmaps/qgn_list_gene_fldr_exp.png b/src/gtk2/pixmaps/qgn_list_gene_fldr_exp.png new file mode 100644 index 0000000..28a583f Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_gene_fldr_exp.png differ diff --git a/src/gtk2/pixmaps/qgn_list_gene_fldr_opn.png b/src/gtk2/pixmaps/qgn_list_gene_fldr_opn.png new file mode 100644 index 0000000..2bf04f2 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_gene_fldr_opn.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin.png b/src/gtk2/pixmaps/qgn_list_messagin.png new file mode 100644 index 0000000..173f657 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_drafts.png b/src/gtk2/pixmaps/qgn_list_messagin_drafts.png new file mode 100644 index 0000000..c16cdcd Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_drafts.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_editor.png b/src/gtk2/pixmaps/qgn_list_messagin_editor.png new file mode 100644 index 0000000..c68ef5e Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_editor.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr.png new file mode 100644 index 0000000..c61cc32 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted.png new file mode 100644 index 0000000..9c27686 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted_high.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted_high.png new file mode 100644 index 0000000..699a464 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted_low.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted_low.png new file mode 100644 index 0000000..10287d5 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_encrypted_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_high.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_high.png new file mode 100644 index 0000000..00328bc Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_high_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_high_unread.png new file mode 100644 index 0000000..0c1f206 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_high_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_low.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_low.png new file mode 100644 index 0000000..7b9493b Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_low_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_low_unread.png new file mode 100644 index 0000000..61d8b56 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_low_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed.png new file mode 100644 index 0000000..ff95a21 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed_high.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed_high.png new file mode 100644 index 0000000..3071acd Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed_low.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed_low.png new file mode 100644 index 0000000..014d02f Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_signed_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread.png new file mode 100644 index 0000000..1c0c5f9 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted.png new file mode 100644 index 0000000..c44ecb5 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted_high.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted_high.png new file mode 100644 index 0000000..7fc702d Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted_low.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted_low.png new file mode 100644 index 0000000..cc0e90e Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_encrypted_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed.png new file mode 100644 index 0000000..ec1cc23 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed_high.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed_high.png new file mode 100644 index 0000000..c9c4bbb Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed_low.png b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed_low.png new file mode 100644 index 0000000..9e60c21 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_hdr_unread_signed_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_inbox.png b/src/gtk2/pixmaps/qgn_list_messagin_inbox.png new file mode 100644 index 0000000..eb79b09 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_inbox.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail.png b/src/gtk2/pixmaps/qgn_list_messagin_mail.png new file mode 100644 index 0000000..4038776 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_deleted.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_deleted.png new file mode 100644 index 0000000..0e8df2d Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_deleted.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read.png new file mode 100644 index 0000000..2395b98 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read_high.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read_high.png new file mode 100644 index 0000000..2ddb3f5 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read_low.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read_low.png new file mode 100644 index 0000000..6bf9e47 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_read_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread.png new file mode 100644 index 0000000..e85b88c Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread_high.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread_high.png new file mode 100644 index 0000000..4a34249 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread_low.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread_low.png new file mode 100644 index 0000000..76dd826 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_encrypted_unread_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_high.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_high.png new file mode 100644 index 0000000..92799de Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_high_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_high_unread.png new file mode 100644 index 0000000..f19237b Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_high_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_low.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_low.png new file mode 100644 index 0000000..6ee833c Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_low_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_low_unread.png new file mode 100644 index 0000000..739fc52 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_low_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read.png new file mode 100644 index 0000000..5f7dd8f Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read_high.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read_high.png new file mode 100644 index 0000000..8d00684 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read_low.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read_low.png new file mode 100644 index 0000000..0c6b647 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_read_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread.png new file mode 100644 index 0000000..7ff25a5 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread_high.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread_high.png new file mode 100644 index 0000000..c25a609 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread_low.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread_low.png new file mode 100644 index 0000000..b07cacb Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_signed_unread_low.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_mail_unread.png b/src/gtk2/pixmaps/qgn_list_messagin_mail_unread.png new file mode 100644 index 0000000..3d15a38 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_mail_unread.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_outbox.png b/src/gtk2/pixmaps/qgn_list_messagin_outbox.png new file mode 100644 index 0000000..2b5a10a Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_outbox.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_sent.png b/src/gtk2/pixmaps/qgn_list_messagin_sent.png new file mode 100644 index 0000000..73c8c27 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_sent.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messagin_viewer.png b/src/gtk2/pixmaps/qgn_list_messagin_viewer.png new file mode 100644 index 0000000..2ee8ca1 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messagin_viewer.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messaging_high.png b/src/gtk2/pixmaps/qgn_list_messaging_high.png new file mode 100644 index 0000000..ed8cd61 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messaging_high.png differ diff --git a/src/gtk2/pixmaps/qgn_list_messaging_low.png b/src/gtk2/pixmaps/qgn_list_messaging_low.png new file mode 100644 index 0000000..fe2ff2c Binary files /dev/null and b/src/gtk2/pixmaps/qgn_list_messaging_low.png differ diff --git a/src/gtk2/pixmaps/qgn_widg_datedit.png b/src/gtk2/pixmaps/qgn_widg_datedit.png new file mode 100644 index 0000000..b942504 Binary files /dev/null and b/src/gtk2/pixmaps/qgn_widg_datedit.png differ