/* Help->Recipe Book */ void action_help_recipe_book(GtkAction *action, I7Story *story) { GFile *file = i7_app_get_data_file_va(i7_app_get(), "Documentation", "Rallegs.html", NULL); i7_story_show_docpage(story, file); g_object_unref(file); }
/* Help->License */ void action_help_license(GtkAction *action, I7Story *story) { GFile *file = i7_app_get_data_file_va(i7_app_get(), "Documentation", "licenses", "license.html", NULL); i7_story_show_docpage(story, file); g_object_unref(file); }
/* 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); }
/* Help->Help on Installed Extensions */ void action_help_extensions(GtkAction *action, I7Story *story) { GFile *home_file = g_file_new_for_path(g_get_home_dir()); GFile *child1 = g_file_get_child(home_file, "Inform"); GFile *child2 = g_file_get_child(child1, "Documentation"); GFile *file = g_file_get_child(child2, "Extensions.html"); g_object_unref(home_file); g_object_unref(child1); g_object_unref(child2); i7_story_show_docpage(story, file); g_object_unref(file); }