Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex > iRex Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-13-2008, 08:36 AM   #1
Olivier78180
Junior Member
Olivier78180 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2008
Device: iliad
[ILIAD]GTK developpement

Hello.
I'm a new iliad user and i have to develop a small application.

I have some problems to execute anything on iLiad.

In fact it is running with success if i launch the gtk with console application as mxrvt. but if i try to execute it directly with a script in content listener, it never go on....

i tried with one very simple code..

Code:
#include <stdlib.h>
#include <gtk/gtk.h>

void on_activate_entry(GtkWidget *pEntry, gpointer data);
void on_copier_button(GtkWidget *pButton, gpointer data);

int main(int argc, char **argv)
{
    GtkWidget *pWindow;
    GtkWidget *pVBox;
    GtkWidget *pEntry;
    GtkWidget *pButton;
    GtkWidget *pLabel;

    gtk_init(&argc, &argv);

    pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(pWindow), "Le widget GtkEntry");
    gtk_window_set_default_size(GTK_WINDOW(pWindow), 320, 200);
    g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);

    pVBox = gtk_vbox_new(TRUE, 0);
    gtk_container_add(GTK_CONTAINER(pWindow), pVBox);

    /* Creation du GtkEntry */
    pEntry = gtk_entry_new();
    /* Insertion du GtkEntry dans la GtkVBox */
    gtk_box_pack_start(GTK_BOX(pVBox), pEntry, TRUE, FALSE, 0);

    pButton = gtk_button_new_with_label("Copier");
    gtk_box_pack_start(GTK_BOX(pVBox), pButton, TRUE, FALSE, 0);

    pLabel = gtk_label_new(NULL);
    gtk_box_pack_start(GTK_BOX(pVBox), pLabel, TRUE, FALSE, 0);

    /* Connexion du signal "activate" du GtkEntry */
    g_signal_connect(G_OBJECT(pEntry), "activate", G_CALLBACK(on_activate_entry), (GtkWidget*) pLabel);

    /* Connexion du signal "clicked" du GtkButton */
    /* La donnee supplementaire est la GtkVBox pVBox */
    g_signal_connect(G_OBJECT(pButton), "clicked", G_CALLBACK(on_copier_button), (GtkWidget*) pVBox);

    gtk_widget_show_all(pWindow);

    gtk_main();

    return EXIT_SUCCESS;
}

/* Fonction callback execute lors du signal "activate" */
void on_activate_entry(GtkWidget *pEntry, gpointer data)
{
    const gchar *sText;

    /* Recuperation du texte contenu dans le GtkEntry */
    sText = gtk_entry_get_text(GTK_ENTRY(pEntry));

    /* Modification du texte contenu dans le GtkLabel */
    gtk_label_set_text(GTK_LABEL((GtkWidget*)data), sText);
}

/* Fonction callback executee lors du signal "clicked" */
void on_copier_button(GtkWidget *pButton, gpointer data)
{
    GtkWidget *pTempEntry;
    GtkWidget *pTempLabel;
    GList *pList;
    const gchar *sText;

    /* Recuperation de la liste des elements que contient la GtkVBox */
    pList = gtk_container_get_children(GTK_CONTAINER((GtkWidget*)data));

    /* Le premier element est le GtkEntry */
    pTempEntry = GTK_WIDGET(pList->data);

    /* Passage a l element suivant : le GtkButton */
    pList = g_list_next(pList);

    /* Passage a l element suivant : le GtkLabel */
    pList = g_list_next(pList);

    /* Cet element est le GtkLabel */
    pTempLabel = GTK_WIDGET(pList->data);

    /* Recuperation du texte contenu dans le GtkEntry */
    sText = gtk_entry_get_text(GTK_ENTRY(pTempEntry));

    /* Modification du texte contenu dans le GtkLabel */
    gtk_label_set_text(GTK_LABEL(pTempLabel), sText);

    /* Liberation de la memoire utilisee par la liste */
    g_list_free(pList);
}
And the launcher script...
Code:
scriptdir=`/usr/bin/dirname $0`
cd $scriptdir
./test
Thanks
Olivier78180 is offline   Reply With Quote
Old 07-13-2008, 06:44 PM   #2
-Thomas-
Addict
-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.-Thomas- once ate a cherry pie in a record 7 seconds.
 
-Thomas-'s Avatar
 
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
I can't try it at the moment, but you might try to change the test script to
Code:
scriptdir=`/usr/bin/dirname $0`
cd $scriptdir
./test > output.log 2> error.log
This redirects output and error messages to log files which might point you into the right direction.
-Thomas- is offline   Reply With Quote
Old 07-14-2008, 02:40 AM   #3
Max
Connoisseur
Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.
 
Max's Avatar
 
Posts: 79
Karma: 380
Join Date: Mar 2008
Location: Girona, Spain
Device: iLiad, DR1000s
the script I'm using is this:

export DISPLAY=:0
export scriptdir=`/usr/bin/dirname $0`
cd $scriptdir
./iViewer fma83_00.jpg

I adapted the mxrvt run.sh
Max is offline   Reply With Quote
Old 07-14-2008, 06:34 AM   #4
Olivier78180
Junior Member
Olivier78180 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2008
Device: iliad
Hello

Thanks for your answer.

Thomas => I tried this solution to redirect errror message. But i have not any.

In fact the application is launch and i have the bottom screen progressing bar but it stand in this state and nerver go on.
I have to kill the process manually.

Max => I tried too with the same script as you but i have the same result.

This is strange cause if i start the gtk with mxrvt it is ok and fast.

Is there any rules to follow in the C source ?

Thanks.
Olivier78180 is offline   Reply With Quote
Old 07-14-2008, 08:46 AM   #5
Max
Connoisseur
Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.
 
Max's Avatar
 
Posts: 79
Karma: 380
Join Date: Mar 2008
Location: Girona, Spain
Device: iLiad, DR1000s
hi, I'm new in programing in Iliad, but it seams that you don't refresh the display (ereaders needs a particular refresh, dmDisplay in erdm.h)

this thread speaks about it:

http://www.mobileread.com/forums/sho...highlight=erdm

edit:

ipdf thoes

#include <liberdm/display.h>

dmDisplay(dmCmdPriorUrgent, dmQFull);

Last edited by Max; 07-14-2008 at 09:00 AM.
Max is offline   Reply With Quote
Old 07-14-2008, 09:56 AM   #6
wallcraft
reader
wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.
 
wallcraft's Avatar
 
Posts: 6,979
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3 and Fire
Are you using the patched libX11 so that x programs refresh the screen automatically when executed in the iliad? This may require setting up a LD_LIBRARY_PATH. One reference to this is in the mrxvt thread here. Note that you may require a liad_refresh.conf .
wallcraft is offline   Reply With Quote
Old 07-14-2008, 01:46 PM   #7
Olivier78180
Junior Member
Olivier78180 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2008
Device: iliad
Hello

Max => A refresh problem is possible.
But i'm used to refresh the screen by using bouton or virtual keyboard. This solution is ok when i launch with mxrvt or when i launch the application by a script called in ssh.

wallcraft => Thanks, i didn't know that a patched libX11 exist.


Thanks all.
I will keep news on this post.
Olivier78180 is offline   Reply With Quote
Old 07-14-2008, 05:22 PM   #8
Max
Connoisseur
Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.
 
Max's Avatar
 
Posts: 79
Karma: 380
Join Date: Mar 2008
Location: Girona, Spain
Device: iLiad, DR1000s
I'll be waiting for your news, I'm completly lost

BTW. I found that the busy led on the iliad starts blinking when you execute gtk_main, also the progress bars moves (your GtkWindows usualy hides this).
Max is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
iLiad Applying DR GTK+ patches to iLiad ericshliao iRex Developer's Corner 16 03-14-2010 05:39 AM
iLiad Compile GTK application on Iliad. Help vschmidt iRex Developer's Corner 9 11-25-2008 01:49 AM
iLiad Compiling GTK apps for iliad rudysplif iRex Developer's Corner 3 03-17-2008 12:59 PM
iLiad What if iLiad adopts GTK on DirectFB? ericshliao iRex Developer's Corner 1 01-26-2008 05:36 AM
iLiad Need help getting started with gtk tribble iRex Developer's Corner 4 06-05-2007 12:38 PM


All times are GMT -4. The time now is 07:41 AM.


MobileRead.com is a privately owned, operated and funded community.