static void select_one_object(Object_t *obj, gpointer data) { SelectNextCommand_t *command = (SelectNextCommand_t*) data; Command_t *sub_command; sub_command = (obj->selected) ? select_command_new(obj) : unselect_command_new(obj); command_add_subcommand(&command->parent, sub_command); }
static void changed_cb(GtkTreeSelection *selection, gpointer param) { Selection_t *data = (Selection_t*) param; if (data->select_lock) { data->select_lock = FALSE; } else { Command_t *command, *sub_command; GtkTreeModel *model; GList *list, *selected_rows; selected_rows = gtk_tree_selection_get_selected_rows (selection, &model); command = subcommand_start (NULL); sub_command = unselect_all_command_new (data->object_list, NULL); command_add_subcommand (command, sub_command); for (list = selected_rows; list; list = list->next) { Object_t *obj; GtkTreeIter iter; GtkTreePath *path = (GtkTreePath*) list->data; gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, 0, &obj, -1); sub_command = select_command_new (obj); command_add_subcommand (command, sub_command); } command_set_name (command, sub_command->name); subcommand_end (); command_execute (command); g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL); g_list_free (selected_rows); set_buttons (data); } }
static void select_one_object(Object_t *obj, gpointer data) { SelectRegionCommand_t *command = (SelectRegionCommand_t*) data; command_add_subcommand(&command->parent, select_command_new(obj)); }