Пример #1
0
void WindowCheckKeyterms::reload_collections ()
{
  vector <ustring> categories = keyterms_get_categories();
  combobox_set_strings(combobox_collection, categories);
  if (!categories.empty()) {
    combobox_set_index(combobox_collection, 0);
  }
}
Пример #2
0
void ResourceConverterDialog::build_gui(Shortcuts & shortcuts)
{
    switch (resource_conversion_type) {
    case rctChapterStartsAtPatternVerseOneStartsAtChapterVerseStartsAtPattern:
    {
        build_button(image_open_file_ok, label_open_file_ok, label_open_file_short, button_open_file, _("Open"), shortcuts, G_CALLBACK(on_open_file_button_clicked), label_open_file_long);

        build_button(image_view_file_ok, label_view_file_ok, label_view_file_short, button_view_file_html, _("View"), shortcuts, G_CALLBACK(on_view_file_button_clicked), label_view_file_long);

        build_entry_combo_entry(image_chapter_pattern_ok, label_chapter_pattern_ok, label_chapter_pattern, label_chapter_pattern_1, entry_chapter_pattern_1, label_chapter_pattern_combo, combo_chapter_pattern, label_chapter_pattern_2, entry_chapter_pattern_2, G_CALLBACK(on_chapter_pattern_entry_changed), shortcuts);
        gtk_entry_set_text(GTK_ENTRY(entry_chapter_pattern_1), chapter_pattern_prefix.c_str());
        vector < ustring > chapters;
        chapters.push_back(integer_or_roman_sample(0));
        chapters.push_back(integer_or_roman_sample(1));
        combobox_set_strings(combo_chapter_pattern, chapters);
        combobox_set_index(combo_chapter_pattern, chapter_pattern_index);
        gtk_entry_set_text(GTK_ENTRY(entry_chapter_pattern_2), chapter_pattern_suffix.c_str());
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern), _("Enter the text pattern to detect the chapter"));
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern_1), _("Prefix"));
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern_combo), _("Chapter number"));
        gtk_label_set_text(GTK_LABEL(label_chapter_pattern_2), _("Suffix"));

        build_entry_combo_entry(image_verse_pattern_ok, label_verse_pattern_ok, label_verse_pattern, label_verse_pattern_1, entry_verse_pattern_1, label_verse_pattern_combo, combo_verse_pattern, label_verse_pattern_2, entry_verse_pattern_2, G_CALLBACK(on_verse_pattern_entry_changed), shortcuts);
        gtk_entry_set_text(GTK_ENTRY(entry_verse_pattern_1), verse_pattern_prefix.c_str());
        vector < ustring > verses;
        verses.push_back(integer_or_roman_sample(0));
        verses.push_back(integer_or_roman_sample(1));
        combobox_set_strings(combo_verse_pattern, verses);
        combobox_set_index(combo_verse_pattern, verse_pattern_index);
        gtk_entry_set_text(GTK_ENTRY(entry_verse_pattern_2), verse_pattern_suffix.c_str());
        gtk_label_set_text(GTK_LABEL(label_verse_pattern), _("Enter the text pattern to detect the verse"));
        gtk_label_set_text(GTK_LABEL(label_verse_pattern_1), _("Prefix"));
        gtk_label_set_text(GTK_LABEL(label_verse_pattern_combo), _("Verse number"));
        gtk_label_set_text(GTK_LABEL(label_verse_pattern_2), _("Suffix"));

        build_button(image_write_anchors_ok, label_write_anchors_ok, label_write_anchors_short, button_write_anchors, _("Write"), shortcuts, G_CALLBACK(on_write_anchors_button_clicked), label_write_anchors_long);

        break;
    }
    case rctEnd:
    {
        break;
    }
    }
}
Пример #3
0
void FiltersDialog::load_filters(const ustring & selection)
{
  vector < ustring > filters = scripts_get_all();
  combobox_set_strings(combobox_filters, filters);
  if (!selection.empty())
    combobox_set_string(combobox_filters, selection);
  else if (filters.size() > 1)
    combobox_set_index(combobox_filters, 1);
  else
    combobox_set_index(combobox_filters, 0);
  on_combobox_filters();
}
Пример #4
0
void RevertDialog::on_book_changed()
// Book changed: load chapters.
{
  vector < unsigned int >chapters = project_get_chapters(project, book_get());
  combobox_set_strings(comboboxchapter, chapters);
  if (reference_chapter >= 0) {
    combobox_set_string(comboboxchapter, reference_chapter);
    reference_chapter = -1;
  } else {
    if (!chapters.empty())
      combobox_set_string(comboboxchapter, chapters[0]);
  }
}
Пример #5
0
void WindowMerge::set_edited_project()
{
  // If there is no focused editor, clear project.
  if (!editor_was_focused) {
    current_edited_project.clear();
  }
  // Load available projects.
  combobox_set_strings(combobox_edited, open_projects);

  // Show previous project, if it is there.
  bool project_found = false;
  for (unsigned int i = 0; i < open_projects.size(); i++) {
    if (previous_edited_project == open_projects[i]) {
      combobox_set_index(combobox_edited, i);
      project_found = true;
    }
  }
  if (!project_found) {
    combobox_set_index(combobox_edited, -1);
  }
  // Simulate editors changed, so it would load the differences.
  editors_changed();
}
Пример #6
0
NotesTransferDialog::NotesTransferDialog(int dummy)
{

  notestransferdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(notestransferdialog), _("Transfer To Project Notes"));
  gtk_window_set_position(GTK_WINDOW(notestransferdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_modal(GTK_WINDOW(notestransferdialog), TRUE);

  dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG(notestransferdialog));
  gtk_widget_show(dialog_vbox1);

  vbox1 = gtk_vbox_new(FALSE, 5);
  gtk_widget_show(vbox1);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, FALSE, FALSE, 0);

  label1 = gtk_label_new(_("This will transfer all text from the currently opened project into the Project notes."));
  gtk_widget_show(label1);
  gtk_box_pack_start(GTK_BOX(vbox1), label1, FALSE, FALSE, 0);
  gtk_label_set_line_wrap(GTK_LABEL(label1), TRUE);
  gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);

  hbox1 = gtk_hbox_new(FALSE, 5);
  gtk_widget_show(hbox1);
  gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);

  label2 = gtk_label_new(_("The notes will be put into category"));
  gtk_widget_show(label2);
  gtk_box_pack_start(GTK_BOX(hbox1), label2, FALSE, FALSE, 0);

  combobox1 = gtk_combo_box_new_text();
  gtk_widget_show(combobox1);
  gtk_box_pack_start(GTK_BOX(hbox1), combobox1, TRUE, TRUE, 0);

  label3 = gtk_label_new(_("The transfer cannot be undone."));
  gtk_widget_show(label3);
  gtk_box_pack_start(GTK_BOX(vbox1), label3, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);

  dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(notestransferdialog));
  gtk_widget_show(dialog_action_area1);
  gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);

  new InDialogHelp(notestransferdialog, NULL, NULL, NULL);

  cancelbutton = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton);
  gtk_dialog_add_action_widget(GTK_DIALOG(notestransferdialog), cancelbutton, GTK_RESPONSE_CANCEL);
  gtk_widget_set_can_default (GTK_WIDGET (cancelbutton), true);

  okbutton = gtk_button_new_from_stock("gtk-ok");
  gtk_widget_show(okbutton);
  gtk_dialog_add_action_widget(GTK_DIALOG(notestransferdialog), okbutton, GTK_RESPONSE_OK);
  gtk_widget_set_can_default (GTK_WIDGET (okbutton), true);

  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  // Read all the categories and add amy new ones from the database.
  ReadText rt(notes_categories_filename());
  notes_categories_add_from_database(rt.lines);
  combobox_set_strings(combobox1, rt.lines);
  if (!rt.lines.empty())
    combobox_set_string(combobox1, rt.lines[0]);
}
Пример #7
0
RevertDialog::RevertDialog(Reference * reference)
{
  // Save variables.
  extern Settings *settings;
  project = settings->genconfig.project_get();
  ProjectConfiguration *projectconfig = settings->projectconfig(project);
  language = projectconfig->language_get();
  reference_chapter = reference->chapter_get();
  revisionloaded = false;
  branch = 0;

  // Build dialog.
  Shortcuts shortcuts(0);

  revertdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(revertdialog), _("Revert"));
  gtk_window_set_position(GTK_WINDOW(revertdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_type_hint(GTK_WINDOW(revertdialog), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (revertdialog));
  gtk_widget_show(dialog_vbox1);

  hbox1 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox1);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), hbox1, TRUE, TRUE, 0);

  vbox1 = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(vbox1);
  gtk_box_pack_start(GTK_BOX(hbox1), vbox1, TRUE, TRUE, 0);

  table1 = gtk_table_new(2, 2, FALSE);
  gtk_widget_show(table1);
  gtk_box_pack_start(GTK_BOX(vbox1), table1, FALSE, TRUE, 0);

  comboboxbook = gtk_combo_box_new_text();
  gtk_widget_show(comboboxbook);
  gtk_table_attach(GTK_TABLE(table1), comboboxbook, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

  comboboxchapter = gtk_combo_box_new_text();
  gtk_widget_show(comboboxchapter);
  gtk_table_attach(GTK_TABLE(table1), comboboxchapter, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0);

  labelbook = gtk_label_new(_("Book"));
  gtk_widget_show(labelbook);
  gtk_table_attach(GTK_TABLE(table1), labelbook, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(labelbook), 0, 0.5);

  shortcuts.label(labelbook);

  gtk_label_set_mnemonic_widget(GTK_LABEL(labelbook), comboboxbook);

  labelchapter = gtk_label_new(_("Chapter"));
  gtk_widget_show(labelchapter);
  gtk_table_attach(GTK_TABLE(table1), labelchapter, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment(GTK_MISC(labelchapter), 0, 0.5);

  shortcuts.label(labelchapter);

  gtk_label_set_mnemonic_widget(GTK_LABEL(labelchapter), comboboxchapter);

  hseparator1 = gtk_hseparator_new();
  gtk_widget_show(hseparator1);
  gtk_box_pack_start(GTK_BOX(vbox1), hseparator1, FALSE, TRUE, 0);

  labelrevisions = gtk_label_new(_("Revisions"));
  gtk_widget_show(labelrevisions);
  gtk_box_pack_start(GTK_BOX(vbox1), labelrevisions, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(labelrevisions), 0, 0.5);

  shortcuts.label(labelrevisions);

  scrolledwindowrevisions = gtk_scrolled_window_new(NULL, NULL);
  gtk_widget_show(scrolledwindowrevisions);
  gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindowrevisions, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindowrevisions), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindowrevisions), GTK_SHADOW_IN);

  treeviewrevisions = gtk_tree_view_new();
  gtk_widget_show(treeviewrevisions);
  gtk_container_add(GTK_CONTAINER(scrolledwindowrevisions), treeviewrevisions);
  gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeviewrevisions), FALSE);

  gtk_label_set_mnemonic_widget(GTK_LABEL(labelrevisions), treeviewrevisions);

  // Create treeview related stuff.
  store = gtk_list_store_new(1, G_TYPE_STRING);
  gtk_tree_view_set_model(GTK_TREE_VIEW(treeviewrevisions), GTK_TREE_MODEL(store));
  g_object_unref(store);
  GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
  column = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
  gtk_tree_view_append_column(GTK_TREE_VIEW(treeviewrevisions), column);
  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeviewrevisions));
  gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);

  vseparator1 = gtk_vseparator_new();
  gtk_widget_show(vseparator1);
  gtk_box_pack_start(GTK_BOX(hbox1), vseparator1, FALSE, TRUE, 0);

  vbox2 = gtk_vbox_new(FALSE, 0);
  gtk_widget_show(vbox2);
  gtk_box_pack_start(GTK_BOX(hbox1), vbox2, TRUE, TRUE, 0);

  GSList *radiobutton_current_group = NULL;

  radiobutton_current = gtk_radio_button_new_with_mnemonic (NULL, _("View current version"));
  gtk_widget_show (radiobutton_current);
  gtk_box_pack_start (GTK_BOX (vbox2), radiobutton_current, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_current), radiobutton_current_group);
  radiobutton_current_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_current));

  shortcuts.button(radiobutton_current);

  radiobutton_previous = gtk_radio_button_new_with_mnemonic (NULL, _("View previous revision"));
  gtk_widget_show (radiobutton_previous);
  gtk_box_pack_start (GTK_BOX (vbox2), radiobutton_previous, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_previous), radiobutton_current_group);
  radiobutton_current_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_previous));

  shortcuts.button(radiobutton_previous);

  radiobutton_changes = gtk_radio_button_new_with_mnemonic (NULL, _("View changes if reverting to previous revision"));
  gtk_widget_show (radiobutton_changes);
  gtk_box_pack_start (GTK_BOX (vbox2), radiobutton_changes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_changes), radiobutton_current_group);
  radiobutton_current_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_changes));

  shortcuts.button(radiobutton_changes);
 
  changes_gui = new DisplayChangesGui (vbox2);

  gtk_widget_set_size_request(changes_gui->textview, 450, 500);

  dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(revertdialog));
  gtk_widget_show(dialog_action_area1);
  gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);

  new InDialogHelp(revertdialog, NULL, &shortcuts, "edit/revert");

  cancelbutton1 = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton1);
  gtk_dialog_add_action_widget(GTK_DIALOG(revertdialog), cancelbutton1, GTK_RESPONSE_CANCEL);
  gtk_widget_set_can_default (GTK_WIDGET (cancelbutton1), true);

  okbutton1 = gtk_button_new_from_stock("gtk-ok");
  gtk_widget_show(okbutton1);
  gtk_dialog_add_action_widget(GTK_DIALOG(revertdialog), okbutton1, GTK_RESPONSE_OK);
  gtk_widget_set_can_default (GTK_WIDGET (okbutton1), true);

  shortcuts.stockbutton(cancelbutton1);
  shortcuts.stockbutton(okbutton1);
  shortcuts.process();

  g_signal_connect((gpointer) comboboxbook, "changed", G_CALLBACK(on_comboboxbook_changed), gpointer(this));
  g_signal_connect((gpointer) comboboxchapter, "changed", G_CALLBACK(on_comboboxchapter_changed), gpointer(this));
  g_signal_connect((gpointer) treeviewrevisions, "row_activated", G_CALLBACK(on_treeviewrevisions_row_activated), gpointer(this));
  g_signal_connect((gpointer) okbutton1, "clicked", G_CALLBACK(on_okbutton1_clicked), gpointer(this));
  g_signal_connect ((gpointer) radiobutton_current, "toggled",  G_CALLBACK (on_radiobutton_toggled), gpointer(this));
  g_signal_connect ((gpointer) radiobutton_previous, "toggled",  G_CALLBACK (on_radiobutton_toggled), gpointer(this));
  g_signal_connect ((gpointer) radiobutton_changes, "toggled",  G_CALLBACK (on_radiobutton_toggled), gpointer(this));

  gtk_widget_grab_focus(okbutton1);
  gtk_widget_grab_default(okbutton1);

  // Load books. This also loads the chapters through the callback.
  vector < unsigned int >books = project_get_books(project);
  vector < ustring > localbooks;
  for (unsigned int i = 0; i < books.size(); i++) {
    localbooks.push_back(books_id_to_name(language, books[i]));
  }
  combobox_set_strings(comboboxbook, localbooks);
  combobox_set_string(comboboxbook, books_id_to_name(language, reference->book_get()));
  
  // By default view changes.
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_changes), true);
}
Пример #8
0
ProjectNoteDialog::ProjectNoteDialog(GtkWidget * parent, const vector < ustring > &projects_in, const ustring & project_in, const ustring & created_on, const ustring & created_by, const ustring & edited_on, const ustring & logbook)
{
    dialog = gtk_dialog_new();
    gtk_window_set_title(GTK_WINDOW(dialog), _("Project note"));
    gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
    gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
    gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent));

    dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG(dialog));
    gtk_widget_show(dialog_vbox1);

    vbox1 = gtk_vbox_new(FALSE, 0);
    gtk_widget_show(vbox1);
    gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, TRUE, TRUE, 0);

    label_note_project = gtk_label_new_with_mnemonic(_("Pro_ject"));
    gtk_widget_show(label_note_project);
    gtk_box_pack_start(GTK_BOX(vbox1), label_note_project, FALSE, FALSE, 0);
    gtk_misc_set_alignment(GTK_MISC(label_note_project), 0, 0.5);

    combobox_note_project = gtk_combo_box_new_text();
    gtk_widget_show(combobox_note_project);
    gtk_box_pack_start(GTK_BOX(vbox1), combobox_note_project, FALSE, FALSE, 0);

    label_note_created_on = gtk_label_new(_("Created on"));
    gtk_widget_show(label_note_created_on);
    gtk_box_pack_start(GTK_BOX(vbox1), label_note_created_on, FALSE, FALSE, 0);
    gtk_misc_set_alignment(GTK_MISC(label_note_created_on), 0, 0.5);

    label_note_created_by = gtk_label_new(_("Created by"));
    gtk_widget_show(label_note_created_by);
    gtk_box_pack_start(GTK_BOX(vbox1), label_note_created_by, FALSE, FALSE, 0);
    gtk_misc_set_alignment(GTK_MISC(label_note_created_by), 0, 0.5);

    label_note_edited_on = gtk_label_new(_("Edited on"));
    gtk_widget_show(label_note_edited_on);
    gtk_box_pack_start(GTK_BOX(vbox1), label_note_edited_on, FALSE, FALSE, 0);
    gtk_misc_set_alignment(GTK_MISC(label_note_edited_on), 0, 0.5);

    label_note_logbook = gtk_label_new(_("Logbook"));
    gtk_widget_show(label_note_logbook);
    gtk_box_pack_start(GTK_BOX(vbox1), label_note_logbook, FALSE, FALSE, 0);
    gtk_misc_set_alignment(GTK_MISC(label_note_logbook), 0, 0.5);

    textview_note_logbook = gtk_text_view_new();
    gtk_widget_show(textview_note_logbook);
    gtk_box_pack_start(GTK_BOX(vbox1), textview_note_logbook, TRUE, TRUE, 0);
    gtk_text_view_set_editable(GTK_TEXT_VIEW(textview_note_logbook), FALSE);
    gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(textview_note_logbook), FALSE);
    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview_note_logbook), GTK_WRAP_WORD);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview_note_logbook), FALSE);

    dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG(dialog));
    gtk_widget_show(dialog_action_area1);
    gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END);

    new InDialogHelp(dialog, NULL, NULL, NULL);

    cancelbutton1 = gtk_button_new_from_stock("gtk-cancel");
    gtk_widget_show(cancelbutton1);
    gtk_dialog_add_action_widget(GTK_DIALOG(dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
    gtk_widget_set_can_default (GTK_WIDGET (cancelbutton1), true);

    okbutton1 = gtk_button_new_from_stock("gtk-ok");
    gtk_widget_show(okbutton1);
    gtk_dialog_add_action_widget(GTK_DIALOG(dialog), okbutton1, GTK_RESPONSE_OK);
    gtk_widget_set_can_default (GTK_WIDGET (okbutton1), true);

    gtk_label_set_mnemonic_widget(GTK_LABEL(label_note_project), combobox_note_project);

    g_signal_connect((gpointer) okbutton1, "clicked", G_CALLBACK(on_okbutton1_clicked), gpointer(this));

    gtk_widget_grab_default(okbutton1);

    combobox_set_strings(combobox_note_project, projects_in);
    combobox_set_string(combobox_note_project, project_in);
    gtk_label_set_text(GTK_LABEL(label_note_created_by), created_by.c_str());
    gtk_label_set_text(GTK_LABEL(label_note_created_on), created_on.c_str());
    gtk_label_set_text(GTK_LABEL(label_note_edited_on), edited_on.c_str());
    GtkTextBuffer *textbuffer_logbook = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview_note_logbook));
    gtk_text_buffer_set_text(textbuffer_logbook, logbook.c_str(), -1);

}
Пример #9
0
void ImportAssistant::on_assistant_prepare (GtkWidget *page)
{
  extern Settings *settings;

  // Page to confirm or change the name of the Bible.
  if (page == vbox_bible_name) {
    if (bible_name.empty()) {
      bible_name = settings->genconfig.project_get();
    }
    gtk_label_set_text (GTK_LABEL (label_project_name), bible_name.c_str());
    if (bible_name.empty()) {
      gtk_label_set_text (GTK_LABEL (label_project_name), _("No Bible selected"));
    }
    gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_name, !bible_name.empty());
  }

  // Online Bible connected?
  if (page == label_online_bible_running) {
    if (my_windows_outpost->online_bible_server_connected) {
      gtk_label_set_text (GTK_LABEL (label_online_bible_running), _("Yes, connected to the Online Bible"));
    } else {
      gtk_label_set_text (GTK_LABEL (label_online_bible_running), _("No, could not connect to the Online Bible\nIs the Online Bible running?"));
    }
    gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_online_bible_running, my_windows_outpost->online_bible_server_connected);
  }

  // Online Bible to import. Set the available Bibles.
  if (page == vbox_online_bible_bible) {
    my_windows_outpost->OnlineBibleDirectMode = true;
    vector <ustring> bibles = combobox_get_strings (combobox_online_bible_bible);
    if (bibles.empty()) {
      ustring response = my_windows_outpost->OnlineBibleDirectCommandResponseGet ("GetVersionList");
      if (online_bible_ok_reply_validate (response)) {
        ParseLine parseline (response);
        if (!parseline.lines.empty()) {
          combobox_set_strings (combobox_online_bible_bible, parseline.lines);
          combobox_set_index (combobox_online_bible_bible, 0);
          gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_online_bible_bible, true);
        }
      }
    }
  }

  // Page for filenames to import.
  if (page == vbox_files) {
    if (files_names.empty()) {
      files_messages.push_back (_("No files selected"));
    }
    ustring label;
    label.append (_("Files count: "));
    label.append (convert_to_string ((unsigned int)files_names.size()));
    label.append ("\n");
    for (unsigned int i = 0; i < files_messages.size(); i++) {
      label.append ("\n");
      label.append (files_messages[i]);
    }
    gtk_label_set_text (GTK_LABEL (label_files), label.c_str());
    gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_files, files_messages.empty());
  }
  
  // Page for summary.
  if (page == label_summary) {
    ustring label;
    for (unsigned int i = 0; i < summary_messages.size(); i++) {
      if (i)
        label.append ("\n");
      label.append (summary_messages[i]);
    }
    if (!label.empty()) {
      gtk_label_set_text (GTK_LABEL (label_summary), label.c_str());
    }
    gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_summary, summary_messages.empty());
  }
}
Пример #10
0
ShowNotesDialog::ShowNotesDialog(int dummy)
{
  event_id = 0;
  extern Settings *settings;

  gtkbuilder = gtk_builder_new ();
  gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.showprojectnotesdialog.xml").c_str(), NULL);

  dialog = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "dialog"));

  GSList *verse_reference_group = NULL;

  radiobutton_current_verse = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_current_verse"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_current_verse), verse_reference_group);
  verse_reference_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_current_verse));
  g_signal_connect ((gpointer) radiobutton_current_verse, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  radiobutton_current_chapter = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_current_chapter"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_current_chapter), verse_reference_group);
  verse_reference_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_current_chapter));
  g_signal_connect ((gpointer) radiobutton_current_chapter, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  radiobutton_current_book = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_current_book"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_current_book), verse_reference_group);
  verse_reference_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_current_book));
  g_signal_connect ((gpointer) radiobutton_current_book, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  radiobutton_any_verse = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_any_verse"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_any_verse), verse_reference_group);
  verse_reference_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_any_verse));
  g_signal_connect ((gpointer) radiobutton_any_verse, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  GSList *radiobutton_date_group = NULL;

  radiobutton_today = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_today"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_today), radiobutton_date_group);
  radiobutton_date_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_today));
  g_signal_connect ((gpointer) radiobutton_today, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  radiobutton_between = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_between"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_between), radiobutton_date_group);
  radiobutton_date_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_between));
  g_signal_connect ((gpointer) radiobutton_between, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  button_start = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_start"));
  g_signal_connect((gpointer) button_start, "clicked", G_CALLBACK(on_fromdatebutton_clicked), gpointer(this));
  g_signal_connect ((gpointer) button_start, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  button_end = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_end"));
  g_signal_connect((gpointer) button_end, "clicked", G_CALLBACK(on_todatebutton_clicked), gpointer(this));
  g_signal_connect ((gpointer) button_end, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  radiobutton_at_any_time = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_at_any_time"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_at_any_time), radiobutton_date_group);
  radiobutton_date_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_at_any_time));
  g_signal_connect ((gpointer) radiobutton_at_any_time, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  // Glade-3 does not seem to be able to work with gtk_combo_box_new_text yet. Workaround below.
  label_category = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_category"));
  hbox_category = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "hbox_category"));
  combobox_category = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "combobox_category"));
  gtk_widget_destroy (combobox_category);
  combobox_category = gtk_combo_box_new_text();
  gtk_widget_show(combobox_category);
  gtk_box_pack_start(GTK_BOX(hbox_category), combobox_category, TRUE, TRUE, 0);
  gtk_label_set_mnemonic_widget(GTK_LABEL(label_category), combobox_category);
  g_signal_connect ((gpointer) combobox_category, "changed", G_CALLBACK (on_combobox_changed), gpointer (this));

  GSList *radiobutton_project_group = NULL;

  radiobutton_current_project = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_current_project"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_current_project), radiobutton_project_group);
  radiobutton_project_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_current_project));
  g_signal_connect ((gpointer) radiobutton_current_project, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  radiobutton_any_project = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_any_project"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_any_project), radiobutton_project_group);
  radiobutton_project_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_any_project));
  g_signal_connect ((gpointer) radiobutton_any_project, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  checkbutton_title = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_title"));
  g_signal_connect((gpointer) checkbutton_title, "toggled", G_CALLBACK(on_checkbutton_show_title_toggled), gpointer(this));
  g_signal_connect ((gpointer) checkbutton_title, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  checkbutton_project = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_project"));
  g_signal_connect ((gpointer) checkbutton_project, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  checkbutton_category = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_category"));
  g_signal_connect ((gpointer) checkbutton_category, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  checkbutton_date_created = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_date_created"));
  g_signal_connect ((gpointer) checkbutton_date_created, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  checkbutton_created_by = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_created_by"));
  g_signal_connect ((gpointer) checkbutton_created_by, "clicked", G_CALLBACK (on_button_clicked), gpointer (this));

  GSList *radiobutton_text_group = NULL;

  radiobutton_full = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_full"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_full), radiobutton_text_group);
  radiobutton_text_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_full));

  radiobutton_summary = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_summary"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_summary), radiobutton_text_group);
  radiobutton_text_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_summary));

  checkbutton_add_ref_text = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_add_ref_text"));

  // Set the reference selection.
  GtkToggleButton *refbutton = reference_get_button(settings->genconfig.notes_selection_reference_get());
  if (refbutton) {
    gtk_toggle_button_set_active(refbutton, true);
  }

  // Set the edited selection.
  GtkToggleButton *editbutton = edited_get_button(settings->genconfig.notes_selection_edited_get());
  if (editbutton) {
    gtk_toggle_button_set_active(editbutton, true);
  }
  from_day = settings->genconfig.notes_selection_date_from_get();
  to_day = settings->genconfig.notes_selection_date_to_get();

  // Load available categories and set the combo.
  ReadText rt(notes_categories_filename());
  rt.lines.push_back(all_categories());
  combobox_set_strings(combobox_category, rt.lines);
  ustring category = settings->genconfig.notes_selection_category_get();
  if (category.empty())
    category = all_categories();
  combobox_set_string(combobox_category, category);

  // Project selection.
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobutton_any_project), !settings->genconfig.notes_selection_current_project_get());

  // Title and inclusions.
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_title), settings->session.project_notes_show_title);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_project), settings->genconfig.notes_display_project_get());
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_category), settings->genconfig.notes_display_category_get());
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_date_created), settings->genconfig.notes_display_date_created_get());
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_created_by), settings->genconfig.notes_display_created_by_get());

  // Notes text display.
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radiobutton_summary), settings->genconfig.notes_display_summary_get());
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_add_ref_text), settings->genconfig.notes_display_reference_text_get());

  label_result = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_result"));

  Shortcuts shortcuts(0);
  InDialogHelp * indialoghelp = new InDialogHelp(dialog, gtkbuilder, &shortcuts, "view/project-notes");
  shortcuts.process();
  cancelbutton = indialoghelp->cancelbutton;
  okbutton = indialoghelp->okbutton;
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));
  gtk_widget_grab_default(okbutton);

  set_gui();
}