Changeset 279

Show
Ignore:
Timestamp:
05/12/06 11:14:19
Author:
pvanhoof
Message:

Platform factory

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-gnome-desktop/Makefile.am

    r270 r279  
    1212        tny-moz-embed-stream.h                   \ 
    1313        tny-password-dialog.h                    \ 
    14         tny-device.h 
     14        tny-device.h                             \ 
     15        tny-platform-factory.h 
    1516 
    1617libtinymail_gnome_desktop_1_0_la_SOURCES =       \ 
     
    2122        tny-moz-embed-msg-view.c                 \ 
    2223        tny-moz-embed-stream.c                   \ 
    23         tny-password-dialog.c 
     24        tny-password-dialog.c                    \ 
     25        tny-platform-factory.c 
    2426 
    2527libtinymail_gnome_desktop_1_0_la_LIBADD =       \ 
  • trunk/libtinymail-gnome-desktop/tny-account-store.c

    r263 r279  
    485485 **/ 
    486486TnyAccountStore* 
    487 tny_account_store_get_instance (void) 
     487tny_account_store_new (void) 
    488488{ 
    489489        TnyAccountStore *self = g_object_new (TNY_TYPE_ACCOUNT_STORE, NULL); 
     490        TnyAccountStorePriv *priv = TNY_ACCOUNT_STORE_GET_PRIVATE (self); 
     491 
     492        priv->device = TNY_DEVICE_IFACE (tny_device_new ()); 
     493        priv->session = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE (self)); 
    490494 
    491495        return self; 
     
    547551} 
    548552 
    549 static TnyAccountStore *the_singleton = NULL; 
    550  
    551  
    552 static GObject* 
    553 tny_account_store_constructor (GType type, guint n_construct_params, 
    554                         GObjectConstructParam *construct_params) 
    555 { 
    556         GObject *object; 
    557  
    558         /* TODO: potential problem: singleton without lock */ 
    559  
    560         if (G_UNLIKELY (!the_singleton)) 
    561         { 
    562                 TnyAccountStorePriv *priv; 
    563  
    564                 object = G_OBJECT_CLASS (parent_class)->constructor (type, 
    565                                 n_construct_params, construct_params); 
    566  
    567                 priv = TNY_ACCOUNT_STORE_GET_PRIVATE (object); 
    568                 priv->device = TNY_DEVICE_IFACE (tny_device_new ()); 
    569                 priv->session = tny_session_camel_new  
    570                         (TNY_ACCOUNT_STORE_IFACE (object)); 
    571  
    572                 the_singleton = TNY_ACCOUNT_STORE (object); 
    573         } 
    574         else 
    575         { 
    576                 object = g_object_ref (G_OBJECT (the_singleton)); 
    577                 g_object_freeze_notify (G_OBJECT(the_singleton)); 
    578         } 
    579  
    580         return object; 
    581 } 
    582  
    583  
    584553static void  
    585554tny_account_store_class_init (TnyAccountStoreClass *class) 
     
    591560 
    592561        object_class->finalize = tny_account_store_finalize; 
    593         object_class->constructor = tny_account_store_constructor; 
    594562 
    595563        g_type_class_add_private (object_class, sizeof (TnyAccountStorePriv)); 
  • trunk/libtinymail-gnome-desktop/tny-account-store.h

    r251 r279  
    4949 
    5050GType               tny_account_store_get_type       (void); 
    51 TnyAccountStore*    tny_account_store_get_instance   (void); 
     51TnyAccountStore*    tny_account_store_new            (void); 
    5252TnySessionCamel*    tny_account_store_get_session    (TnyAccountStore *self); 
    5353 
  • trunk/libtinymail/tny-shared.h

    r250 r279  
    4545typedef struct _TnyMsgHeaderProxy TnyMsgHeaderProxy; 
    4646typedef struct _TnyMsgHeaderProxyClass TnyMsgHeaderProxyClass; 
     47typedef struct _TnyPlatformFactoryIface PlatformFactoryIface; 
     48typedef struct _PlatformFactoryIfaceClass PlatformFactoryIfaceClass; 
    4749typedef gchar* (*TnyGetPassFunc) (TnyAccountIface *self, const gchar *prompt); 
    4850typedef void (*TnyForgetPassFunc) (TnyAccountIface *self); 
  • trunk/libtinymailui-gtk/tny-msg-window.c

    r212 r279  
    5555 **/ 
    5656TnyMsgWindow* 
    57 tny_msg_window_new (void
     57tny_msg_window_new (TnyMsgViewIface *msgview
    5858{ 
    5959        TnyMsgWindow *self = g_object_new (TNY_TYPE_MSG_WINDOW, NULL); 
     60        TnyMsgWindowPriv *priv = TNY_MSG_WINDOW_GET_PRIVATE (self); 
     61 
     62        priv->msg_view = msgview; 
     63 
     64        /* TODO: Remove old msg_view first */ 
     65 
     66        gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (priv->msg_view)); 
     67        gtk_widget_show (GTK_WIDGET (priv->msg_view)); 
    6068 
    6169        return self; 
     
    7078        gtk_window_set_default_size (GTK_WINDOW (self), 640, 480); 
    7179 
    72         priv->msg_view = TNY_MSG_VIEW_IFACE (tny_msg_view_new ()); 
    7380 
    74         gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (priv->msg_view)); 
    75  
    76         gtk_widget_show (GTK_WIDGET (priv->msg_view)); 
    7781 
    7882        return; 
  • trunk/libtinymailui-gtk/tny-msg-window.h

    r139 r279  
    2424#include <tny-shared.h> 
    2525 
     26#include <tny-msg-view-iface.h> 
    2627#include <tny-msg-window-iface.h> 
    2728#include <tny-msg-header-iface.h> 
     
    5455 
    5556GType               tny_msg_window_get_type       (void); 
    56 TnyMsgWindow*       tny_msg_window_new            (void); 
     57TnyMsgWindow*       tny_msg_window_new            (TnyMsgViewIface *msgview); 
    5758 
    5859G_END_DECLS 
  • trunk/libtinymailui/Makefile.am

    r104 r279  
    88        tny-summary-window-iface.h      \ 
    99        tny-msg-view-iface.h            \ 
    10         tny-msg-window-iface.h 
     10        tny-msg-window-iface.h          \ 
     11        tny-platform-factory-iface.h 
    1112 
    1213libtinymailui_1_0_la_SOURCES =          \ 
     
    1415        tny-summary-window-iface.c      \ 
    1516        tny-msg-view-iface.c            \ 
    16         tny-msg-window-iface.c 
     17        tny-msg-window-iface.c          \ 
     18        tny-platform-factory-iface.c 
    1719 
    1820libtinymailui_1_0_la_LIBADD =           \ 
  • trunk/tinymail/tny-main.c

    r274 r279  
    2222#include <tny-summary-window.h> 
    2323#include <tny-summary-window-iface.h> 
    24 #include <tny-account-store-iface.h> 
    25 #include <tny-account-store.h> 
    26  
    27 #include <tny-msg-header.h> 
    28 #include <tny-msg-header-iface.h> 
     24#include <tny-platform-factory-iface.h> 
     25#include <tny-platform-factory.h> 
    2926 
    3027#include <libgnomevfs/gnome-vfs.h> 
    3128#include <libgnomevfs/gnome-vfs-utils.h> 
    3229 
    33 #include <firefox/nspr/nspr.h> 
    3430 
    3531 
     
    4743{ 
    4844        GtkWindow *window = NULL; 
     45        TnyPlatformFactoryIface *platfact; 
    4946 
    5047        gtk_init (&argc, &argv); 
     
    5350        gnome_vfs_init (); 
    5451 
     52        platfact = TNY_PLATFORM_FACTORY_IFACE  
     53                        (tny_platform_factory_get_instance ()); 
     54 
    5555        window = GTK_WINDOW (tny_summary_window_new ()); 
    5656 
    5757        gtk_widget_show (GTK_WIDGET (window)); 
    5858 
    59         tny_summary_window_iface_set_account_store (TNY_SUMMARY_WINDOW_IFACE (window), 
    60                 TNY_ACCOUNT_STORE_IFACE (tny_account_store_get_instance ())); 
     59        tny_summary_window_iface_set_account_store ( 
     60                TNY_SUMMARY_WINDOW_IFACE (window), 
     61                tny_platform_factory_iface_new_account_store (platfact)); 
    6162         
    6263        g_signal_connect (window, "destroy", 
  • trunk/tinymail/tny-summary-window.c

    r270 r279  
    2323#include <gtk/gtk.h> 
    2424 
     25#include <tny-platform-factory-iface.h> 
     26#include <tny-platform-factory.h> 
     27 
    2528#include <tny-password-dialog.h> 
    2629#include <tny-account-store-iface.h> 
     
    364367                        const TnyMsgHeaderIface *nheader; 
    365368 
     369                        TnyPlatformFactoryIface *platfact; 
     370 
     371                        platfact = TNY_PLATFORM_FACTORY_IFACE  
     372                                (tny_platform_factory_get_instance ()); 
     373 
    366374                        folder = tny_msg_header_iface_get_folder (TNY_MSG_HEADER_IFACE (header)); 
    367375 
     
    378386                        nheader = tny_msg_iface_get_header (TNY_MSG_IFACE (msg)); 
    379387 
    380                         msgwin = TNY_MSG_WINDOW_IFACE (tny_msg_window_new ()); 
     388 
     389                        msgwin = TNY_MSG_WINDOW_IFACE (tny_msg_window_new ( 
     390                                tny_platform_factory_iface_new_msg_view (platfact))); 
     391 
    381392                        tny_msg_window_iface_set_msg (msgwin, TNY_MSG_IFACE (msg)); 
    382393         
     
    405416        TnySummaryWindow *self = (TnySummaryWindow *)instance; 
    406417        TnySummaryWindowPriv *priv = TNY_SUMMARY_WINDOW_GET_PRIVATE (self); 
     418        TnyPlatformFactoryIface *platfact; 
     419 
    407420        GtkWindow *window = GTK_WINDOW (self); 
    408421        GtkWidget *mailbox_sw; 
     
    416429        GtkWidget *vpaned1; 
    417430        GtkWidget *vbox; 
    418  
     431         
    419432 
    420433        /* TODO: Persist application UI status (of the panes) */ 
     434 
     435        platfact = TNY_PLATFORM_FACTORY_IFACE  
     436                        (tny_platform_factory_get_instance ()); 
    421437 
    422438        hpaned1 = gtk_hpaned_new (); 
     
    438454        gtk_widget_show (vpaned1); 
    439455         
    440  
    441 #ifdef GTKMOZEMBED 
    442         priv->msg_view = TNY_MSG_VIEW_IFACE (tny_moz_embed_msg_view_new ()); 
    443 #else 
    444         priv->msg_view = TNY_MSG_VIEW_IFACE (tny_text_buffer_msg_view_new ()); 
    445 #endif 
     456        priv->msg_view = tny_platform_factory_iface_new_msg_view (platfact); 
    446457 
    447458        gtk_widget_show (GTK_WIDGET (priv->msg_view));