Re: Missing API and API that needs improvements



Hey guys,

I attached the skeleton OO slash interface code for this. It's
unimplemented but a developer, after this, just needs to fill in the
empty method bodies

I'm waiting for opinions on this one before creating a branch (which
would basically imply that I will implement it sooner or later).

I would be extremely interested in help, unit tests (before implementing
it, and since you have the interfaces and contracts now .. you can
implement the unit tests too) and opinions.

Just do this:

cd tinymail/trunk
tar zxvf skeleton.tar.gz
patch -p0 < diff.diff
mv diff.diff ../../
make

You will see some signals errors. Feel free to correct that. Probably
something with the GObject type casting not being correct in the
g_signal_emit stuff anymore. The demo-ui still works because the old
methods haven't yet been replaced nor removed (the implementation
function names for the new API have a different names at this moment).



On Thu, 2006-08-24 at 00:11 +0200, Philip Van Hoof wrote:
> On Wed, 2006-08-23 at 22:40 +0200, Philip Van Hoof wrote:
> 
> Because not a lot people would otherwise study the proposals, I'll give
> code examples of how they would look here:
> 
> > http://tinymail.org/trac/tinymail/wiki/HelpImplementingMissingAPI
> 
> TnyListIface *headers = tny_list_new ();
> foreach selected header
>   tny_list_iface_prepend (headers, header)
> tny_folder_iface_transfer_messages (source_folder, 
> 	destination_folder, headers, TRUE);
> g_object_unref (G_OBJECT (headers));
> tny_folder_iface_expunge (source_folder);
> 
> >  http://tinymail.org/trac/tinymail/wiki/HelpRedesignGettingFolders
> 
> static void
> recurse_folders (TnyFolderStoreIface *folder, query)
> {
>    TnyIteratorIface *iter;
>    TnyListIface *folders = tny_list_iface ();
> 
>    tny_folder_store_iface_get_folders (account, folders, query);
>    iter = tny_list_iface_create_iterator (folders);
> 
>    while (!tny_iterator_iface_is_done (iter))
>    {
>        TnyFolderStoreIface *folder = tny_iterator_iface_current (iter);
>        g_print ("%s\n", tny_folder_iface_get_name (TNY_FOLDER_IFACE (folder)));
>        recurse_folders (folder, query);
>        g_object_unref (G_OBJECT (folder));
>    }
> 
>    g_object_unref (G_OBJECT (iter));
>    g_object_unref (G_OBJECT (folders));
> }
> 
> int main ()
> {
>   g_type_init ();
> 
>   TnyPlatformFactoryIface *platfact = tny_platform_factory_get_instance ();
>   TnyAccountStoreIface *account_store = tny_platform_factory_new_account_store (platfact);
>   TnyListIface *accounts = tny_list_new (); TnyFolderStoryQuery *query;
>   TnyStoreAccountIface *account; TnyIteratorIface *iter;
>   TnyFolderStoreQueryOption options = TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED;
> 
>   options |= TNY_FOLDER_STORE_QUERY_OPTION_UNSUBSCRIBED;
>   query = tny_folder_store_query_new (NULL, options);
> 
>   tny_account_store_get_accounts (account_store, accounts, 
> 	TNY_ACCOUNT_STORE_IFACE_STORE_ACCOUNTS);
>   iter = tny_list_iface_create_iterator (accounts);
>   account = tny_iterator_iface_current (iter);
> 
>   recurse_folders (account, query);
> 
>   g_object_unref (G_OBJECT (account));
>   g_object_unref (G_OBJECT (iter));
>   g_object_unref (G_OBJECT (accounts));
> }
> 
> 
> The idea is to use regular expressions in the tny_folder_store_query_new
> method. For example if the user wants all the folders that begin with
> the letter T:
> 
> TnyFolderStoryQuery *query = tny_folder_store_query_new ("^T.*$", options);
> 
> Another idea:
> 
> TnyFolderStoryQuery *query = tny_folder_store_query_new ();
> 
> options |= TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED;
> options |= TNY_FOLDER_STORE_QUERY_OPTION_REGEX_ON_NAME;
> tny_folder_store_query_add (query, "^T.*$", options);
> options |= TNY_FOLDER_STORE_QUERY_OPTION_REGEX_ON_SUBJECT_HEADERS;
> tny_folder_store_query_add (query, "^Re:.*$", options);
> 
> This would be a query for all folders that begin with T and have
> subjects that start with "Re:". But that last might be total overkill
> (I'm not sure about it yet).
> 
> 
-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be

Attachment: skeleton.tar.gz
Description: application/compressed-tar



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]