/* Callback for double-clicking on one of the search results */ void on_results_view_row_activated(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, I7SearchWindow *self) { I7_SEARCH_WINDOW_USE_PRIVATE(self, priv); GtkTreeIter iter; GtkTreeModel *model = gtk_tree_view_get_model(treeview); g_return_if_fail(model); if(!(gtk_tree_model_get_iter(model, &iter, path))) return; GFile *file; int result_type, lineno; char *anchor; gtk_tree_model_get(model, &iter, I7_RESULT_FILE_COLUMN, &file, I7_RESULT_ANCHOR_COLUMN, &anchor, I7_RESULT_RESULT_TYPE_COLUMN, &result_type, I7_RESULT_LINE_NUMBER_COLUMN, &lineno, -1); switch(result_type) { case I7_RESULT_TYPE_DOCUMENTATION: case I7_RESULT_TYPE_RECIPE_BOOK: { /* Display the documentation page in the appropriate widget if this is a story with facing pages. Otherwise, open the documentation in the web browser. */ if(I7_IS_STORY(priv->document)) { /* Jump to the proper example */ char *filepath = g_file_get_path(file); if(anchor != NULL) { i7_story_show_docpage_at_anchor(I7_STORY(priv->document), file, anchor); g_free(anchor); } else i7_story_show_docpage(I7_STORY(priv->document), file); g_free(filepath); } else { show_file_in_browser(file, GTK_WINDOW(self)); } } break; case I7_RESULT_TYPE_PROJECT: i7_document_jump_to_line(priv->document, lineno); break; case I7_RESULT_TYPE_EXTENSION: { I7Document *ext = i7_app_get_already_open(i7_app_get(), file); if(ext == NULL) { ext = I7_DOCUMENT(i7_extension_new_from_file(i7_app_get(), file, FALSE)); } i7_document_jump_to_line(ext, lineno); } break; default: g_assert_not_reached(); } g_object_unref(file); }
static void set_glulx_interpreter(I7Document *document, gpointer data) { if(I7_IS_STORY(document)) i7_story_set_use_git(I7_STORY(document), GPOINTER_TO_INT(data)); }