Bonsoir,

C'est un bug de Gtk ou c'est mon PC qui fatigue ?
Nom : gtk_notebook_drag_tab.png
Affichages : 204
Taille : 17,2 Ko

Mais si je réorganise les tabs du deuxième notebook : pas de problème.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* @file main.c
 * @compile : gcc main.c `pkg-config --cflags --libs gtk+-2.0` -o main
 */
#include <gtk/gtk.h>
 
int main( int   argc,
          char *argv[])
{
  GtkWidget *window;
  GtkWidget *box;
  GtkWidget *notebook_a;
  GtkWidget *notebook_b;
 
  gtk_init (&argc, &argv);
 
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW (window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW (window), 300, 200);
  //gtk_window_set_default_size(GTK_WINDOW (window), 100, 33);
 
  gtk_window_set_title (GTK_WINDOW (window), "My Notebook");
 
  g_signal_connect (window, "delete-event",
            G_CALLBACK (gtk_main_quit), NULL);
 
  gtk_container_set_border_width (GTK_CONTAINER (window), 10);
 
  box = gtk_vbox_new (TRUE, 0);
  notebook_a = gtk_notebook_new ();
  notebook_b = gtk_notebook_new ();
 
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_a), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_a), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_a), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_a), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_a), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_a), 0), TRUE);
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_a), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_a), 1), TRUE);
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_a), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_a), 2), TRUE);
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_a), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_a), 3), TRUE);
 
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_b), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_b), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_b), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_append_page(GTK_NOTEBOOK(notebook_b), gtk_label_new("Hello World"), gtk_label_new("Home"));
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_b), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_b), 0), TRUE);
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_b), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_b), 1), TRUE);
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_b), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_b), 2), TRUE);
  gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK(notebook_b), gtk_notebook_get_nth_page (GTK_NOTEBOOK(notebook_b), 3), TRUE);
 
  gtk_container_add (GTK_CONTAINER (box), notebook_a);
  gtk_container_add (GTK_CONTAINER (box), notebook_b);
  gtk_container_add (GTK_CONTAINER (window), box);
 
  gtk_widget_show_all (window);
 
  gtk_main ();
 
  return 0;
}