Re: strangeness of g_signal_connect
Colossus <[EMAIL PROTECTED]> writes: > Annamalai Gurusami wrote: > >> g_signal_connect( G_OBJECT(AddFile_button), "clicked", >> G_CALLBACK(on_add_files_activate), "dummy"); >> The actual parameters of the callback function is determined by the >> event and the widget handling the event. Here you are handling the >> "clicked" event for a GtkButton. And for this event, the prototype of >> the callback handler is > > I just tried to replace gpointer with G_OBJECT but nothing to do, the > value dummy is never received by the function. I must use two > parameters and get rid of the first one to receive the value dummy. You took two *separate* comments, joined it together, and now complaining that my "suggestion" didn't work!! Funny! :-D What I was suggesting is that g_signal_connect( G_OBJECT(AddFile_button), "clicked", G_CALLBACK(on_add_files_activate), "dummy"); is better than g_signal_connect( (gpointer)AddFile_button, "clicked", G_CALLBACK(on_add_files_activate), "dummy"); because G_OBJECT does some type checking. This has nothing to do with the semantics of callback functions. Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: strangeness of g_signal_connect
Colossus <[EMAIL PROTECTED]> writes: > In my app I have the following: > > g_signal_connect ((gpointer) AddFile_button, "clicked", > G_CALLBACK (on_add_files_activate), > "dummy"); I normally write the above call like this: g_signal_connect( G_OBJECT(AddFile_button), "clicked", G_CALLBACK(on_add_files_activate), "dummy"); Are both correct? Which is the preferred way to do it? > I have noticed that if the function "on_add_files_activate" is > declared with only one parameter, gpointer data , I never receive > the word dummy. Instead if the same function is declared with two > parameters: > > void on_add_files_activate ( GtkWidget *useless , gpointer data); > I can successfull print the value "dummy" pointed by data. > > Could gtk developers explain this strange behaviour please ? The actual parameters of the callback function is determined by the event and the widget handling the event. Here you are handling the "clicked" event for a GtkButton. And for this event, the prototype of the callback handler is void user_function(GtkButton *button, gpointer user_data); http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html#GtkButton-clicked You can use it or not, but you cannot change their order or add more arguments. Maybe others can add more information on this. Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Unknown number of columns in a GtkListStore
Razvan Gavril <[EMAIL PROTECTED]> writes: > I want to display the results of a user entered sql query in a GtkTreeView > (List). The only problem that i have is the the number of columns in the > list is only known at runtime (no of cols returned by sql query). How can i > create a GtkListStore with a dynamic number of columns ? Doesn't this meet your needs? http://developer.gnome.org/doc/API/2.0/gtk/GtkListStore.html#gtk-list-store-newv (begin-quote) GtkListStore* gtk_list_store_newv (gint n_columns, GType *types); Non-vararg creation function. Used primarily by language bindings. n_columns : number of columns in the list store types : an array of GType types for the columns, from first to last Returns : a new GtkListStore (end-quote) Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to control one GTK application by another
"sripurna mutalik" <[EMAIL PROTECTED]> writes: > By control i mean i want to access all the facilities in B from > A. Facilities such as pushing buttons, filling text area by some > text and even starting and closing of that application. Is there > any way of doing this. You must be looking for writing something like XRunner (or WinRunner) for GUI automation. If that is correct, then you might be interested in this http://www.gnu.org/software/xnee/ Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: text_view + vscrollbar communication
David Morse <[EMAIL PROTECTED]> writes: > How do I make a gtk_text_view react to a gtk_scrollbar? I am not sure what you want to achieve. But by putting the GtkTextView inside a GtkScrolledWindow, you get a text view in which you can do the scrolling. Is that what you want? GtkTextView *text_view = gtk_text_view_new(); GtkScrolledWindow *scroll = gtk_scrolled_window_new(NULL, NULL); gtk_container_add( GTK_CONTAINER(scroll), text_view ); Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Removing One Page from GtkNotebook
Tristan Van Berkom <[EMAIL PROTECTED]> writes: > Annamalai Gurusami wrote: >> Hello All, >> In my GTK+ application, I am having a GtkNotebook. I am adding one >> page, with a GtkScrolledWindow as a child, and a GtkHBox as a label. >> I remove this page from GtkNotebook. My question is when I remove >> this page from GtkNotebook, are the child widgets destroyed? > > If you dont have an explicit reference to the widget in the page > (i.e. the page) then the widget and its children are destroyed. Is this some kind of garbage collection technique that GTK uses? Can you comment w.r.t the code snippet here? Especially, is the second call to 'gtk_notebook_append_page' valid? I see that the widgets 'scroll' and 'hbox' can be considered as explicit reference to the widgets in the notebook page that I am adding. GtkWidget* notebook = gtk_notebook_new(); GtkWidget* scroll = gtk_scrolled_window_new(NULL, NULL); GtkWidget* hbox = gtk_hbox_new(FALSE, 0); gint idx = gtk_notebook_append_page ( GTK_NOTEBOOK(notebook), scroll, hbox); gtk_notebook_remove_page( GTK_NOTEBOOK(notebook), idx); // After the above sequence of operations, is the below line // valid. Are 'scroll' and 'hbox' still valid? Or are they // destroyed by 'gtk_notebook_remove_page'? gint idx = gtk_notebook_append_page ( GTK_NOTEBOOK(notebook), scroll, hbox); > See: > http://developer.gnome.org/doc/API/2.0/gtk/GtkObject.html > (desctiption section) for an interesting discussion on > reference counting in GTK+. > Oops. Maybe I should have replied after reading the above URL. Thanks for pointing it out. I'll be reading it now. Thank you for your time. Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GTK_STOCK_CLOSE Button Without Label
Tristan Van Berkom <[EMAIL PROTECTED]> writes: > In 2.4 I guess you can simply: > > button = gtk_button_new (); > image = gtk_image_new_from_stock (...); > gtk_container_add (GTK_CONTAINER (button), image); Thank you very much. This is exactly what I wanted. I actually didn't know about GtkImage. Now I know, and I am happy to have subscribed to this mailing list. Its quite useful. Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Removing One Page from GtkNotebook
Hello All, In my GTK+ application, I am having a GtkNotebook. I am adding one page, with a GtkScrolledWindow as a child, and a GtkHBox as a label. I remove this page from GtkNotebook. My question is when I remove this page from GtkNotebook, are the child widgets destroyed? Here is a sample code snippet. GtkWidget* notebook = gtk_notebook_new(); GtkWidget* scroll = gtk_scrolled_window_new(NULL, NULL); GtkWidget* hbox = gtk_hbox_new(FALSE, 0); gint idx = gtk_notebook_append_page ( GTK_NOTEBOOK(notebook), scroll, hbox); gtk_notebook_remove_page( GTK_NOTEBOOK(notebook), idx); // After the above sequence of operations, is the below line // valid. Are 'scroll' and 'hbox' still valid? Or are they // destroyed by 'gtk_notebook_remove_page'? gint idx = gtk_notebook_append_page ( GTK_NOTEBOOK(notebook), scroll, hbox); Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GTK_STOCK_CLOSE Button Without Label
Hi All. Currently I am working on a GTK+ application which contains a GtkNotebook. The pages for a GtkNotebook will be added and removed/hidden dynamically. To allow the end user to close tabs, I am adding button to the title or label portion of the GtkNotebook. I would like to use the stock button GTK_STOCK_CLOSE for this purpose. And I don't want any "Close" word displayed on that button. What to do for this? (Similar to Galeon.) I am using gtk version 2.4.3. Rgds, anna -- Open Movie: Not only will the project be realized with Open Source/Free Software, but also the resulting movie will be published under an open public license. This makes it an exciting premiere as first ever "Open Movie" project! [ http://orange.blender.org ] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list