| 1 |
/* tinymail - Tiny Mail |
| 2 |
* Copyright (C) 2006-2008 Philip Van Hoof <pvanhoof@gnome.org> |
| 3 |
* |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This library is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with self library; if not, write to the |
| 16 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 |
* Boston, MA 02110-1301, USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <config.h> |
| 21 |
#include <libintl.h> |
| 22 |
#include <gtk/gtk.h> |
| 23 |
|
| 24 |
#include <tny-account-store-view.h> |
| 25 |
#include <tny-platform-factory.h> |
| 26 |
|
| 27 |
#if PLATFORM==1 |
| 28 |
#include <tny-gnome-platform-factory.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
#if PLATFORM==3 |
| 32 |
#include <tny-gpe-platform-factory.h> |
| 33 |
#endif |
| 34 |
|
| 35 |
#if PLATFORM==4 |
| 36 |
#include <tny-olpc-platform-factory.h> |
| 37 |
#endif |
| 38 |
|
| 39 |
#include <tny-demoui-summary-view.h> |
| 40 |
|
| 41 |
/** |
| 42 |
* main: |
| 43 |
* @argc: Amount of arguments |
| 44 |
* @argv: The arguments |
| 45 |
* |
| 46 |
* Main entry point of the application |
| 47 |
* |
| 48 |
* Return value: application return value (0 on success) |
| 49 |
**/ |
| 50 |
int |
| 51 |
main (int argc, char **argv) |
| 52 |
{ |
| 53 |
GtkWidget *view = NULL, *window = NULL; |
| 54 |
TnyPlatformFactory *platfact; |
| 55 |
GOptionContext *context; |
| 56 |
TnyAccountStore *account_store; |
| 57 |
|
| 58 |
context = g_option_context_new (" - libtinymail demo application"); |
| 59 |
g_option_context_add_group (context, gtk_get_option_group (TRUE)); |
| 60 |
g_option_context_parse (context, &argc, &argv, NULL); |
| 61 |
|
| 62 |
if (!g_thread_supported ()) |
| 63 |
g_thread_init (NULL); |
| 64 |
gdk_threads_init (); |
| 65 |
|
| 66 |
gdk_threads_enter (); |
| 67 |
|
| 68 |
gtk_init (&argc, &argv); |
| 69 |
|
| 70 |
bindtextdomain(GETTEXT_PACKAGE, TNY_LOCALE_DIR); |
| 71 |
|
| 72 |
#if PLATFORM==1 |
| 73 |
platfact = tny_gnome_platform_factory_get_instance (); |
| 74 |
#endif |
| 75 |
|
| 76 |
#if PLATFORM==3 |
| 77 |
platfact = tny_gpe_platform_factory_get_instance (); |
| 78 |
#endif |
| 79 |
|
| 80 |
#if PLATFORM==4 |
| 81 |
platfact = tny_olpc_platform_factory_get_instance (); |
| 82 |
#endif |
| 83 |
|
| 84 |
view = GTK_WIDGET (tny_demoui_summary_view_new ()); |
| 85 |
|
| 86 |
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
| 87 |
gtk_window_set_title (GTK_WINDOW (window), "Demo ui"); |
| 88 |
|
| 89 |
gtk_container_add (GTK_CONTAINER (window), view); |
| 90 |
|
| 91 |
account_store = tny_platform_factory_new_account_store (platfact); |
| 92 |
tny_account_store_view_set_account_store ( |
| 93 |
TNY_ACCOUNT_STORE_VIEW (view), account_store); |
| 94 |
g_object_unref (G_OBJECT (account_store)); |
| 95 |
|
| 96 |
g_signal_connect (window, "destroy", |
| 97 |
G_CALLBACK (gtk_main_quit), 0); |
| 98 |
|
| 99 |
gtk_widget_show (view); |
| 100 |
gtk_widget_show (window); |
| 101 |
|
| 102 |
gtk_main(); |
| 103 |
|
| 104 |
gdk_threads_leave (); |
| 105 |
|
| 106 |
return 0; |
| 107 |
} |