How to program a simple dialog?



Hello all,
i try to program a simple dialog without success.

Here is my actual code:
<code>
#include <unistd.h>
#include <stdlib.h>
#include <gtk/gtk.h>

void quick_message () {

   GtkWidget *system_dialog, *label;

   /* Create the widgets */

   system_dialog = gtk_dialog_new ();
   gtk_widget_set_name (system_dialog, "system_dialog");
   gtk_window_set_title (GTK_WINDOW (system_dialog), "System Settings");
   gtk_window_set_position (GTK_WINDOW (system_dialog), GTK_WIN_POS_CENTER);
   gtk_window_set_modal (GTK_WINDOW (system_dialog), TRUE);
   gtk_window_set_default_size (GTK_WINDOW (system_dialog), 500, 280);
   gtk_window_set_resizable (GTK_WINDOW (system_dialog), FALSE);
   gtk_window_set_type_hint (GTK_WINDOW (system_dialog),
GDK_WINDOW_TYPE_HINT_DIALOG);

   label = gtk_label_new ("");

   /* Ensure that the dialog box is destroyed when the user responds. */

   g_signal_connect_swapped (system_dialog,
                             "response",
                             G_CALLBACK (gtk_widget_destroy),
                             system_dialog);

   /* Add the label, and show everything we've added to the dialog. */

   gtk_container_add (GTK_CONTAINER (GTK_DIALOG(system_dialog)->vbox),
                      label);
   gtk_widget_show_all (system_dialog);
}


int main(int argc, char *argv[])
{
    quick_message();

    return 0;
}
</code>

Here is my compile line: "cc -o tc_system_new main.c `pkg-config --cflags
--libs gtk+-2.0 gthread-2.0 glib-2.0`"

And here is my error output:

 root michatubuntu:~/Desktop/really_new# ./tc_system_new

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.14.1/gobject/gtype.c:2242:
initialization assertion failed, use IA__g_type_init() prior to this
function

(process:6096): GLib-GObject-CRITICAL **: g_type_add_interface_static:
assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(process:6096): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:6096): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed

Any suggestions?

Best regards,
flo



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]