WIP: et encore quelques briques...

This commit is contained in:
Jean Sirmai 2024-01-13 09:45:15 +01:00
parent 42bf1cc69d
commit c416927cd9
Signed by: jean
GPG Key ID: FB3115C340E057E3
1 changed files with 31 additions and 10 deletions

View File

@ -53,36 +53,56 @@ static TreeItem R[] = {{"A", A}, {"B", B}, {"C", C}, {NULL}};
static TreeItem O[] = {{"ROOT", R}, {NULL}}; // Artefact added for symmetry
static GtkWidget *my_tree_view;
static GListModel *my_list_model = NULL;
static GListModel *my_Glist_model = NULL;
// erreur: un élément de l'initialisation n'est pas une constante
//model = create_application_list ();
typedef struct _GtkListView GtkListView;
GtkListView my_view();
typedef struct _GtkModel GtkModel;
GtkModel my_model();
typedef struct _GListModel GListModel;
GListModel my_list_model();
typedef struct _GtkSelectionModel GtkSelectionModel;
GtkSelectionModel my_selection_model();
typedef struct _GtkSignalListItemFactory GtkSignalListItemFactory;
GtkSignalListItemFactory my_factory(int a);
GtkListItemFactory *gtk_signal_list_item_factory_new (void);
GtkListItemFactory *gtk_list_view_get_factory (GtkListView *self);
GtkWidget *gtk_list_view_new (GtkSelectionModel *my_model, GtkListItemFactory *my_factory);
GtkWidget *gtk_list_view_new (GtkSelectionModel *my_selection_model, GtkListItemFactory *my_factory);
void gtk_list_view_set_model (GtkListView *self, GtkSelectionModel *my_selection_model);
GtkSelectionModel *gtk_list_view_get_model (GtkListView *self);
void gtk_list_view_set_show_separators (GtkListView *self, gboolean show_separators);
// Sets whether the list box should show separators between rows. See also the "get" function
void gtk_list_view_set_single_click_activate (GtkListView *self, gboolean single_click_activate);
// Sets whether rows should be activated on single click and selected on hover. See also the "get" function
void gtk_list_view_set_enable_rubberband (GtkListView *self, gboolean enable_rubberband);
// Sets whether selections can be changed by dragging with the mouse. See also the "get" function
static void setup_listitem_cb (GtkListItemFactory *factory, GtkListItem *list_item)
static void setup_listitem_cb (GtkListItemFactory *my_factory,
GtkListItem *my_list_item,
GtkLabel *my_label,
GtkImage *my_image)
{
GtkWidget *label = gtk_label_new ("");
gtk_list_item_set_child (list_item, label);
//GtkWidget *my_label = gtk_label_new ("");
gtk_list_item_set_child (my_list_item, my_label);
GtkWidget *image = gtk_image_new ();
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_list_item_set_child (list_item, image);
//GtkWidget *my_image = gtk_image_new ();
gtk_image_set_icon_size (GTK_IMAGE (my_image), GTK_ICON_SIZE_LARGE);
gtk_list_item_set_child (my_list_item, my_image);
}
static void bind_listitem_cb (GtkListItemFactory *factory, GtkListItem *list_item)
static void bind_listitem_cb (GtkListItemFactory *factory,
GtkListItem *list_item)
{
GtkWidget *image;
GAppInfo *app_info;
@ -92,7 +112,8 @@ static void bind_listitem_cb (GtkListItemFactory *factory, GtkListItem *list_ite
gtk_image_set_from_gicon (GTK_IMAGE (image), g_app_info_get_icon (app_info));
}
static void activate_cb (GtkListView *list, guint position, gpointer unused)
static void activate_cb (GtkListView *list,
guint position, gpointer unused)
{
GAppInfo *app_info;