Re: how to display initial information of program

2011-06-22 Thread Bill C

Hi Jh

What language are you writing in? I can help in C (5+ years with GTK) 
and PyGtk.. just started using it.


Be aware that once gtk_main() has been called everything must be done by 
callbacks. Anything else will cause subtle faults, although it may 
appear to work.


The gtk_main loop controls everything until you exit the program

Rgds Bill+


On 22/06/11 14:24, jh_wang2004 wrote:

Hello Bill:
Thanks a lot for you answer, i'm new to GTK indeed??and please forgive 
my poor English.

Maybe I did not clearly express the intent.
My app display a login dialog at first, when user clicks button, it 
connects database, after connection established,
it destroy login dialog, then build GIOChannel , enroll some timeout 
callbcak function,initial video compression card's four channel etc.,

after these have been done, shows main window and enter mainloop.
I want to display these message before main window shows, because it 
is relatively time-consuming.
Maybe i shall use gtkprogressbar, but i can't refresh it using timeout 
function, for it didn't enter mainloop at that time,
so i intend to display those message by using a bolderless window 
container, i don't know how to realize that.

Can you give me some tips?
Regars



At 2011-06-22 06:29:21??Bill Cbi...@netspace.net.au  wrote:

On 22/06/11 01:16, jh_wang2004 wrote:
  hi all:
  In my app program initialization, it connects database, initializes SDL 
video channel,etc .
  these actions have been done before gtk mainloop,
  i want to display these  initial message to user, and destroy the widget 
after initialization has been done, which widget shall i use?
  I try to use gtkdialog without button, but it seems prevents 
theFollow-upinstructions??for that wait for response.
  
  Regards
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
I assume you are new to GTK.

So try displaying the data on the screen with a button, which when
clicked destroys the fields you dont want.

Alternatively have an Details button which allows the user to see this
information.

As they say, many ways to kill a cat (English expression; maybe they
don't kill cats in your country)

A modal dialog without a button should prevent any user corrupting the
system, but is not normally used. Ideal for use by government employees
when security is absolutely important.

Rgds Bill




___
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 display initial information of program

2011-06-22 Thread Just Fill Bugs



On 22/06/11 14:24, jh_wang2004 wrote:

Hello Bill:
Thanks a lot for you answer, i'm new to GTK indeed??and please forgive
my poor English.
Maybe I did not clearly express the intent.
My app display a login dialog at first, when user clicks button, it
connects database, after connection established,
it destroy login dialog, then build GIOChannel , enroll some timeout
callbcak function,initial video compression card's four channel etc.,
after these have been done, shows main window and enter mainloop.
I want to display these message before main window shows, because it
is relatively time-consuming.


What you want to do is to arrange everything around the mainloop:

1. Show the login dialog.

2. start mainloop.

3. Accept user login and start doing database stuff, video stuff in a 
callback of the login dialog. You could also show a progress window 
before doing the database stuff...


4. once the callback has done its work, hide the progress window and 
show the main window at the end of the callback function.


see, you enter main loop pretty early.

Normally, if you want to start something after the GUI is shown, you 
should use a idle_add() function to start your stuff in the callback, 
before the main loop is called. Then the idled callback will be called 
once the mainloop start running and the GUI is shown.




Maybe i shall use gtkprogressbar, but i can't refresh it using timeout
function, for it didn't enter mainloop at that time,
so i intend to display those message by using a bolderless window
container, i don't know how to realize that.
Can you give me some tips?


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Changing a GtkToolButton icon_widget on the fly

2011-06-22 Thread James Morris
On 22 June 2011 05:43, James jamesstew...@optusnet.com.au wrote:
 Hi,

 I've been trying to change the icon_widget that's displayed for a
 toolbar button while the main window is displayed.  I can't seem to get
 the actual image to change, although the functions that call
 gtk_tool_button_set_icon_widget(0 do get called.  There's no warnings
 either.

 I do something like...

 GtkWidget *eject_widget;
 GtkWidget *eject_red_widget;
 GtkToolButton *eject_button;

 void green(void)
 {
        gtk_tool_button_set_icon_widget(eject_button, eject_widget);
 }

 void red(void)
 {
        gtk_tool_button_set_icon_widget(eject_button, eject_red_widget);
 }


 int main(int argc, char **argv)
 {
 snip
        GtkBuilder *builder;

        builder = gtk_builder_new();
        gtk_builder_add_from_file(builder, stridemaster.xml, NULL);

        eject_widget = GTK_WIDGET(gtk_builder_get_object(builder,
 eject_tracker_image));
        eject_red_widget = GTK_WIDGET(gtk_builder_get_object(builder,
 eject_tracker_red_image));
        eject_button = GTK_TOOL_BUTTON(gtk_builder_get_object(builder,
 toolbutton_eject_tracker));

        g_object_unref(G_OBJECT(builder));

        gtk_widget_show(window);

        gtk_main();

 snip
 }

 What am I missing?

The problem might be to do with floating versus fixed references. GTK
will usually unreference the images once it thinks they're finished
with - ie when you change the icon, it will think you no longer wish
to use the previous icon.

Try calling g_object_ref_sink on all of the widget icons once you've
created them, and then g_object_unref after you're done.

James.



 Regards,
 James.

 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list