/* 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); }
/* Return the font size in Pango units for the font size setting */ gint get_font_size(PangoFontDescription *font) { I7App *theapp = i7_app_get(); double size = pango_font_description_get_size(font); if(pango_font_description_get_size_is_absolute(font)) size *= 96.0 / 72.0; /* a guess; not likely to be absolute anyway */ if(size == 0.0) size = DEFAULT_SIZE_STANDARD * PANGO_SCALE; switch(g_settings_get_enum(i7_app_get_prefs(theapp), PREFS_FONT_SIZE)) { case FONT_SIZE_MEDIUM: size *= RELATIVE_SIZE_MEDIUM; break; case FONT_SIZE_LARGE: size *= RELATIVE_SIZE_LARGE; break; case FONT_SIZE_HUGE: size *= RELATIVE_SIZE_HUGE; break; default: size *= RELATIVE_SIZE_STANDARD; } return size; }
/* * get_font_family: * * Return a font description for the font setting. Must be freed. */ static PangoFontDescription * get_font_family(void) { I7App *theapp = i7_app_get(); GSettings *prefs = i7_app_get_prefs(theapp); switch(g_settings_get_enum(prefs, PREFS_FONT_SET)) { case FONT_MONOSPACE: return get_desktop_monospace_font(); case FONT_CUSTOM: { char *customfont = g_settings_get_string(prefs, PREFS_CUSTOM_FONT); PangoFontDescription *retval; if(customfont) { retval = pango_font_description_from_string(customfont); g_free(customfont); return retval; } /* else fall through */ } default: ; } return get_desktop_standard_font(); }
/* Run the I6 compiler. This function is called from a child process watch, so the GDK lock is not held and must be acquired for any GUI calls. */ static void start_i6_compiler(CompilerData *data) { I7_STORY_USE_PRIVATE(data->story, priv); GFile *i6_compiler = i7_app_get_binary_file(i7_app_get(), INFORM6_COMPILER_NAME); char *i6out = g_strconcat("output.", i7_story_get_extension(data->story), NULL); GFile *i6_output = g_file_get_child(data->builddir_file, i6out); g_free(i6out); /* Build the command line */ gchar **commandline = g_new(gchar *, 6); commandline[0] = g_file_get_path(i6_compiler); commandline[1] = get_i6_compiler_switches(data->use_debug_flags, i7_story_get_story_format(data->story)); commandline[2] = g_strdup("$huge"); commandline[3] = g_strdup("auto.inf"); commandline[4] = g_file_get_path(i6_output); commandline[5] = NULL; g_object_unref(i6_compiler); g_object_unref(i6_output); GPid child_pid = run_command_hook(data->builddir_file, commandline, priv->progress, (IOHookFunc *)display_i6_status, data->story, TRUE, TRUE); /* set up a watch for the exit status */ g_child_watch_add(child_pid, (GChildWatchFunc)finish_i6_compiler, data); g_strfreev(commandline); }
static void on_config_debug_log_visible_changed(GSettings *settings, const char *key) { gboolean newvalue = g_settings_get_boolean(settings, key); /* update application to reflect new value */ i7_app_foreach_document(i7_app_get(), (I7DocumentForeachFunc)(newvalue? i7_story_add_debug_tabs : i7_story_remove_debug_tabs), NULL); }
/* 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); }
/* 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); }
GtkWidget * create_welcome_dialog(void) { I7App *theapp = i7_app_get(); GFile *file = i7_app_get_data_file_va(theapp, "ui", "welcomedialog.ui", NULL); GtkBuilder *builder = create_new_builder(file, theapp); g_object_unref(file); GtkWidget *retval = GTK_WIDGET(load_object(builder, "welcomedialog")); /* Set the background pixmap for this window */ GtkRcStyle *newstyle = gtk_widget_get_modifier_style(retval); file = i7_app_get_data_file_va(theapp, "Resources", "Welcome Background.png", NULL); newstyle->bg_pixmap_name[GTK_STATE_NORMAL] = g_file_get_path(file); /* take ownership */ g_object_unref(file); gtk_widget_modify_style(retval, newstyle); /* Set the font size to 12 pixels for the widgets in this window */ PangoFontDescription *font = pango_font_description_new(); pango_font_description_set_absolute_size(font, 12.0 * PANGO_SCALE); gtk_widget_modify_font(GTK_WIDGET(load_object(builder, "welcome_label")), font); pango_font_description_free(font); /* If there is no "last project", make the reopen button inactive */ GFile *last_project = i7_app_get_last_opened_project(theapp); if(last_project) { gtk_widget_set_sensitive(GTK_WIDGET(load_object(builder, "welcome_reopen_button")), TRUE); g_object_unref(last_project); } g_object_unref(builder); return retval; }
/* File->Close */ void action_close(GtkAction *action, I7Document *document) { if(i7_document_verify_save(document)) { i7_app_remove_document(i7_app_get(), I7_DOCUMENT(document)); gtk_widget_destroy(GTK_WIDGET(document)); } }
/* Search the documentation pages for the string 'text', building the index if necessary */ void i7_search_window_search_documentation(I7SearchWindow *self) { GError *err; if(doc_index == NULL) { /* documentation index hasn't been built yet */ GFile *doc_file = i7_app_get_data_file_va(i7_app_get(), "Documentation", NULL); GFileEnumerator *docdir; if((docdir = g_file_enumerate_children(doc_file, "standard::*", G_FILE_QUERY_INFO_NONE, NULL, &err)) == NULL) { IO_ERROR_DIALOG(GTK_WINDOW(self), doc_file, err, _("opening documentation directory")); g_object_unref(doc_file); return; } start_spinner(self); GFileInfo *info; while((info = g_file_enumerator_next_file(docdir, NULL, &err)) != NULL) { const char *basename = g_file_info_get_name(info); const char *displayname = g_file_info_get_display_name(info); if(!g_str_has_suffix(basename, ".html") || (!g_str_has_prefix(basename, "doc") && !g_str_has_prefix(basename, "Rdoc"))) continue; char *label = g_strdup_printf(_("Please be patient, indexing %s..."), displayname); gtk_label_set_text(GTK_LABEL(self->search_text), label); g_free(label); while(gtk_events_pending()) gtk_main_iteration(); GFile *file = g_file_get_child(doc_file, basename); GSList *doctexts = html_to_ascii(file, g_str_has_prefix(basename, "R")); g_object_unref(file); if(doctexts != NULL) { GSList *iter; /* Append the entries to the documentation index and search them right now while we're at it */ for(iter = doctexts; iter != NULL; iter = g_slist_next(iter)) { doc_index = g_list_prepend(doc_index, iter->data); search_documentation(iter->data, self); } g_slist_free(doctexts); } } g_object_unref(doc_file); stop_spinner(self); update_label(self); } else { start_spinner(self); g_list_foreach(doc_index, (GFunc)search_documentation, self); stop_spinner(self); } return; }
static void on_config_font_set_changed(GSettings *settings, const char *key) { /* update application to reflect new value */ I7App *theapp = i7_app_get(); update_font(GTK_WIDGET(theapp->prefs->source_example)); update_font(GTK_WIDGET(theapp->prefs->tab_example)); i7_app_foreach_document(theapp, (I7DocumentForeachFunc)i7_document_update_fonts, NULL); }
void populate_schemes_list(GtkListStore *list) { I7App *theapp = i7_app_get(); GSettings *prefs = i7_app_get_prefs(theapp); gtk_list_store_clear(list); i7_app_foreach_color_scheme(theapp, (GFunc)store_color_scheme, list); select_style_scheme(theapp->prefs->schemes_view, g_settings_get_string(prefs, PREFS_STYLE_SCHEME)); }
/* * get_desktop_monospace_font: * * Return the Gnome desktop monospace font as a font description. Must be freed. */ PangoFontDescription * get_desktop_monospace_font(void) { I7App *theapp = i7_app_get(); PangoFontDescription *retval; char *font = g_settings_get_string(i7_app_get_desktop_settings(theapp), DESKTOP_PREFS_MONOSPACE_FONT); if(!font) return pango_font_description_from_string(MONOSPACE_FONT_FALLBACK); retval = pango_font_description_from_string(font); g_free(font); return retval; }
static void on_config_custom_font_changed(GSettings *settings, const char *key) { /* update application to reflect new value */ I7App *theapp = i7_app_get(); GSettings *prefs = i7_app_get_prefs(theapp); if(g_settings_get_enum(prefs, PREFS_FONT_SET) == FONT_CUSTOM) { update_font(GTK_WIDGET(theapp->prefs->source_example)); update_font(GTK_WIDGET(theapp->prefs->tab_example)); i7_app_foreach_document(theapp, (I7DocumentForeachFunc)i7_document_update_fonts, NULL); } }
/* Callback for beginning the print operation, we give the printed pages our tab width from the preferences, and the margins from the page setup dialog. */ static void on_begin_print(GtkPrintOperation *print, GtkPrintContext *context, I7Document *document) { I7App *theapp = i7_app_get(); GSettings *prefs = i7_app_get_prefs(theapp); GtkSourcePrintCompositor *compositor = gtk_source_print_compositor_new(i7_document_get_buffer(document)); g_signal_connect(print, "draw-page", G_CALLBACK(on_draw_page), compositor); g_signal_connect(print, "end-print", G_CALLBACK(on_end_print), compositor); /* Design our printed page */ unsigned tabwidth = g_settings_get_uint(prefs, PREFS_TAB_WIDTH); if(tabwidth == 0) tabwidth = DEFAULT_TAB_WIDTH; gtk_source_print_compositor_set_tab_width(compositor, tabwidth); gtk_source_print_compositor_set_wrap_mode(compositor, GTK_WRAP_WORD_CHAR); PangoFontDescription *font = get_font_description(); gchar *fontstring = pango_font_description_to_string(font); pango_font_description_free(font); gtk_source_print_compositor_set_body_font_name(compositor, fontstring); g_free(fontstring); GtkPageSetup *setup = i7_app_get_page_setup(i7_app_get()); gtk_source_print_compositor_set_top_margin(compositor, gtk_page_setup_get_top_margin(setup, GTK_UNIT_MM), GTK_UNIT_MM); gtk_source_print_compositor_set_bottom_margin(compositor, gtk_page_setup_get_bottom_margin(setup, GTK_UNIT_MM), GTK_UNIT_MM); gtk_source_print_compositor_set_left_margin(compositor, gtk_page_setup_get_left_margin(setup, GTK_UNIT_MM), GTK_UNIT_MM); gtk_source_print_compositor_set_right_margin(compositor, gtk_page_setup_get_right_margin(setup, GTK_UNIT_MM), GTK_UNIT_MM); /* Display a notification in the status bar while paginating */ i7_document_display_status_message(document, _("Paginating..."), PRINT_OPERATIONS); while(!gtk_source_print_compositor_paginate(compositor, context)) { i7_document_display_progress_percentage(document, gtk_source_print_compositor_get_pagination_progress(compositor)); while(gtk_events_pending()) gtk_main_iteration(); } i7_document_display_progress_percentage(document, 0.0); i7_document_remove_status_message(document, PRINT_OPERATIONS); gtk_print_operation_set_n_pages(print, gtk_source_print_compositor_get_n_pages(compositor)); }
/* File->Page Setup... */ void action_page_setup(GtkAction *action, I7Document *document) { I7App *theapp = i7_app_get(); GtkPrintSettings *settings = i7_app_get_print_settings(theapp); if(!settings) settings = gtk_print_settings_new(); GtkPageSetup *new_page_setup = gtk_print_run_page_setup_dialog(GTK_WINDOW(document), i7_app_get_page_setup(theapp), settings); i7_app_set_page_setup(theapp, new_page_setup); }
/* View->Notepad */ void action_view_notepad_toggled(GtkToggleAction *action, I7Story *story) { gboolean show = gtk_toggle_action_get_active(action); /* Set the default value for the next time a window is opened */ GSettings *state = i7_app_get_state(i7_app_get()); g_settings_set_boolean(state, PREFS_STATE_SHOW_NOTEPAD, show); if(show) gtk_widget_show(story->notes_window); else gtk_widget_hide(story->notes_window); }
/* View->Statusbar */ void action_view_statusbar_toggled(GtkToggleAction *action, I7Document *document) { gboolean show = gtk_toggle_action_get_active(action); /* Set the default value for the next time a window is opened */ GSettings *state = i7_app_get_state(i7_app_get()); g_settings_set_boolean(state, PREFS_STATE_SHOW_STATUSBAR, show); if(show) gtk_widget_show(document->statusline); else gtk_widget_hide(document->statusline); }
void on_style_add_clicked(GtkButton *button, I7App *app) { /* From gedit/dialogs/gedit-preferences-dialog.c */ GtkWidget *chooser = gtk_file_chooser_dialog_new(_("Add Color Scheme"), GTK_WINDOW(app->prefs->window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, NULL); gtk_window_set_destroy_with_parent(GTK_WINDOW(chooser), TRUE); /* Filters */ GtkFileFilter *filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, _("Color Scheme Files")); gtk_file_filter_add_pattern(filter, "*.xml"); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser), filter); gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(chooser), filter); filter = gtk_file_filter_new(); gtk_file_filter_set_name(filter, _("All Files")); gtk_file_filter_add_pattern(filter, "*"); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser), filter); gtk_dialog_set_default_response(GTK_DIALOG(chooser), GTK_RESPONSE_ACCEPT); if(gtk_dialog_run(GTK_DIALOG(chooser)) != GTK_RESPONSE_ACCEPT) { gtk_widget_destroy(chooser); return; } GFile *file = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(chooser)); if(!file) return; gtk_widget_destroy(chooser); const char *scheme_id = i7_app_install_color_scheme(app, file); g_object_unref(file); if(!scheme_id) { error_dialog(GTK_WINDOW(app->prefs->window), NULL, _("The selected color scheme cannot be installed.")); return; } populate_schemes_list(app->prefs->schemes_list); I7App *theapp = i7_app_get(); GSettings *prefs = i7_app_get_prefs(theapp); g_settings_set_string(prefs, PREFS_STYLE_SCHEME, scheme_id); }
static void on_config_tab_width_changed(GSettings *settings, const char *key) { unsigned newvalue = g_settings_get_uint(settings, key); /* Use default if set to 0, as per schema description */ if(newvalue == 0) newvalue = DEFAULT_TAB_WIDTH; /* update application to reflect new value */ I7App *theapp = i7_app_get(); update_tabs(theapp->prefs->tab_example); update_tabs(theapp->prefs->source_example); i7_app_foreach_document(theapp, (I7DocumentForeachFunc)i7_document_update_tabs, NULL); }
static void on_config_style_scheme_changed(GSettings *settings, const char *key) { I7App *theapp = i7_app_get(); char *newvalue = g_settings_get_string(settings, key); /* TODO: validate new value? */ /* update application to reflect new value */ select_style_scheme(theapp->prefs->schemes_view, newvalue); update_style(GTK_SOURCE_BUFFER(gtk_text_view_get_buffer(GTK_TEXT_VIEW(theapp->prefs->source_example)))); i7_app_foreach_document(theapp, (I7DocumentForeachFunc)i7_document_update_fonts, NULL); i7_app_foreach_document(theapp, (I7DocumentForeachFunc)i7_document_update_font_styles, NULL); g_free(newvalue); }
void on_styles_list_cursor_changed(GtkTreeView *view, I7App *app) { GtkTreeSelection *selection = gtk_tree_view_get_selection(view); GtkTreeIter iter; GtkTreeModel *model; if(gtk_tree_selection_get_selected(selection, &model, &iter)) { I7App *theapp = i7_app_get(); GSettings *prefs = i7_app_get_prefs(theapp); gchar *id; gtk_tree_model_get(model, &iter, ID_COLUMN, &id, -1); g_settings_set_string(prefs, PREFS_STYLE_SCHEME, id); gtk_widget_set_sensitive(app->prefs->style_remove, id && i7_app_color_scheme_is_user_scheme(i7_app_get(), id)); g_free(id); } else ; /* Do nothing; no selection */ }
static void i7_search_window_init(I7SearchWindow *self) { I7_SEARCH_WINDOW_USE_PRIVATE(self, priv); priv->document = NULL; priv->text = NULL; priv->ignore_case = FALSE; priv->algorithm = I7_SEARCH_CONTAINS; gtk_window_set_destroy_with_parent(GTK_WINDOW(self), TRUE); gtk_window_set_icon_name(GTK_WINDOW(self), "inform7"); gtk_window_set_skip_taskbar_hint(GTK_WINDOW(self), TRUE); gtk_window_set_title(GTK_WINDOW(self), _("Search Results")); gtk_window_set_type_hint(GTK_WINDOW(self), GDK_WINDOW_TYPE_HINT_UTILITY); gtk_container_set_border_width(GTK_CONTAINER(self), 12); gtk_window_set_default_size(GTK_WINDOW(self), 400, 400); /* Build the interface from the builder file */ GFile *file = i7_app_get_data_file_va(i7_app_get(), "ui", "searchwindow.ui", NULL); GtkBuilder *builder = create_new_builder(file, self); g_object_unref(file); /* Build the rest of the interface */ gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(load_object(builder, "search_window"))); priv->results = GTK_LIST_STORE(load_object(builder, "results")); gtk_tree_view_column_set_cell_data_func(GTK_TREE_VIEW_COLUMN(load_object(builder, "result_column")), GTK_CELL_RENDERER(load_object(builder, "result_renderer")), (GtkTreeCellDataFunc)result_data_func, self, NULL); gtk_tree_view_column_set_cell_data_func(GTK_TREE_VIEW_COLUMN(load_object(builder, "document_column")), GTK_CELL_RENDERER(load_object(builder, "document_renderer")), (GtkTreeCellDataFunc)location_data_func, self, NULL); gtk_tree_view_column_set_cell_data_func(GTK_TREE_VIEW_COLUMN(load_object(builder, "type_column")), GTK_CELL_RENDERER(load_object(builder, "type_renderer")), (GtkTreeCellDataFunc)type_data_func, NULL, NULL); g_signal_connect(self, "delete-event", G_CALLBACK(on_search_window_delete_event), NULL); /* Save public pointers to other widgets */ LOAD_WIDGET(search_text); LOAD_WIDGET(results_view); LOAD_WIDGET(spinner); /* Builder object not needed anymore */ g_object_unref(builder); }
/* File->Print... */ void action_print(GtkAction *action, I7Document *document) { GError *error = NULL; I7App *theapp = i7_app_get(); GtkPrintOperation *print = gtk_print_operation_new(); GtkPrintSettings *settings = i7_app_get_print_settings(theapp); if(settings) gtk_print_operation_set_print_settings(print, settings); g_signal_connect(print, "begin-print", G_CALLBACK(on_begin_print), document); GtkPrintOperationResult result = gtk_print_operation_run(print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(document), &error); if(result == GTK_PRINT_OPERATION_RESULT_APPLY) i7_app_set_print_settings(theapp, g_object_ref(gtk_print_operation_get_print_settings(print))); else if(result == GTK_PRINT_OPERATION_RESULT_ERROR) /* TRANSLATORS: File->Print... */ error_dialog(GTK_WINDOW(document), error, _("There was an error printing: ")); g_object_unref(print); }
/* Update the tab stops for a GtkSourceView */ gboolean update_tabs(GtkSourceView *view) { I7App *theapp = i7_app_get(); GSettings *prefs = i7_app_get_prefs(theapp); unsigned spaces = g_settings_get_uint(prefs, PREFS_TAB_WIDTH); if(spaces == 0) spaces = DEFAULT_TAB_WIDTH; gtk_source_view_set_tab_width(view, spaces); /* Set the hanging indent on wrapped lines to be a number of pixels equal * to twice the number of spaces in a tab; i.e. we estimate a space to be * four pixels. Not always true, but close enough.*/ gboolean indent_wrapped = g_settings_get_boolean(prefs, PREFS_INDENT_WRAPPED); if(!indent_wrapped) spaces = 0; g_object_set(view, "indent", -2 * spaces, NULL); return FALSE; /* one-shot idle function */ }
/* Start the NI compiler and set up the callback for when it is finished. Called from the main thread.*/ static void start_ni_compiler(CompilerData *data) { I7_STORY_USE_PRIVATE(data->story, priv); /* Build the command line */ GPtrArray *args = g_ptr_array_new_full(7, g_free); /* usual number of args */ I7App *theapp = i7_app_get(); GFile *ni_compiler = i7_app_get_binary_file(theapp, "ni"); GFile *internal_dir = i7_app_get_internal_dir(theapp); g_ptr_array_add(args, g_file_get_path(ni_compiler)); g_ptr_array_add(args, g_strdup("-internal")); g_ptr_array_add(args, g_file_get_path(internal_dir)); g_ptr_array_add(args, g_strconcat("-format=", i7_story_get_extension(data->story), NULL)); g_ptr_array_add(args, g_strdup("-project")); g_ptr_array_add(args, g_file_get_path(data->input_file)); if(!data->use_debug_flags) g_ptr_array_add(args, g_strdup("-release")); /* Omit "not for relase" material */ if(i7_story_get_nobble_rng(data->story)) g_ptr_array_add(args, g_strdup("-rng")); g_ptr_array_add(args, NULL); g_object_unref(ni_compiler); g_object_unref(internal_dir); char **commandline = (char **)g_ptr_array_free(args, FALSE); /* Run the command and pipe its output to the text buffer. Also pipe stderr through a function that analyzes the progress messages and puts them in the progress bar. */ GPid pid = run_command_hook(data->builddir_file, commandline, priv->progress, (IOHookFunc *)display_ni_status, data->story, FALSE, TRUE); /* set up a watch for the exit status */ g_child_watch_add(pid, (GChildWatchFunc)finish_ni_compiler, data); g_strfreev(commandline); }
/* Run the CBlorb compiler. This function is called from a child process watch, so the GDK lock is not held and must be acquired for any GUI calls. */ static void start_cblorb_compiler(CompilerData *data) { I7_STORY_USE_PRIVATE(data->story, priv); GFile *cblorb = i7_app_get_binary_file(i7_app_get(), "cBlorb"); /* Build the command line */ gchar **commandline = g_new(gchar *, 5); commandline[0] = g_file_get_path(cblorb); commandline[1] = g_strdup("-unix"); commandline[2] = g_strdup("Release.blurb"); commandline[3] = g_file_get_path(data->output_file); commandline[4] = NULL; g_object_unref(cblorb); GPid child_pid = run_command_hook(data->input_file, commandline, priv->progress, (IOHookFunc *)parse_cblorb_output, data->story, TRUE, FALSE); /* set up a watch for the exit status */ g_child_watch_add(child_pid, (GChildWatchFunc)finish_cblorb_compiler, data); g_strfreev(commandline); }
/** * i7_search_window_search_extensions: * @self: self * * Search the user-installed extensions for the search window's search text. */ void i7_search_window_search_extensions(I7SearchWindow *self) { i7_app_foreach_installed_extension(i7_app_get(), FALSE, NULL, NULL, (I7AppExtensionFunc)extension_search_result, self, NULL); }
/* Callback for when one of the items from the File->Open Extension submenu is selected, and it is a user-installed extension */ void on_open_extension_activate(GtkMenuItem *menuitem, GFile *file) { i7_extension_new_from_file(i7_app_get(), file, FALSE); }
/* Update the highlighting styles for this buffer */ gboolean update_style(GtkSourceBuffer *buffer) { gtk_source_buffer_set_style_scheme(buffer, i7_app_get_current_color_scheme(i7_app_get())); return FALSE; /* one-shot idle function */ }