WIP: importing a 'remove_item() function in tree.c
This commit is contained in:
parent
92e6f037de
commit
5743a83b0c
|
@ -124,6 +124,31 @@ GtkWidget *create_my_tree_model(GtkBox *runlib_objects)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void
|
||||||
|
remove_item (GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
printf("From 'tree.c', remove_item (line 130) > no item selected (or maybe I can't get it ?)\n");
|
||||||
|
|
||||||
|
/* GtkTreeIter iter; */
|
||||||
|
/* GtkTreeView *treeview = (GtkTreeView *)data; */
|
||||||
|
/* GtkTreeModel *model = gtk_tree_view_get_model (treeview); */
|
||||||
|
/* GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview); */
|
||||||
|
|
||||||
|
/* if (gtk_tree_selection_get_selected (selection, NULL, &iter)) */
|
||||||
|
/* { */
|
||||||
|
/* int i; */
|
||||||
|
/* GtkTreePath *path; */
|
||||||
|
|
||||||
|
/* path = gtk_tree_model_get_path (model, &iter); */
|
||||||
|
/* i = gtk_tree_path_get_indices (path)[0]; */
|
||||||
|
/* gtk_list_store_remove (GTK_LIST_STORE (model), &iter); */
|
||||||
|
|
||||||
|
/* // g_array_remove_index (articles, i); */
|
||||||
|
|
||||||
|
/* gtk_tree_path_free (path); */
|
||||||
|
/* } */
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_hello (GtkWidget *widget,
|
print_hello (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -136,13 +161,13 @@ print_hello (GtkWidget *widget,
|
||||||
GtkWidget *create_my_button_test(GtkBox *runlib_objects)
|
GtkWidget *create_my_button_test(GtkBox *runlib_objects)
|
||||||
{
|
{
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
const char *text = "Hello ! I'm the new button. Click me !";
|
const char *text = "Remove the Selected Item";
|
||||||
|
|
||||||
button = gtk_button_new_with_label(text);
|
button = gtk_button_new_with_label(text);
|
||||||
gtk_box_append(runlib_objects, button);
|
gtk_box_append(runlib_objects, button);
|
||||||
gtk_widget_show(button);
|
gtk_widget_show(button);
|
||||||
|
|
||||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
g_signal_connect (button, "clicked", G_CALLBACK (remove_item), NULL);
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ void ui_set_stack(const char *mode)
|
||||||
case 'r':
|
case 'r':
|
||||||
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
|
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
|
||||||
if (! my_tree) my_tree = create_my_tree_model(window->runlib_objects); // in tree.c
|
if (! my_tree) my_tree = create_my_tree_model(window->runlib_objects); // in tree.c
|
||||||
// if (! my_button) my_button = create_my_button_test(window->runlib_objects); // in tree.c
|
if (! my_button) my_button = create_my_button_test(window->runlib_objects); // in tree.c
|
||||||
// if (! my_list) my_list = create_my_list_view_test(window->runlib_objects); // in "bac-a-sable.c"
|
// if (! my_list) my_list = create_my_list_view_test(window->runlib_objects); // in "bac-a-sable.c"
|
||||||
// if (! my_editable_cells) my_editable_cells = create_my_editable_cells(window->runlib_objects); // in editable_cell.c
|
// if (! my_editable_cells) my_editable_cells = create_my_editable_cells(window->runlib_objects); // in editable_cell.c
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue