Changeset 1010

Show
Ignore:
Timestamp:
10/16/06 20:45:13
Author:
pvanhoof
Message:

Added documentation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail/tny-account-store.c

    r917 r1010  
    184184 * the unit tests and the normal tests. 
    185185 * 
     186 * Example (that uses a cache): 
     187 * <informalexample><programlisting> 
     188 * static TnyCamelSession *session = NULL; 
     189 * static TnyList *accounts = NULL; 
     190 * static gchar*  
     191 * account_get_pass_func (TnyAccount *account, const gchar *prompt, gboolean *cancel) 
     192 * { 
     193 *      return g_strdup ("the password"); 
     194 * } 
     195 * static void 
     196 * account_forget_pass_func (TnyAccount *account) 
     197 * { 
     198 *      g_print ("Password was incorrect\n"); 
     199 * } 
     200 * static void 
     201 * tny_my_account_store_get_accounts (TnyAccountStore *self, TnyList *list, TnyGetAccountsRequestType types) 
     202 * { 
     203 *    TnyIterator *iter; 
     204 *    if (session == NULL) 
     205 *        session = tny_session_camel_new (TNY_ACCOUNT_STORE (self)); 
     206 *    if (accounts == NULL) 
     207 *    { 
     208 *        accounts = tny_simple_list_new (); 
     209 *        for (... each account ... ) 
     210 *        { 
     211 *           TnyAccount *account = TNY_ACCOUNT (tny_camel_store_account_new ()); 
     212 *           tny_camel_account_set_session (TNY_CAMEL_ACCOUNT (account), session); 
     213 *           tny_account_set_proto (account, "imap"); 
     214 *           tny_account_set_name (account, "account i"); 
     215 *           tny_account_set_user (account, "user of account i"); 
     216 *           tny_account_set_hostname (account, "server.domain of account i"); 
     217 *           tny_account_set_id (account, "i"); 
     218 *           tny_account_set_forget_pass_func (account, account_forget_pass_func); 
     219 *           tny_account_set_pass_func (account, account_get_pass_func); 
     220 *           tny_list_prepend (accounts, account); 
     221 *           g_object_unref (G_OBJECT (account)); 
     222 *        } 
     223 *    } 
     224 *    iter = tny_list_create_iterator (accounts); 
     225 *    while (tny_iterator_is_done (iter)) 
     226 *    { 
     227 *        GObject *cur = tny_iterator_get_current (iter); 
     228 *        tny_list_prepend (list, cur); 
     229 *        g_object_unref (cur); 
     230 *        tny_iterator_next (iter); 
     231 *    } 
     232 *    g_object_unref (G_OBJECT (iter)); 
     233 * } 
     234 * </programlisting></informalexample> 
    186235 **/ 
    187236void 
     
    203252 * @account: the account to add 
    204253 *  
     254 * API WARNING: This API might change 
     255 * 
    205256 * Add a transport account to the store 
    206  *  
    207257 **/ 
    208258void 
     
    224274 * @account: the account to add 
    225275 *  
     276 * API WARNING: This API might change 
     277 *  
    226278 * Add a storage account to the store 
    227  *  
    228279 **/ 
    229280void 
     
    316367                tny_account_store_initialized = TRUE; 
    317368        } 
    318  
    319369        return; 
    320370} 
     
    325375{ 
    326376        static GType type = 0; 
    327  
    328377        if (G_UNLIKELY(type == 0)) 
    329378        { 
     
    345394                g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); 
    346395        } 
    347  
    348396        return type; 
    349397} 
  • trunk/libtinymail/tny-folder-store-query.c

    r1007 r1010  
    4747{ 
    4848        TnyFolderStoreQueryItem *self = (TnyFolderStoreQueryItem*) object; 
    49      
    50         if (self->regex) 
     49        if (self->regex) 
    5150                regfree (self->regex); 
    52      
    5351        item_parent_class->finalize (object); 
    5452} 
     
    5856{ 
    5957        TnyFolderStoreQuery *self = (TnyFolderStoreQuery*) object; 
    60      
    6158        g_object_unref (G_OBJECT (self->items)); 
    62      
    6359        parent_class->finalize (object); 
    64  
    6560        return; 
    6661} 
     
    7065{ 
    7166        GObjectClass *object_class; 
    72  
    7367        object_class = (GObjectClass *)klass; 
    7468        item_parent_class = g_type_class_peek_parent (klass); 
    75  
    7669        object_class->finalize = tny_folder_store_query_item_finalize; 
    77  
    7870        return; 
    7971} 
     
    8375{ 
    8476        GObjectClass *object_class; 
    85  
    8677        object_class = (GObjectClass *)klass; 
    8778        parent_class = g_type_class_peek_parent (klass); 
    88  
    8979        object_class->finalize = tny_folder_store_query_finalize; 
    90  
    9180        return; 
    9281} 
     
    9685{ 
    9786        self->options = 0; 
    98       self->regex = NULL; 
     87      self->regex = NULL; 
    9988        return; 
    10089} 
     
    128117                        NULL 
    129118                }; 
    130  
    131  
    132119                object_type = g_type_register_static (G_TYPE_OBJECT,  
    133120                        "TnyFolderStoreQuery", &object_info, 0); 
    134  
    135  
    136121        } 
    137122 
     
    160145                        NULL 
    161146                }; 
    162  
    163  
    164147                object_type = g_type_register_static (G_TYPE_OBJECT,  
    165148                        "TnyFolderStoreQueryItem", &object_info, 0); 
     
    241224tny_folder_store_query_add_item (TnyFolderStoreQuery *query, const gchar *pattern, TnyFolderStoreQueryOption options) 
    242225{ 
    243       gint er=0; 
     226      gint er=0; 
    244227        gboolean addit=pattern?TRUE:FALSE; 
    245         regex_t *regex = g_new0 (regex_t, 1); 
     228       regex_t *regex = g_new0 (regex_t, 1); 
    246229        gboolean has_regex = FALSE; 
    247      
    248       if (addit) 
     230 
     231      if (addit) 
    249232                er = regcomp (regex, (const char*)pattern, 0); 
    250      
    251233        if (addit && er != 0) 
    252234        { 
     
    255237                g_free (erstr); 
    256238                regfree (regex); 
    257               addit = FALSE; 
    258               regex = NULL; 
     239              addit = FALSE; 
     240              regex = NULL; 
    259241        } else { 
    260               has_regex = TRUE; 
     242              has_regex = TRUE; 
    261243                addit = TRUE; 
    262244        } 
    263      
     245 
    264246        if (addit) 
    265247        { 
    266               TnyFolderStoreQueryItem *add = g_object_new (TNY_TYPE_FOLDER_STORE_QUERY_ITEM, NULL); 
     248              TnyFolderStoreQueryItem *add = g_object_new (TNY_TYPE_FOLDER_STORE_QUERY_ITEM, NULL); 
    267249                add->options = options; 
    268               if (has_regex) 
     250              if (has_regex) 
    269251                        add->regex = regex; 
    270               else add->regex = NULL; 
     252              else add->regex = NULL; 
    271253                tny_list_prepend (query->items, G_OBJECT (add)); 
    272254                g_object_unref (G_OBJECT (add)); 
    273         }     
     255        } 
    274256} 
    275257 
     
    285267tny_folder_store_query_get_items (TnyFolderStoreQuery *query) 
    286268{ 
    287     return g_object_ref (G_OBJECT (query->items)); 
     269       return g_object_ref (G_OBJECT (query->items)); 
    288270} 
    289271 
  • trunk/libtinymail/tny-folder-store.c

    r1006 r1010  
    231231                type = g_type_register_static (G_TYPE_INTERFACE,  
    232232                        "TnyFolderStore", &info, 0); 
    233              
    234             g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); 
     233                g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); 
    235234        } 
    236235 
  • trunk/libtinymail/tny-folder.c

    r1009 r1010  
    7272 * are advised to hide messages that have been marked as being deleted from your 
    7373 * summary view. 
    74  *  
     74 * g 
    7575 * In Gtk+ for the #GtkTreeView component, you can do this using the  
    7676 * #GtkTreeModelFilter tree model filtering model. 
     
    311311 * return value after use. 
    312312 *  
     313 * Example: 
     314 * <informalexample><programlisting> 
     315 * TnyMsgView *message_view = tny_platform_factory_new_msg_view (platfact); 
     316 * TnyFolder *folder = ... 
     317 * TnyHeader *header = ... 
     318 * TnyMsg *message = tny_folder_get_message (folder, header); 
     319 * tny_msg_view_set_msg (message_view, message); 
     320 * </programlisting></informalexample> 
     321 * 
    313322 * Return value: The message instance or NULL on failure 
    314323 * 
  • trunk/libtinymail/tny-fs-stream.c

    r966 r1010  
    2525/* 
    2626 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com> 
    27  *         Michael Zucchi <notzed@ximian.com> 
     27 *          Michael Zucchi <notzed@ximian.com> 
    2828 * 
    2929 * Copyright 1999-2003 Ximian, Inc. (www.ximian.com) 
     
    8585                        { 
    8686                                gssize len = tny_stream_write (output, tmp_buf + nb_written, 
    87                                                                  nb_read - nb_written); 
     87                                          nb_read - nb_written); 
    8888                                if (G_UNLIKELY (len < 0)) 
    8989                                        return -1; 
     
    105105        if ((nread = read (priv->fd, buffer, n)) > 0) 
    106106                priv->offset += nread; 
    107      
    108         if (nread != n) 
     107        if (nread != n) 
    109108                priv->eos = TRUE; 
    110          
    111         if (read (priv->fd, b, 1) != 1) 
     109        if (read (priv->fd, b, 1) != 1) 
    112110                priv->eos = TRUE; 
    113      
     111 
    114112        priv->offset = lseek (priv->fd, priv->offset, SEEK_SET); 
    115      
    116113        return nread; 
    117114 
     
    123120        TnyFsStreamPriv *priv = TNY_FS_STREAM_GET_PRIVATE (self); 
    124121        gssize nwritten; 
    125                  
    126122        if ((nwritten = write (priv->fd, buffer, n)) > 0) 
    127123                priv->offset += nwritten; 
    128          
    129         priv->eos = FALSE; 
    130      
     124        priv->eos = FALSE; 
    131125        return nwritten; 
    132126} 
     
    136130{ 
    137131        TnyFsStreamPriv *priv = TNY_FS_STREAM_GET_PRIVATE (self); 
    138  
    139132        if (close (priv->fd) == -1) 
    140133                return -1; 
    141          
    142134        priv->fd = -1; 
    143  
    144135        return 0; 
    145136} 
     
    158149{ 
    159150        TnyFsStreamPriv *priv = TNY_FS_STREAM_GET_PRIVATE (self); 
    160  
    161151        if (fd == -1) 
    162152                return; 
    163  
    164153        if (priv->fd != -1) 
    165154                close (priv->fd); 
    166  
    167155        priv->fd = fd; 
    168  
    169156        priv->offset = lseek (priv->fd, 0, SEEK_SET); 
    170  
    171157        if (priv->offset == -1) 
    172158                priv->offset = 0; 
    173  
    174159        priv->eos = FALSE; 
    175      
    176160        return; 
    177161} 
     
    198182{ 
    199183        TnyFsStream *self = g_object_new (TNY_TYPE_FS_STREAM, NULL); 
    200  
    201184        tny_fs_stream_set_fd (self, fd); 
    202  
    203185        return TNY_STREAM (self); 
    204186} 
     
    209191        TnyFsStream *self = (TnyFsStream *)instance; 
    210192        TnyFsStreamPriv *priv = TNY_FS_STREAM_GET_PRIVATE (self); 
    211  
    212193        priv->eos = TRUE; 
    213194        priv->fd = -1; 
    214195        priv->offset = 0; 
    215      
    216196        return; 
    217197} 
     
    222202        TnyFsStream *self = (TnyFsStream *)object;       
    223203        TnyFsStreamPriv *priv = TNY_FS_STREAM_GET_PRIVATE (self); 
    224  
    225204        if (priv->fd != -1) 
    226       { 
     205      { 
    227206                fsync (priv->fd); 
    228207                close (priv->fd);             
     
    230209        priv->fd = -1; 
    231210        priv->eos = TRUE; 
    232      
    233211        (*parent_class->finalize) (object); 
    234  
    235212        return; 
    236213} 
     
    254231{ 
    255232        TnyFsStreamPriv *priv = TNY_FS_STREAM_GET_PRIVATE (self); 
    256       priv->offset = lseek (priv->fd, 0, SEEK_SET); 
    257       priv->eos = FALSE; 
     233      priv->offset = lseek (priv->fd, 0, SEEK_SET); 
     234      priv->eos = FALSE; 
    258235        return 0; 
    259236} 
     
    267244        klass->flush_func = tny_fs_flush; 
    268245        klass->is_eos_func = tny_fs_is_eos; 
    269  
    270246        klass->read_func = tny_fs_stream_read; 
    271247        klass->write_func = tny_fs_stream_write; 
     
    283259        parent_class = g_type_class_peek_parent (class); 
    284260        object_class = (GObjectClass*) class; 
    285  
    286261        object_class->finalize = tny_fs_stream_finalize; 
    287  
    288262        g_type_class_add_private (object_class, sizeof (TnyFsStreamPriv)); 
    289263 
  • trunk/libtinymail/tny-header.c

    r900 r1010  
    3030 *  
    3131 * Set the reply-to header 
    32  *  
    3332 **/ 
    3433void 
  • trunk/libtinymail/tny-list.c

    r965 r1010  
    349349                  0, 
    350350                  0,      /* n_preallocs */ 
    351                   NULL,    /* instance_init */ 
     351                  NULL,   /* instance_init */ 
    352352                  NULL 
    353353                }; 
  • trunk/libtinymail/tny-mime-part.c

    r940 r1010  
    4141 *      if (tny_mime_part_is_attachment (part)) 
    4242 *      { 
    43  *              g_print ("Found an attachment (%s)\n", 
    44  *                     tny_mime_part_get_filename (part)); 
     43 *          g_print ("Found an attachment (%s)\n", 
     44 *               tny_mime_part_get_filename (part)); 
    4545 *      } 
    4646 *      g_object_unref (G_OBJECT (part)); 
     
    465465                  NULL 
    466466                }; 
    467  
    468467                type = g_type_register_static (G_TYPE_INTERFACE, 
    469468                        "TnyMimePart", &info, 0); 
    470  
    471                 /* g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); */ 
    472469        } 
    473470 
  • trunk/libtinymail/tny-simple-list.c

    r965 r1010  
    8080 
    8181        g_mutex_lock (priv->iterator_lock); 
    82  
    8382        priv->first = g_list_remove (priv->first, item); 
    8483        g_object_unref (G_OBJECT (item)); 
    85  
    8684        g_mutex_unlock (priv->iterator_lock); 
    8785 
     
    9997{ 
    10098        TnySimpleList *copy = g_object_new (TNY_TYPE_SIMPLE_LIST, NULL); 
    101  
    10299        TnySimpleListPriv *priv = TNY_SIMPLE_LIST_GET_PRIVATE (self); 
    103100        TnySimpleListPriv *cpriv = TNY_SIMPLE_LIST_GET_PRIVATE (copy); 
     
    176173        object_class = (GObjectClass *)klass; 
    177174        parent_class = g_type_class_peek_parent (klass); 
    178  
    179175        object_class->finalize = tny_simple_list_finalize; 
    180  
    181176        g_type_class_add_private (object_class, sizeof (TnySimpleListPriv)); 
    182177 
     
    237232 
    238233                object_type = g_type_register_static (G_TYPE_OBJECT,  
    239                                                "TnySimpleList", &object_info, 0); 
     234                                "TnySimpleList", &object_info, 0); 
    240235 
    241236                g_type_add_interface_static (object_type, TNY_TYPE_LIST, 
    242                                              &tny_list_info); 
     237                                        &tny_list_info); 
    243238 
    244239        } 
  • trunk/libtinymail/tny-store-account.c

    r900 r1010  
    2929 * @folder: The folder to unsubscribe from 
    3030 * 
    31  * WARNING: This API might soon change 
     31 * API WARNING: This API might change 
    3232 * 
    3333 * Unsubscribe from a folder 
     
    5151 * @folder: The folder to subscribe to 
    5252 * 
    53  * WARNING: This API might soon change 
     53 * API WARNING: This API might change 
    5454 * 
    5555 * Subscribe to a folder 
     
    104104 
    105105                g_type_interface_add_prerequisite (type, TNY_TYPE_ACCOUNT); 
    106               g_type_interface_add_prerequisite (type, TNY_TYPE_FOLDER_STORE); 
     106              g_type_interface_add_prerequisite (type, TNY_TYPE_FOLDER_STORE); 
    107107        } 
    108108 
  • trunk/libtinymail/tny-stream.c

    r966 r1010  
    209209                type = g_type_register_static (G_TYPE_INTERFACE,  
    210210                        "TnyStream", &info, 0); 
    211  
    212                 /* g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); */ 
    213211        } 
    214212 
  • trunk/libtinymailui/tny-mime-part-saver.c

    r1003 r1010  
    4747 * { 
    4848 *      if (self->save_strategy)) 
    49  *             g_object_unref (G_OBJECT (self->save_strategy)); 
     49 *          g_object_unref (G_OBJECT (self->save_strategy)); 
    5050 * } 
    5151 * </programlisting></informalexample> 
  • trunk/libtinymailui/tny-mime-part-view.c

    r1002 r1010  
    2323 
    2424 
    25  
    2625/** 
    2726 * tny_mime_part_view_clear: 
     
    4241 
    4342        TNY_MIME_PART_VIEW_GET_IFACE (self)->clear_func (self); 
    44         return;     
     43        return; 
    4544} 
    4645 
     
    8079 * @mime_part to the user.  
    8180 * 
     81 * Example: 
     82 * <informalexample><programlisting> 
     83 * static void  
     84 * tny_gtk_text_mime_part_view_set_part (TnyMimePartView *self, TnyMimePart *part) 
     85 * { 
     86 *      if (part) 
     87 *      { 
     88 *           GtkTextBuffer *buffer; 
     89 *           TnyStream *dest; 
     90 *           buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self)); 
     91 *           if (buffer &amp;&amp; GTK_IS_TEXT_BUFFER (buffer)) 
     92 *                gtk_text_buffer_set_text (buffer, "", 0); 
     93 *           dest = tny_gtk_text_buffer_stream_new (buffer); 
     94 *           tny_stream_reset (dest); 
     95 *           tny_mime_part_decode_to_stream (part, dest); 
     96 *           tny_stream_reset (dest); 
     97 *           g_object_unref (G_OBJECT (dest)); 
     98 *      } 
     99 * } 
     100 * </programlisting></informalexample> 
    82101 **/ 
    83102void 
  • trunk/libtinymailui/tny-msg-view.c

    r1002 r1010  
    8383 *     } 
    8484 *     if (!retval) 
    85  *             retval = TNY_MOZ_EMBED_MSG_VIEW_GET_CLASS (self)->create_mime_part_view_for_orig_func (self, part); 
     85 *         retval = TNY_MOZ_EMBED_MSG_VIEW_GET_CLASS (self)->create_mime_part_view_for_orig_func (self, part); 
    8686 *     return retval; 
    8787 * } 
  • trunk/tests/shared/account-store.c

    r949 r1010  
    7373{ 
    7474        TnyTestAccountStore *me = (TnyTestAccountStore*) self; 
    75      
     75 
    7676        if (me->cache_dir == NULL) 
    7777        { 
     
    8181                        gchar *attempt = g_strdup_printf ("tinymail.%d", att); 
    8282                        gchar *str = g_build_filename (g_get_tmp_dir (), attempt, NULL); 
    83                         g_free (attempt);                   
    84                       dir = g_dir_open (str, 0, NULL); 
     83                        g_free (attempt); 
     84                      dir = g_dir_open (str, 0, NULL); 
    8585                        if (dir) 
    86                       { 
     86                      { 
    8787                                g_dir_close (dir); 
    8888                                g_free (str); 
     
    100100tny_test_account_store_get_accounts (TnyAccountStore *self, TnyList *list, TnyGetAccountsRequestType types) 
    101101{ 
    102         TnyTestAccountStore *me = (TnyTestAccountStore *) self; 
    103      
     102        TnyTestAccountStore *me = (TnyTestAccountStore *) self; 
    104103        TnyAccount *account = TNY_ACCOUNT (tny_camel_store_account_new ()); 
    105      
     104 
    106105        /* Dear visitor of the SVN-web. This is indeed a fully functional and 
    107106           working IMAP account. This does not mean that you need to fuck it up */ 
     
    110109        camel_session_set_online ((CamelSession*)me->session, me->force_online);  
    111110        tny_camel_account_set_online_status (TNY_CAMEL_ACCOUNT (account), !me->force_online); 
    112      
     111 
    113112        tny_account_set_proto (account, "imap"); 
    114113        tny_account_set_name (account, "unit test account"); 
     
    121120        tny_list_prepend (list, (GObject*)account); 
    122121        g_object_unref (G_OBJECT (account)); 
    123      
    124         return;         
     122 
     123        return; 
    125124} 
    126125 
     
    136135                if (self->cache_dir) 
    137136                        g_free (self->cache_dir); 
    138                      
    139137                self->cache_dir = g_strdup (cachedir); 
    140138        } 
    141      
     139 
    142140        self->session = tny_session_camel_new (TNY_ACCOUNT_STORE (self)); 
    143       self->force_online = force_online; 
    144  
    145       if (self->force_online) 
     141      self->force_online = force_online; 
     142 
     143      if (self->force_online) 
    146144                tny_device_force_online (self->device); 
    147       else 
     145      else 
    148146                tny_device_force_offline (self->device); 
    149      
     147 
    150148        return TNY_ACCOUNT_STORE (self); 
    151149} 
     
    159157 
    160158        self->device = tny_platform_factory_new_device (platfact); 
    161          
    162      
     159 
    163160        return; 
    164161} 
  • trunk/tests/shared/account-store.h

    r900 r1010  
    4242{ 
    4343        GObject parent; 
    44      
     44 
    4545        gchar *cache_dir; 
    46       TnySessionCamel *session; 
    47       TnyDevice *device; 
    48       gboolean force_online; 
     46      TnySessionCamel *session; 
     47      TnyDevice *device; 
     48      gboolean force_online; 
    4949}; 
    5050