WIP: (micro) adding : void onTreeViewRowActivated().

This commit is contained in:
Jean Sirmai 2023-11-24 16:50:51 +01:00
parent a814a2328f
commit ea43778291
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 38 additions and 3 deletions

View File

@ -118,5 +118,7 @@ void ui_send_internal_notification (const char *message);
void ui_close_internal_notification (void); void ui_close_internal_notification (void);
void ui_toggle_sidebar (); void ui_toggle_sidebar ();
void onTreeViewRowActivated (GtkTreeView *view, GtkTreePath *path,
GtkTreeViewColumn *col, gpointer userdata);
void tree_c_printing_test(void); void tree_c_printing_test(void);

View File

@ -30,14 +30,47 @@
GtkListStore *list_store; GtkListStore *list_store;
/*************************************************************
* *
* Converting a GtkTreePath into a GtkTreeIter *
* *
*************************************************************/
void tree_c_printing_test(void) /*************************************************************
* *
* onTreeViewRowActivated: a row has been double-clicked *
* *
*************************************************************/
void
onTreeViewRowActivated (GtkTreeView *view, GtkTreePath *path,
GtkTreeViewColumn *col, gpointer userdata)
{
GtkTreeIter iter;
GtkTreeModel *model;
model = gtk_tree_view_get_model(view);
if (gtk_tree_model_get_iter(model, &iter, path))
{
gchar *name;
gtk_tree_model_get(model, &iter, "ANY_COLUMN_NAME", &name, -1);
g_print ("The row containing the name '%s' has been double-clicked.\n", name);
g_free(name);
}
}
void
tree_c_printing_test(void)
{ {
list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT); list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT);
printf("tree_c_printing_test() \ printf("tree_c_printing_test() \
------------------------------------------------------\n\n\ ---------------------------------------------------------\n\n\
trying : https://en.wikibooks.org/wiki/GTK\%\2B_By_Example/Tree_View/Tree_Models\n\n\ (https://en.wikibooks.org/wiki/GTK (modulo) 2B_By_Example/Tree_View/Tree_Models)\n\n\
cf. tuto : This creates a new list store with two columns.\n\ cf. tuto : This creates a new list store with two columns.\n\
Column 0 stores a string and column 1 stores an unsigned integer for each row.\n\ Column 0 stores a string and column 1 stores an unsigned integer for each row.\n\
At this point the model has no rows yet of course.\n"); At this point the model has no rows yet of course.\n");