Changeset 981

Show
Ignore:
Timestamp:
10/12/06 20:31:55
Author:
pvanhoof
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymailui/tny-mime-part-view.c

    r980 r981  
    2121 
    2222#include <tny-mime-part-view.h> 
     23 
     24 
     25 
     26/** 
     27 * tny_mime_part_view_set_save_strategy: 
     28 * @self: A #TnyMimePartView instance 
     29 * @strategy: A TnySaveStrategy instace 
     30 * 
     31 * Set the strategy used for saving mime-parts 
     32 *  
     33 * Implementors: This method should set the strategy for saving a mime-part. 
     34 * The user interface of the view can for example have a popup menu in its 
     35 * attachment viewer that will have to use this strategy for saving the 
     36 * mime-part. 
     37 * 
     38 * Example: 
     39 * <informalexample><programlisting> 
     40 * static void  
     41 * tny_my_mime_part_view_set_save_strategy (TnyMimePartView *self_i, TnySaveStrategy *strat) 
     42 * { 
     43 *      TnyMyMimePartView *self = TNY_MY_MIME_PART_VIEW (self_i); 
     44 *      if (self->save_strategy) 
     45 *            g_object_unref (G_OBJECT (self->save_strategy)); 
     46 *      self->save_strategy = g_object_ref (G_OBJECT (strat)); 
     47 * } 
     48 * static void 
     49 * tny_my_mime_part_view_finalize (TnyMyMimePartView *self) 
     50 * { 
     51 *      if (self->save_strategy)) 
     52 *              g_object_unref (G_OBJECT (self->save_strategy)); 
     53 * } 
     54 * </programlisting></informalexample> 
     55 * 
     56 * <informalexample><programlisting> 
     57 * static void  
     58 * tny_my_mime_part_view_on_save_clicked (TnyMimePartView *self, TnyMimePart *attachment) 
     59 * { 
     60 *     TnyMyMimePartView *self = TNY_MY_MIME_PART_VIEW (self_i); 
     61 *     tny_save_strategy_save (self->save_strategy, attachment); 
     62 * } 
     63 * </programlisting></informalexample> 
     64 * 
     65 * The idea is that devices can have a specific such strategy. For example a 
     66 * strategy that sends it to another computer or a strategy that saves it to 
     67 * a flash disk. However. In the mime part view component, you don't care about 
     68 * that. You only care about the API of the save-strategy interface. 
     69 * 
     70 **/ 
     71void  
     72tny_mime_part_view_set_save_strategy (TnyMimePartView *self, TnySaveStrategy *strategy) 
     73{ 
     74#ifdef DEBUG 
     75        if (!TNY_MIME_PART_VIEW_GET_IFACE (self)->set_save_strategy_func) 
     76                g_critical ("You must implement tny_mime_part_view_set_save_strategy\n"); 
     77#endif 
     78 
     79        TNY_MIME_PART_VIEW_GET_IFACE (self)->set_save_strategy_func (self, strategy); 
     80        return; 
     81} 
     82 
     83/** 
     84 * tny_mime_part_view_is_supported: 
     85 * @self: A #TnyMimePartView instance 
     86 * @part: a #TnyMimePart instance 
     87 * 
     88 * Figures out whether or not the view supports viewing a mime part  
     89 * 
     90 * Return value: Whether or not the view supports viewing this mime-part 
     91 **/ 
     92gboolean  
     93tny_mime_part_view_is_supported (TnyMimePartView *self, TnyMimePart *part) 
     94{ 
     95#ifdef DEBUG 
     96        if (!TNY_MIME_PART_VIEW_GET_IFACE (self)->can_view_func) 
     97                g_critical ("You must implement tny_mime_part_view_is_supported\n"); 
     98#endif 
     99 
     100        TNY_MIME_PART_VIEW_GET_IFACE (self)->can_view_func (self, part); 
     101        return; 
     102} 
    23103 
    24104 
  • trunk/libtinymailui/tny-mime-part-view.h

    r980 r981  
    2525 
    2626#include <tny-mime-part.h> 
     27#include <tny-save-strategy.h> 
    2728 
    2829G_BEGIN_DECLS 
     
    4041        GTypeInterface parent; 
    4142 
     43        void (*set_save_strategy_func) (TnyMimePartView *self, TnySaveStrategy *strategy); 
     44        gboolean (*can_view_func) (TnyMimePartView *self, TnyMimePart *part); 
    4245        void (*view_mime_part_func) (TnyMimePartView *self, TnyMimePart *part); 
    4346        void (*clear_func) (TnyMimePartView *self);  
     
    4649GType tny_mime_part_view_get_type(); 
    4750 
     51void tny_mime_part_view_set_save_strategy (TnyMimePartView *self, TnySaveStrategy *strategy); 
     52gboolean tny_mime_part_view_is_supported (TnyMimePartView *self, TnyMimePart *part); 
     53void tny_mime_part_view_clear (TnyMimePartView *self); 
     54void tny_mime_part_view_set_mime_part (TnyMimePartView *self, TnyMimePart *mime_part); 
     55 
     56 
    4857G_END_DECLS 
    4958