LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GTK+ 1 modal windows (https://www.linuxquestions.org/questions/programming-9/gtk-1-modal-windows-125291/)

socket9001 12-12-2003 02:32 PM

GTK+ 1 modal windows
 
Hey,
I'm writing an XMMS plugin so I have to use GTK+ 1.x for the gui...
Anyway, I have this message box dialog which pops and alerts when some error occurs
and I dont seem to be able to make it modal..........
This is my code:

Code:

void message_box(gchar *message,gchar *title)
{
        GtkWidget *mb, *label, *button, *vbox, *hbox,*l,*r;

        mb = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        label = gtk_label_new (message);
        button = gtk_button_new_with_label(" OK ");
        l = gtk_label_new (" ");
        r = gtk_label_new (" ");
               
               
        vbox = gtk_vbox_new(FALSE, 0);
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_signal_connect_object (GTK_OBJECT (button), "clicked",GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT(mb));
        gtk_window_set_title(GTK_WINDOW(mb), title);
        gtk_box_pack_start (GTK_BOX(vbox), label, FALSE,FALSE, 0);
        gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE , FALSE, 0);
        gtk_box_pack_start (GTK_BOX(hbox), l, TRUE , TRUE, 0);
        gtk_box_pack_start (GTK_BOX(hbox), button, FALSE , FALSE, 0);
        gtk_box_pack_start (GTK_BOX(hbox), r, TRUE , TRUE, 0);
       
        gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);

        gtk_container_add (GTK_CONTAINER (mb), vbox);
        gtk_window_set_modal(GTK_WINDOW(mb), TRUE);
        gtk_widget_show_all (mb);
}

It doesnt work under XMMS, or in a dummy program I've made for testing...
Any help will be appreciated.

Thanks in advance.


All times are GMT -5. The time now is 06:36 AM.