Untitled
By: a guest | Feb 9th, 2010 | Syntax:
C | Size: 1.15 KB | Hits: 70 | Expires: Never
#include <gtk/gtk.h>
/* Another callback */
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
/* GtkWidget is the storage type for widgets */
GtkWidget *window;
GtkTargetEntry target_list[] =
{
{ "text/uri-list", 0, 0 }
};
guint n_targets = G_N_ELEMENTS (target_list);
/* This is called in all GTK applications. Arguments are parsed
* from the command line and are returned to the application. */
gtk_init (&argc, &argv);
/* create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_drag_dest_set(GTK_WIDGET(window), GTK_DEST_DEFAULT_ALL, target_list, n_targets, GDK_ACTION_COPY);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (destroy), NULL);
gtk_widget_set_size_request(GTK_WIDGET(window), 200, 200);
/* and the window */
gtk_widget_show (window);
/* All GTK applications must have a gtk_main(). Control ends here
* and waits for an event to occur (like a key press or
* mouse event). */
gtk_main ();
return 0;
}