[maemo-developers] Fwd: Re: DBUS / EDS Confusion
From: Adam L spycedtx at gmail.comDate: Fri Mar 2 00:42:17 EET 2007
- Previous message: DBUS / EDS Confusion
- Next message: Maemo at Google's Summer of Code 2007?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thursday 01 March 2007 16:21, you wrote: > On Thu, 2007-03-01 at 15:05 -0600, Adam L wrote: > > Here is the offending code, within a static void section linked to a menu > > action: > > [CODE] > > EBook *mybook = e_book_new_from_uri("/home/adam/books/adambook", &err); > > if (mybook == NULL) > > { > > hildon_banner_show_information(GTK_WIDGET(app->window), NULL, > > err->message); } > > [/CODE] > > Note that unless you really want to, you should use > e_book_new_system_addressbook () instead of hard-coding a path. This > way you re-use the existing addressbook. There's a reason for wanting to use other books. But, that aside, this method should still work (in theory). > >From a single line of source it's tricky to debug... can you publish the > > source? There's nothing to the source. It's just a simple app with 2 menu items. #include <gtk/gtk.h> #include <gdk-pixbuf/gdk-pixbuf-core.h> #include <hildon-widgets/hildon-program.h> #include <dbus/dbus-glib-lowlevel.h> #include <libosso.h> #include <libebook/e-book.h> #include <libosso-abook/osso-abook.h> #include <vars.h> static void window_destroy (GtkWidget* widget, gpointer data) { gtk_main_quit(); } static void dump_books(GtkWidget* widget, gpointer data) { AppData *app; GList *contacts, *c; GError *err = NULL; int count; app = data; EBook *mybook = e_book_new_from_uri("/home/adam/books/adambook", &err); if (mybook == NULL) { hildon_banner_show_information(GTK_WIDGET(app->window), NULL, err->message); } /** gboolean created = e_book_open(mybook, FALSE, &err); if (!created) { printf("wasn't able to open the book\n"); } else {printf("opened the book\n");} **/ } int main(int argc, char *argv[]) { GtkWidget *vbox, *label, *button; GtkMenu *menu; GtkMenuItem *item_close; GtkMenuItem *item_nothin; GdkPixbuf *icon; GError *error = NULL; osso_return_t result; appData.context = osso_initialize("ihello", "1.0", FALSE, NULL); if (appData.context == NULL) { printf("context was null\n"); } else { printf("context was good\n"); } gtk_init(&argc, &argv); /* Init abook */ if (!osso_abook_init (&argc, &argv, appData.context)) { g_critical ("Error initializing libosso-abook"); osso_deinitialize (appData.context); return 1; } menu = GTK_MENU(gtk_menu_new()); item_close = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Close app")); item_nothin = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Does nothing in app")); g_signal_connect(G_OBJECT(item_close), "activate", GTK_SIGNAL_FUNC(window_destroy), NULL); g_signal_connect(G_OBJECT(item_nothin), "activate", GTK_SIGNAL_FUNC(dump_books), &appData); gtk_menu_append(menu, GTK_WIDGET(item_close)); gtk_menu_append(menu, GTK_WIDGET(item_nothin)); appData.program = hildon_program_get_instance(); g_set_application_name("application level title"); hildon_program_set_common_menu(appData.program, menu); hildon_program_set_can_hibernate(appData.program, TRUE); mainWindow = HILDON_WINDOW(hildon_window_new()); gtk_widget_set_name(GTK_WIDGET(mainWindow), "main window"); hildon_program_add_window(appData.program, mainWindow); gtk_widget_show_all (GTK_WIDGET(mainWindow)); gtk_main(); osso_deinitialize(appData.context); return 0; } *************** vars.h #include <hildon-widgets/hildon-window.h> /* Application UI data struct */ typedef struct _AppData AppData; struct _AppData { /* View items */ HildonProgram *program; HildonWindow *window; osso_context_t *context; /* Toolbar */ GtkWidget *main_toolbar; /* Find toolbar */ // HildonFindToolbar *find_toolbar; /* Is Find toolbar visible or not */ gboolean find_visible; }; HildonWindow *mainWindow; gboolean windowMax; AppData appData; -------------------------------------------------------
- Previous message: DBUS / EDS Confusion
- Next message: Maemo at Google's Summer of Code 2007?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]