X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=gtk-gui.c;h=87cd8bf87de49c2eec6377d4c2841b84e150be5e;hb=56a24917cb707493699488e197924a13e250afcf;hp=985a70e04e0f29a7456a83c7caeea6311215b58d;hpb=f4d50ffa3b4237447093c1cef9cbe945d22ceb84;p=ext%2Fsubsurface.git diff --git a/gtk-gui.c b/gtk-gui.c index 985a70e..87cd8bf 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -460,8 +460,8 @@ static void switch_page(GtkNotebook *notebook, gint arg1, gpointer user_data) repaint_dive(); } -static const char notebook_name[] = "123"; - +static const char notebook_group[] = "123"; +#define GRP_ID ((void *)notebook_group) typedef struct { char *name; GtkWidget *widget; @@ -500,8 +500,10 @@ static GtkNotebook *create_new_notebook_window(GtkNotebook *source, gtk_container_add(GTK_CONTAINER(win), vbox); notebook = gtk_notebook_new(); + gtk_notebook_set_group(GTK_NOTEBOOK(notebook), GRP_ID); gtk_widget_set_name(notebook, nbdp->name); - gtk_notebook_set_group_name(GTK_NOTEBOOK(notebook), notebook_name); + /* disallow drop events */ + gtk_drag_dest_set(notebook, 0, NULL, 0, 0); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 6); gtk_widget_set_size_request(notebook, 450, 350); @@ -510,23 +512,16 @@ static GtkNotebook *create_new_notebook_window(GtkNotebook *source, } static void drag_cb(GtkWidget *widget, GdkDragContext *context, - gint x, gint y, - GtkSelectionData *selection_data, - guint info, guint time, + gint x, gint y, guint time, gpointer user_data) { GtkWidget *source; notebook_data_t *nbdp; - /* - * We don't actually really *use* this yet, but Dirk wants to - * do all the tabs as detatched tabs, and we'd need to use - * this all to figure out which window we're talking about. - */ source = gtk_drag_get_source_widget(context); - if (! strcmp(nbd[0].name,gtk_widget_get_name(source))) + if (nbd[0].name && ! strcmp(nbd[0].name,gtk_widget_get_name(source))) nbdp = nbd; - else if (! strcmp(nbd[1].name,gtk_widget_get_name(source))) + else if (nbd[1].name && ! strcmp(nbd[1].name,gtk_widget_get_name(source))) nbdp = nbd + 1; else /* HU? */ @@ -598,10 +593,10 @@ void init_ui(int argc, char **argv) /* Notebook for dive info vs profile vs .. */ notebook = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 6); - gtk_notebook_set_group_name(GTK_NOTEBOOK(notebook), notebook_name); + gtk_notebook_set_group(GTK_NOTEBOOK(notebook), GRP_ID); g_signal_connect(notebook, "create-window", G_CALLBACK(create_new_notebook_window), NULL); gtk_drag_dest_set(notebook, GTK_DEST_DEFAULT_ALL, ¬ebook_target, 1, GDK_ACTION_MOVE); - g_signal_connect(notebook, "drag-data-received", G_CALLBACK(drag_cb), notebook); + g_signal_connect(notebook, "drag-drop", G_CALLBACK(drag_cb), notebook); g_signal_connect(notebook, "switch-page", G_CALLBACK(switch_page), NULL); /* Create the actual divelist */