maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   How to see titlename (https://talk.maemo.org/showthread.php?t=33581)

Lullen 2009-10-27 22:29

How to see titlename
 
I currently use the maemo virtual image to develop but I have a problem as I want to use a app menu. I have set the titlename but it refuses to show up. Is there any way to solve this and how?


Yours Lullen

harriva 2009-10-28 00:00

Re: How to see titlename
 
Quote:

Originally Posted by Lullen (Post 359368)
Is there any way to solve this and how?

Show the source code.

Lullen 2009-10-28 04:13

Re: How to see titlename
 
http://maemo.org/api_refs/5.0/5.0-fi...bleWindow.html there you can find it

Andre Klapper 2009-10-28 17:49

Re: How to see titlename
 
That's not source code, that's API documentation, hence the request still stands.

Lullen 2009-10-28 17:53

Re: How to see titlename
 
if you scroll down a bit you see a example, i use the same code for titlebar and window

Code:

static void
show_new_window (void)
{
    GtkWidget *win;

    win = hildon_stackable_window_new ();

    // ... configure new window

    gtk_widget_show (win);
}

int
main (int argc, char **argv)
{
    GtkWidget *win;
    GtkWidget *button;

    gtk_init (&argc, &args);

    win = hildon_stackable_window_new ();
    gtk_window_set_title (GTK_WINDOW (win), "Main window);

    // ... add some widgets to the window

    g_signal_connect (button, "clicked", G_CALLBACK (show_new_window), NULL);
    g_signal_connect (win, "destroy", G_CALLBACK (gtk_main_quit), NULL);

    gtk_widget_show_all (win);
    gtk_main ();

    return 0;
}


qwerty12 2009-10-28 18:00

Re: How to see titlename
 
Where's your source code?

That code won't even compile:
Quote:

gtk_window_set_title (GTK_WINDOW (win), "Main window);

harriva 2009-10-28 18:16

Re: How to see titlename
 
I added hildon-program.h and gtkmain.h includes. Removed show_new_window function and button widget and it's signal_connect. Also fixed gtk_init and that missing quotation mark.
Compiled with gcc -o proggis c.c `pkg-config gtk+-2.0 hildon-1 --cflags --libs` -Wall

Works fine.
I think you are beyond any help.

http://pastebin.com/f56dc402

Lullen 2009-10-28 18:34

Re: How to see titlename
 
Oh I'm sorry! I was sure that I took that code. Btw how comes that there are alot of examples in the API documentation that won't even work? I have always learned new things by example but both hildon and qt are like this! This makes it so much harder to learn this stuff... I have been sitting 50h+ with hildon and qt and because almost all examples are not working I still have no clue about how to do things. For example in qt I have no clue how to make a treeview because I want to make a model and that is not working sice model->setModel() (or how it exactly is) does not even exist and they use it everywhere in the examples.

But now back to topic, I did use a example from the virtual image. The only thing I added is the gtk_window_set_title("kokbok"); But if you think its stupid to learn this instead of Qt(it feels more complete with examples) please tell me or give me a link where I can see how to use hildon with Qt.

Code:

int main(int argc, char *argv[]) {
    HildonProgram *program;
    HildonWindow *window;
    GtkWidget *button;

    /* This is called in all Hildon applications. Arguments are parsed
    * from the command line and are returned to the application. */
    hildon_gtk_init (&argc, &argv);

    /* Get an instance of HildonProgram. It is an object used to represent
    * an application running in the Hildon framework.              */
    program = HILDON_PROGRAM( hildon_program_get_instance () );

    /* Set the program title */
    g_set_application_name("Hello World");

    /* create a new hildon window */
    window = HILDON_WINDOW( hildon_window_new () );
    gtk_window_set_title(GTK_WINDOW(window), "Kokbok");

    /* Registers a window as belonging to the program */
    hildon_program_add_window (program, window);

PS. Where is a good place to learn how things work? As the API documentaion is not reliable

harriva 2009-10-28 19:14

Re: How to see titlename
 
Since you still won't give enough code to properly test it I quess the problem in using both g_set_application_name and gtk_window_set_title with different parameters.

Lullen 2009-10-28 19:45

Re: How to see titlename
 
I thought the application name was different to the window title. But I really start to feel that maemo is not anything for me. I usualy program java and it is so much easier to get going with because the api is correct. I will forget about hildon and try Qt instead. Maybe I should start a new thread but I hope I get some answers here.

Where can I find basic stuff examples about Qt?
What I am trying to make is not that complicated. In the begining it is just a cockbook where I can choose to see recipes of food/drinks and ingredients. And when I choose a recipe I want to see ingredients, a how-to and the price/portion. Of course I want to add new recipes and ingredients in the program. So what I need to learn is how to use:
*listView(or treeView as I read in the pdfs)
*appmenu
*database(some how this seems to be the easiest)

PS Is it the community or nokia that makes the api documentation? Will it get updated?


All times are GMT. The time now is 23:03.

vBulletin® Version 3.8.8