I am new to writeing GTK, and i am trying to write a GTK icon clicky thing that when you click the button a program starts. I have writen some quick code but i don't know if it is writen correcly, also i don't want it to have the header, or the default top of the window. "The little part with the Tittle close, min and max buttons." But i dont' know how. here is my code:
#include <stdlib.h> #include <gtk/gtk.h> /* Create a new hbox with an image and a label packed into it * and return the box. */ static GtkWidget *xpm_label_box( gchar *xpm_filename ) { GtkWidget *box; GtkWidget *image; /* Create box for image and label */ box = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (box), 0); /* Now on to the image stuff */ image = gtk_image_new_from_file (xpm_filename); /* Pack the image and label into the box */ gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 3); gtk_widget_show (image); return box; } /* Our usual callback function */ static void callback( GtkWidget *widget, gpointer data ) { g_print ("Hello again - %s was pressed\n", (char *) data); } int main( int argc, char *argv[] ) { /* GtkWidget is the storage type for widgets */ GtkWidget *window; GtkWidget *button0; GtkWidget *button1; GtkWidget *mainbox; GtkWidget *box0; GtkWidget *box1; gtk_init (&argc, &argv); /* Create a new window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_resizable (GTK_WINDOW (window), FALSE); /* It's a good idea to do this for all windows. */ g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL); /* Sets the border width of the window. */ gtk_container_set_border_width (GTK_CONTAINER (window), 0); /* Create a new button */ button0 = gtk_button_new (); button1 = gtk_button_new (); /* Connect the "clicked" signal of the button to our callback */ g_signal_connect (G_OBJECT (button0), "clicked", G_CALLBACK (callback), (gpointer) "Load XMMS"); g_signal_connect (G_OBJECT (button1), "clicked", G_CALLBACK (callback), (gpointer) "Load GIMP"); /* This calls our box creating function */ box0 = xpm_label_box ("xmms_32x32.xpm"); box1 = xpm_label_box ("gimp_hi_32x32.xpm"); mainbox = gtk_vbox_new (FALSE, 0); /* Pack and show all our widgets */ gtk_widget_show (box0); gtk_widget_show (box1); gtk_container_add (GTK_CONTAINER (button0), box0); gtk_container_add (GTK_CONTAINER (button1), box1); gtk_widget_show (button0); gtk_widget_show (button1); gtk_container_add (GTK_CONTAINER (mainbox), button0); gtk_container_add (GTK_CONTAINER (mainbox), button1); gtk_widget_show (mainbox); gtk_container_add (GTK_CONTAINER (window), mainbox); gtk_widget_show (window); /* Rest in gtk_main and wait for the fun to begin! */ gtk_main (); any input on better ways to write it, and the header problem would be most greatful. Jason _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list