Re: Gtk Dialog box causing application to crash

2008-08-07 Thread Simon Budig
Jussi Kukkonen ([EMAIL PROTECTED]) wrote:
> * gtk_dialog_run() makes the dialog modal, so you can't use several
>   dialogs at once. You'll have to connect to the "respose" signal and
>   and show the widget yourself.

The dialog is not necessarily modal, if you want modal behaviour add
"GTK_DIALOG_MODAL" to the dialog flags.

When using gtk_dialog_run () a recursive mainloop gets started and
(some) event processing for the parent windows widgets get blocked.
Unless you want some custom behaviour it then usually is not necessary
to connect to the respond-signal (which *is* probably needed if you want
multiple dialogs simultaneously).

You also can force the dialog to respond by calling
gtk_dialog_response(). This is useful if you e.g. want to cancel a
dialog because of external conditions.

Bye,
Simon

-- 
  [EMAIL PROTECTED]  http://simon.budig.de/
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Gtk Dialog box causing application to crash

2008-08-07 Thread Jussi Kukkonen
Arvind1 K wrote:
> 
> Hi All,
> 
> I'm facing a strange problem while using GTK+ Dialog box
> I've used two dialogs one in IF and other in ELSE
> 
> if (some condition)
> {
>  GtkWidget *dialog1 = gtk_message_dialog_new (main_window,
>  GTK_DIALOG_DESTROY_WITH_PARENT,
>  GTK_MESSAGE_QUESTION,
>  GTK_BUTTONS_YES_NO,
>  "Send file to server %s?",
>  filename);
> result = gtk_dialog_run (GTK_DIALOG (dialog1));
> gtk_widget_destroy (dialog1);
> }
> 
> else
> {
> GtkWidget *dialog2 = gtk_message_dialog_new (main_window,
>  GTK_DIALOG_DESTROY_WITH_PARENT,
>  GTK_MESSAGE_QUESTION,
>  GTK_BUTTONS_YES_NO,
>  "Download file %s?",
>  filename);
> result = gtk_dialog_run (GTK_DIALOG (dialog2));
> gtk_widget_destroy (dialog2);
> }
> 
> 
> However if I use just a single dialog box at a time, everything works fine.
> I've used gdk_threads_enter() and gdk_threads_leave() whereever
> possible. these dialog boxes are created on 'select' event of CList so i
> cannot use gdk_threads_enter() and gdk_threads_leave().
> 
> I need to have few more dialog boxes, but using only 2 is causing
> problems of application crash.
> Can anybody address this issue?

I didn't really get what the actual problem here is, but some advice
that might help:

* Unless you really, really know that you need to use threads, you
  probably don't... using threads to get basic UI working is almost
  certainly a bad idea.

* gtk_dialog_run() makes the dialog modal, so you can't use several
  dialogs at once. You'll have to connect to the "respose" signal and
  and show the widget yourself.


HTH,
  Jussi

-- 
Jussi Kukkonen <[EMAIL PROTECTED]>
OpenedHand Ltd 

___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Re: Gtk Dialog box causing application to crash

2008-08-06 Thread Simon Budig
Arvind1 K ([EMAIL PROTECTED]) wrote:
> I'm facing a strange problem while using GTK+ Dialog box
> I've used two dialogs one in IF and other in ELSE
> 
> if (some condition)
> {
>  GtkWidget *dialog1 = gtk_message_dialog_new (main_window,
[...]
> } else {
> GtkWidget *dialog2 = gtk_message_dialog_new (main_window,
[...]
> result = gtk_dialog_run (GTK_DIALOG (dialog2));
> gtk_widget_destroy (dialog2);
> }
> 
> However if I use just a single dialog box at a time, everything works 
> fine.

I don't understand when the problem happens. The sourcecode is not very
specific and it does not explain how two dialogs come into play, since
after executing this code there is just one dialog open.

> I've used gdk_threads_enter() and gdk_threads_leave() whereever possible. 
> these dialog boxes are created on 'select' event of CList so i cannot use 
> gdk_threads_enter() and gdk_threads_leave().

Do you actually use threads?

> I need to have few more dialog boxes, but using only 2 is causing problems 
> of application crash.
> Can anybody address this issue?

I did not yet really understand the problem, I suspect there is a lot of
background information missing.

Bye,
Simon

-- 
  [EMAIL PROTECTED]  http://simon.budig.de/
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


Gtk Dialog box causing application to crash

2008-08-06 Thread Arvind1 K
Hi All,

I'm facing a strange problem while using GTK+ Dialog box
I've used two dialogs one in IF and other in ELSE

if (some condition)
{
 GtkWidget *dialog1 = gtk_message_dialog_new (main_window,
 GTK_DIALOG_DESTROY_WITH_PARENT,
 GTK_MESSAGE_QUESTION,
 GTK_BUTTONS_YES_NO,
 "Send file to server %s?",
 filename);
result = gtk_dialog_run (GTK_DIALOG (dialog1));
gtk_widget_destroy (dialog1);
}

else
{
GtkWidget *dialog2 = gtk_message_dialog_new (main_window,
 GTK_DIALOG_DESTROY_WITH_PARENT,
 GTK_MESSAGE_QUESTION,
 GTK_BUTTONS_YES_NO,
 "Download file %s?",
 filename);
result = gtk_dialog_run (GTK_DIALOG (dialog2));
gtk_widget_destroy (dialog2);
}


However if I use just a single dialog box at a time, everything works 
fine.
I've used gdk_threads_enter() and gdk_threads_leave() whereever possible. 
these dialog boxes are created on 'select' event of CList so i cannot use 
gdk_threads_enter() and gdk_threads_leave().

I need to have few more dialog boxes, but using only 2 is causing problems 
of application crash.
Can anybody address this issue?

thanks and regards
Arvind
=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers