WIP: GtkSelectionModel *my_select_model = gtk_selection_model_select_all (my_string_list);
This commit is contained in:
parent
58ed930b0e
commit
148460db0f
|
@ -28,54 +28,6 @@
|
||||||
#include "../../include/base.h"
|
#include "../../include/base.h"
|
||||||
#include "../../include/ui.h"
|
#include "../../include/ui.h"
|
||||||
|
|
||||||
struct _GtkList
|
|
||||||
{
|
|
||||||
GList *selection;
|
|
||||||
guint selection_mode;
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
sigh_print_selection (GtkWidget *gtklist,
|
|
||||||
gpointer func_data)
|
|
||||||
{
|
|
||||||
GList *dlist;
|
|
||||||
|
|
||||||
|
|
||||||
/* Recherche dans la liste doublement chaînée
|
|
||||||
* des items sélectionnés du GtkList. En lecture seulement */
|
|
||||||
|
|
||||||
// dlist = GTK_LIST(gtklist)->selection;
|
|
||||||
|
|
||||||
/* S'il n'y a pas d'items sélectionné, le dire à l'utilisateur. */
|
|
||||||
|
|
||||||
if (!dlist) {
|
|
||||||
g_print("Sélection nettoyée\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* Ok, on a une sélection et on l'affiche. */
|
|
||||||
|
|
||||||
g_print("La sélection est ");
|
|
||||||
|
|
||||||
/* On récupère l'item dans la liste doublement chaînée
|
|
||||||
* puis on interroge la donnée associée par list_item_data_key
|
|
||||||
* et on l'affiche. */
|
|
||||||
|
|
||||||
int compteur = 0;
|
|
||||||
while (dlist) {
|
|
||||||
GObject *list_item;
|
|
||||||
gchar *item_data_string;
|
|
||||||
|
|
||||||
list_item=GTK_OBJECT(dlist->data);
|
|
||||||
item_data_string=gtk_object_get_data(list_item, compteur); // list_item_data_key);
|
|
||||||
compteur ++;
|
|
||||||
g_print("%s ", item_data_string);
|
|
||||||
|
|
||||||
dlist=dlist->next;
|
|
||||||
}
|
|
||||||
g_print("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
static void on_button_action (GtkWidget *widget, gpointer data){n++; g_print (data, n);}
|
static void on_button_action (GtkWidget *widget, gpointer data){n++; g_print (data, n);}
|
||||||
static void on_destroy (GtkWidget *widget, gpointer data) {if (data) g_print (data); exit(0);}
|
static void on_destroy (GtkWidget *widget, gpointer data) {if (data) g_print (data); exit(0);}
|
||||||
|
@ -97,7 +49,9 @@ static void just_use_gtk_application_window_new()
|
||||||
const gchar *list_item_data_key = "list_item_data"; // https://fr.wikibooks.org/wiki/Programmation_GTK/Exemple
|
const gchar *list_item_data_key = "list_item_data"; // https://fr.wikibooks.org/wiki/Programmation_GTK/Exemple
|
||||||
// GtkListItem *my_list_item = gtk_list_item_new ((const char * const *) my_array);
|
// GtkListItem *my_list_item = gtk_list_item_new ((const char * const *) my_array);
|
||||||
|
|
||||||
GtkSelectionModel *my_select_model = gtk_no_selection_new (my_string_list); // GtkSingleSelection
|
GtkSelectionModel *my_select_model = gtk_selection_model_select_all (my_string_list);
|
||||||
|
// GtkSelectionModel *my_select_model = gtk_no_selection_new (my_string_list);
|
||||||
|
// GtkSingleSelection ... = gtk_single_selection_new (my_string_list);
|
||||||
GtkListItemFactory *my_factory = gtk_signal_list_item_factory_new ();
|
GtkListItemFactory *my_factory = gtk_signal_list_item_factory_new ();
|
||||||
GtkWidget *my_list_view = gtk_list_view_new (my_string_list, my_factory);
|
GtkWidget *my_list_view = gtk_list_view_new (my_string_list, my_factory);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue