コード例 #1
0
void ResourceConverterDialog::build_checkbutton_button(GtkWidget * &image_ok, GtkWidget * &label_ok, GtkWidget * &checkbutton, const gchar * checkbutton_text, GCallback checkbutton_handler, GtkWidget * &button, const gchar * button_text, GCallback button_handler, Shortcuts & shortcuts, GtkWidget * &label)
{
    GtkWidget *hseparator = gtk_hseparator_new();
    gtk_widget_show(hseparator);
    gtk_table_attach(GTK_TABLE(table1), hseparator, 0, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
    table_attachment_offset++;

    image_ok = gtk_image_new_from_icon_name("gtk-apply", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image_ok);
    gtk_table_attach(GTK_TABLE(table1), image_ok, 0, 1, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

    label_ok = gtk_label_new("Done");
    gtk_widget_show(label_ok);
    gtk_table_attach(GTK_TABLE(table1), label_ok, 1, 2, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment(GTK_MISC(label_ok), 0, 0.5);

    checkbutton = gtk_check_button_new_with_mnemonic(checkbutton_text);
    gtk_widget_show(checkbutton);
    gtk_table_attach(GTK_TABLE(table1), checkbutton, 2, 3, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);

    shortcuts.button(checkbutton);

    button = gtk_button_new();
    gtk_widget_show(button);
    gtk_table_attach(GTK_TABLE(table1), button, 3, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    table_attachment_offset++;

    GtkWidget *alignment2 = gtk_alignment_new(0.5, 0.5, 0, 0);
    gtk_widget_show(alignment2);
    gtk_container_add(GTK_CONTAINER(button), alignment2);

    GtkWidget *hbox2 = gtk_hbox_new(FALSE, 2);
    gtk_widget_show(hbox2);
    gtk_container_add(GTK_CONTAINER(alignment2), hbox2);

    GtkWidget *image2 = gtk_image_new_from_stock("gtk-index", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image2);
    gtk_box_pack_start(GTK_BOX(hbox2), image2, FALSE, FALSE, 0);

    GtkWidget *label2 = gtk_label_new_with_mnemonic(button_text);
    gtk_widget_show(label2);
    gtk_box_pack_start(GTK_BOX(hbox2), label2, FALSE, FALSE, 0);

    shortcuts.label(label2);

    label = gtk_label_new("");
    gtk_widget_show(label);
    gtk_table_attach(GTK_TABLE(table1), label, 0, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    table_attachment_offset++;

    g_signal_connect((gpointer) checkbutton, "toggled", checkbutton_handler, gpointer(this));
    g_signal_connect((gpointer) button, "clicked", button_handler, gpointer(this));
}
コード例 #2
0
int
run(std::vector<double> &x, std::vector<double> &y)
{
    std::vector< std::vector<double> > A;	//must create container for 2 variables as gpointer can be only one
    A.push_back(x);
    A.push_back(y);

    GtkWidget *window, *drawing_area;

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    gtk_window_set_default_size (GTK_WINDOW (window), WIDTH, HEIGHT);
    gtk_window_set_title (GTK_WINDOW (window), "gPlacian");

    g_signal_connect (window, "destroy",
		      G_CALLBACK (gtk_main_quit), NULL);

    drawing_area = gtk_drawing_area_new ();
    gtk_container_add (GTK_CONTAINER (window), drawing_area);

    g_signal_connect (drawing_area, "expose-event",
		      G_CALLBACK (handle_expose), gpointer(&A));

    gtk_widget_show_all (window);

    gtk_main ();

    return 0;
}
コード例 #3
0
ファイル: windowsoutpost.cpp プロジェクト: alerque/bibledit
void WindowsOutpost::Start()
// This effectually starts the whole system.
{
  thread_run = true;
  // New g_thread_new ("windowsoutpost", GThreadFunc(thread_start), gpointer(this));
  g_thread_create (GThreadFunc(thread_start), gpointer(this), false, NULL);
}
コード例 #4
0
void ResourceConverterDialog::build_entry(GtkWidget * &image_ok, GtkWidget * &label_ok, GtkWidget * &label, const gchar * label_text, GtkWidget * &entry, const ustring & entry_text, GCallback handler)
{
    GtkWidget *hseparator;
    hseparator = gtk_hseparator_new();
    gtk_widget_show(hseparator);
    gtk_table_attach(GTK_TABLE(table1), hseparator, 0, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
    table_attachment_offset++;

    image_ok = gtk_image_new_from_icon_name("gtk-apply", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image_ok);
    gtk_table_attach(GTK_TABLE(table1), image_ok, 0, 1, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (0), (GtkAttachOptions) (0), 0, 0);

    label_ok = gtk_label_new("");
    gtk_widget_show(label_ok);
    gtk_table_attach(GTK_TABLE(table1), label_ok, 1, 2, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment(GTK_MISC(label_ok), 0, 0.5);

    label = gtk_label_new(label_text);
    gtk_widget_show(label);
    gtk_table_attach(GTK_TABLE(table1), label, 2, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    table_attachment_offset++;

    entry = gtk_entry_new();
    gtk_widget_show(entry);
    gtk_table_attach(GTK_TABLE(table1), entry, 0, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    table_attachment_offset++;

    gtk_entry_set_text(GTK_ENTRY(entry), entry_text.c_str());

    g_signal_connect((gpointer) entry, "changed", handler, gpointer(this));
}
コード例 #5
0
ファイル: dialogwait.cpp プロジェクト: alerque/bibledit
WaitDialog::WaitDialog(int milliseconds, int width, int height)
{
  waitdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(waitdialog), _("Please wait ..."));
  gtk_window_set_position(GTK_WINDOW(waitdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_modal(GTK_WINDOW(waitdialog), TRUE);
  if (width && height)
    gtk_window_set_default_size(GTK_WINDOW(waitdialog), width, height);

  dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG(waitdialog));
  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);

  label1 = gtk_label_new(_("Please hold on ... processing data"));
  gtk_widget_show(label1);
  gtk_box_pack_start(GTK_BOX(vbox1), label1, FALSE, FALSE, 0);

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

  g_timeout_add(milliseconds, GSourceFunc(static_on_timeout), gpointer(this));
}
コード例 #6
0
ファイル: dialogxetex.cpp プロジェクト: alerque/bibledit
XeTeXDialog::XeTeXDialog(int dummy)
{
  extern Settings *settings;
  ProjectConfiguration *projectconfig = settings->projectconfig(settings->genconfig.project_get());

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

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

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

  button_portion = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_portion"));
  g_signal_connect((gpointer) button_portion, "clicked", G_CALLBACK(on_button_portion_clicked), gpointer(this));

  expander = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "expander"));
  gtk_expander_set_expanded(GTK_EXPANDER(expander), settings->session.print_dialog_options_expanded);

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

  notebook = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "notebook"));
  g_signal_connect_after((gpointer) notebook, "switch_page", G_CALLBACK(on_notebook_switch_page), gpointer(this));

  label_tab_notes = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_notes"));
  checkbutton_full_references = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_full_references"));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_full_references), settings->session.print_references_in_notes_in_full);
  // Set widget insensitive since is has not yet been implemented.
  gtk_widget_set_sensitive (checkbutton_full_references, false);

  label_tab_page = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_page"));
  checkbutton_cropmarks = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "checkbutton_cropmarks"));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_cropmarks), settings->session.print_crop_marks);

  label_tab_mapping = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_mapping"));
  button_font_mapping_clear = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_font_mapping_clear"));
  filechooserbutton_font_mapping_file = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "filechooserbutton_font_mapping_file"));
  g_signal_connect((gpointer) button_font_mapping_clear, "clicked", G_CALLBACK(on_button_font_mapping_clear_clicked), gpointer(filechooserbutton_font_mapping_file));
  if (!projectconfig->xetex_font_mapping_file_get().empty()) {
    gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooserbutton_font_mapping_file), projectconfig->xetex_font_mapping_file_get().c_str());
  }

  label_tab_engine = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_tab_engine"));
  GSList *shaping_engine_group = NULL;
  radiobutton_shaping_engine_generic = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_shaping_engine_generic"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_generic), shaping_engine_group);
  shaping_engine_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_generic));
  radiobutton_shaping_engine_arab = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "radiobutton_shaping_engine_arab"));
  gtk_radio_button_set_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_arab), shaping_engine_group);
  shaping_engine_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radiobutton_shaping_engine_arab));
  shaping_engine_set (projectconfig->xetex_shaping_engine_get());

  InDialogHelp * indialoghelp = new InDialogHelp(dialog, gtkbuilder, NULL, "file/print/project");
  cancelbutton = indialoghelp->cancelbutton;
  okbutton = indialoghelp->okbutton;
  gtk_widget_grab_focus(okbutton);
  gtk_widget_grab_default(okbutton);
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  set_gui();
}
コード例 #7
0
ファイル: gobject-list.c プロジェクト: matze/gobject-list
gpointer
g_object_ref (gpointer object)
{
  gpointer (* real_g_object_ref) (gpointer);
  GObject *obj = G_OBJECT (object);
  const char *obj_name;
  guint ref_count;
  GObject *ret;

  real_g_object_ref = get_func ("g_object_ref");

  obj_name = G_OBJECT_TYPE_NAME (obj);

  ref_count = obj->ref_count;
  ret = real_g_object_ref (object);

  if (object_filter (obj_name) && display_filter (DISPLAY_FLAG_REFS))
    {
      g_print (" +  Reffed object %p, %s; ref_count: %d -> %d\n",
          obj, obj_name, ref_count, obj->ref_count);
      print_trace();
    }

  return ret;
}
コード例 #8
0
BulkSpellingDialog::BulkSpellingDialog(const vector <ustring> words)
{
  gtkbuilder = gtk_builder_new ();
  gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.bulkspellingdialog.xml").c_str(), NULL);

  Shortcuts shortcuts(0);

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

  label = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label"));
  gtk_label_set_text (GTK_LABEL (label), _("All the words that are misspelled are visible below.\nClick on a word to approve the spelling."));

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

  InDialogHelp * indialoghelp = new InDialogHelp(dialog, gtkbuilder, &shortcuts, NULL);
  cancelbutton = indialoghelp->cancelbutton;
  okbutton = indialoghelp->okbutton;
  gtk_widget_grab_default(okbutton);
  gtk_widget_grab_focus(okbutton);
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  // Create a button for each misspelled word.
  GtkWidget * spellbutton;
  for (unsigned int i = 0; i < words.size(); i++) {
    spellbutton = gtk_button_new_with_label(words[i].c_str());
    gtk_widget_show(spellbutton);
    gtk_box_pack_start(GTK_BOX(vbox), spellbutton, false, false, 0);
    g_signal_connect((gpointer) spellbutton, "clicked", G_CALLBACK(on_spellbutton_clicked), gpointer(this));
  }  

  shortcuts.process();
  gtk_widget_show(dialog);
  
  new DialogAutoScaler (dialog, G_MAXINT);
}
コード例 #9
0
void FloatingWindow::focus_if_widget_mine (GtkWidget *widget)
// It looks through all widgets it has, to find out whether "widget" belongs to the object.
{
  focused_widget_to_look_for = widget;
  if (GTK_IS_CONTAINER(vbox_window)) {
    gtk_container_foreach(GTK_CONTAINER(vbox_window), on_container_tree_callback, gpointer(this));
  }
}
コード例 #10
0
void do_tmpwin_hack (void)
{
    GtkWidget * tmpwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    g_signal_connect (GTK_OBJECT (tmpwin), "configure-event",
                      GTK_SIGNAL_FUNC (tmpwin_configured),
                      gpointer (tmpwin));
    gtk_window_maximize (GTK_WINDOW(tmpwin));
    gtk_widget_show (tmpwin);
}
コード例 #11
0
void FloatingWindow::undisplay()
// Does the bookkeeping needed for deleting a box.
// When a box closes, the sizes of other boxes are not affected. 
// Thus if the same window is opened again, it will go in the same free space as it was in before.
{
  // Get the parameters of all the windows.
  WindowData window_params(true);

  // Ensure that the window has its entry in the settings.
  bool window_found = false;
  for (unsigned int i = 0; i < window_params.widths.size(); i++) {
    if ((window_params.ids[i] == window_id) && (window_params.titles[i] == title)) {
      window_found = true;
    }
  }
  if (!window_found) {
    window_params.x_positions.push_back(0);
    window_params.y_positions.push_back(0);
    window_params.widths.push_back(0);
    window_params.heights.push_back(0);
    window_params.ids.push_back(window_id);
    window_params.titles.push_back(title);
    if (window_id == widEditor) {
      window_params.editor_projects.push_back(((WindowEditor*)this)->projectname_get());
      window_params.editor_view_types.push_back(((WindowEditor*)this)->vt_get());
    }
    else { 
      window_params.editor_projects.push_back("Project name (and view type) not used for non-editor windows"); 
      window_params.editor_view_types.push_back(0); 
    }
    window_params.shows.push_back(false);
  }
  // Set data for the window.
  for (unsigned int i = 0; i < window_params.ids.size(); i++) {
    if ((window_id == window_params.ids[i]) && (title == window_params.titles[i])) {
      // Set the position and size of the window.
      window_params.x_positions[i] = my_gdk_rectangle.x;
      window_params.y_positions[i] = my_gdk_rectangle.y;
      window_params.widths[i] = my_gdk_rectangle.width;
      window_params.heights[i] = my_gdk_rectangle.height;
      // The "showing" flag is set on program shutdown, else it is cleared.
      window_params.shows[i] = my_shutdown;
    }
  }

  // Remove the pointer to this window from the Session.
  gpointer current_floating_window = gpointer (this);
  extern Settings *settings;
  vector <gpointer>old_windows = settings->session.open_floating_windows;
  vector <gpointer>new_windows;
  for (unsigned int i = 0; i < old_windows.size(); i++) {
    if (current_floating_window != old_windows[i]) {
      new_windows.push_back(old_windows[i]);
    }
  }
  settings->session.open_floating_windows = new_windows;
}
コード例 #12
0
ファイル: dialogdate.cpp プロジェクト: postiffm/bibledit-gtk
DateDialog::DateDialog(guint32 * seconds_since_epoch, GtkWindow *transient_parent, bool showtime) :
datewidget (seconds_since_epoch, showtime)
/*
By default this dialog shows the calendar only.
If showtime is true it shows the time also.
*/
{
  // Store variabeles.
  my_seconds_since_epoch = seconds_since_epoch;
  myshowtime = showtime;

  datedialog = gtk_dialog_new();
  gtk_window_set_transient_for(GTK_WINDOW(datedialog), transient_parent);
  gtk_window_set_title(GTK_WINDOW(datedialog), _("Date"));
  //gtk_window_set_position(GTK_WINDOW(datedialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_type_hint(GTK_WINDOW(datedialog), GDK_WINDOW_TYPE_HINT_DIALOG);

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

  gtk_box_pack_start(GTK_BOX(dialog_vbox1), datewidget.hbox, TRUE, TRUE, 0);

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

  new InDialogHelp(datedialog, NULL, NULL, NULL);

  cancelbutton1 = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton1);
  gtk_dialog_add_action_widget(GTK_DIALOG(datedialog), 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(datedialog), okbutton1, GTK_RESPONSE_OK);
  gtk_widget_set_can_default (GTK_WIDGET (okbutton1), true);

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

  gtk_widget_grab_default(okbutton1);
}
コード例 #13
0
void ResourceConverterDialog::build_textview(GtkWidget * &image_ok, GtkWidget * &label_ok, GtkWidget * &label, GtkWidget * &textview, gchar * text, GCallback handler)
{
    GtkWidget *hseparator;
    hseparator = gtk_hseparator_new();
    gtk_widget_show(hseparator);
    gtk_table_attach(GTK_TABLE(table1), hseparator, 0, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
    table_attachment_offset++;

    image_ok = gtk_image_new_from_icon_name("gtk-apply", GTK_ICON_SIZE_BUTTON);
    gtk_widget_show(image_ok);
    gtk_table_attach(GTK_TABLE(table1), image_ok, 0, 1, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);

    label_ok = gtk_label_new(_("Done"));
    gtk_widget_show(label_ok);
    gtk_table_attach(GTK_TABLE(table1), label_ok, 1, 2, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment(GTK_MISC(label_ok), 0, 0.5);

    label = gtk_label_new(_("Title"));
    gtk_widget_show(label);
    gtk_table_attach(GTK_TABLE(table1), label, 2, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    table_attachment_offset++;

    GtkWidget *scrolledwindow;
    scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
    gtk_widget_show(scrolledwindow);
    gtk_table_attach(GTK_TABLE(table1), scrolledwindow, 0, 4, table_attachment_offset, table_attachment_offset + 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_SHADOW_IN);

    textview = gtk_text_view_new();
    gtk_widget_show(textview);
    gtk_container_add(GTK_CONTAINER(scrolledwindow), textview);
    table_attachment_offset++;

    if (text) {
        GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
        gtk_text_buffer_set_text(buffer, text, -1);
    }

    g_signal_connect((gpointer) textview, "key_press_event", handler, gpointer(this));
}
コード例 #14
0
void SelectBooksDialog::on_okbutton()
{
    // Get the list of books now selected.
    selection.clear();
    vector < ustring > books;
    gtk_tree_selection_selected_foreach(selectbooks, selection_foreach_function, gpointer(&books));
    for (unsigned int i = 0; i < books.size(); i++) {
        unsigned int book = books_name_to_id(mylanguage, books[i]);
        if (book)
            selection.push_back(book);
    }
    // Also produce a set out of that list.
    selectionset.clear();
    for (unsigned int i = 0; i < selection.size(); i++) {
        selectionset.insert(selection[i]);
    }
    // If portions are showing, store the values there too.
    if (myshowportions) {
        // Get books, includes and portions.
        vector < ustring > reordered_books;
        vector < bool > reordered_includes;
        vector < ustring > reordered_portions;
        {
            vector < ustring > books = listview_get_strings(treeviewbooks);
            for (unsigned int i = 0; i < books.size(); i++) {
                unsigned int book = books_name_to_id(mylanguage, books[i]);
                reordered_books.push_back(books_id_to_english(book));
                bool include = (selectionset.find(book) != selectionset.end());
                reordered_includes.push_back(include);
            }
        }
        reordered_portions = listview_get_strings(treeviewportions);
        // Save books, includes and portions.
        extern Settings *settings;
        ProjectConfiguration *projectconfig = settings->projectconfig(myproject);
        projectconfig->reordered_books_set(reordered_books);
        projectconfig->reordered_includes_set(reordered_includes);
        projectconfig->reordered_portions_set(reordered_portions);
    }
}
コード例 #15
0
DisplayProjectNotes::DisplayProjectNotes(const ustring & reference, GtkWidget * webview_in, vector < unsigned int >*ids, unsigned int& edited_note_id)
{
  // Initialize and save variables.
  editor_reference = reference;
  webview = webview_in;
  mystop = false;
  ready = false;
  cursor_offset = 0;
  extra_note_id = edited_note_id;
  edited_note_id = 0;
  // Handle any notes given for display.
  if (ids) {
    ids_passed = true;
    ids_to_display.assign (ids->begin (), ids->end ());
  } else {
    ids_passed = false;
  }
  // Start main thread.  
  // New g_thread_new ("displayprojectnotes", GThreadFunc (thread_start), gpointer(this));
  g_thread_create(GThreadFunc(thread_start), gpointer(this), false, NULL);
  DEBUG("Started thread")
}
コード例 #16
0
ComparePreferencesDialog::ComparePreferencesDialog(int dummy)
{
  comparepreferencesdialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (comparepreferencesdialog), _("Enter"));
  gtk_window_set_position (GTK_WINDOW (comparepreferencesdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_modal (GTK_WINDOW (comparepreferencesdialog), TRUE);

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

  checkbutton_disregard_notes = gtk_check_button_new_with_mnemonic (_("Disregard changes in notes"));
  gtk_widget_show (checkbutton_disregard_notes);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), checkbutton_disregard_notes, FALSE, FALSE, 0);

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

  new InDialogHelp(comparepreferencesdialog, NULL, NULL, NULL);

  cancelbutton = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton);
  gtk_dialog_add_action_widget(GTK_DIALOG(comparepreferencesdialog), 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(comparepreferencesdialog), 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));

  gtk_widget_grab_focus(okbutton);
  gtk_widget_grab_default(okbutton);
  
  extern Settings * settings;
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton_disregard_notes), settings->genconfig.compare_disregard_notes_get());
}
コード例 #17
0
PlanningEditDialog::PlanningEditDialog(unsigned int book, unsigned int chapter)
{
  // Initialize variables
  mybook = book;
  mychapter = chapter;

  // Build gui.
  gtkbuilder = gtk_builder_new ();
  gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.planningeditdialog.xml").c_str(), NULL);

  Shortcuts shortcuts(0);

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

  button_status = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_status"));
  shortcuts.button (button_status);
  g_signal_connect((gpointer) button_status, "clicked", G_CALLBACK(on_button_status_clicked), gpointer(this));

  button_tasks = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "button_tasks"));
  shortcuts.button (button_tasks);
  g_signal_connect((gpointer) button_tasks, "clicked", G_CALLBACK(on_button_tasks_clicked), gpointer(this));

  InDialogHelp * indialoghelp = new InDialogHelp(dialog, gtkbuilder, &shortcuts, NULL);

  cancelbutton = indialoghelp->cancelbutton;
  shortcuts.stockbutton (cancelbutton);
  
  okbutton = indialoghelp->okbutton;
  shortcuts.stockbutton (okbutton);
  gtk_widget_grab_default(okbutton);
  gtk_widget_grab_focus(okbutton);
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  shortcuts.process();

  gui();
}
コード例 #18
0
uint8_t DIA_threshold (AVDMGenericVideoStream *in,
                       ADMVideoThreshold * thresholdp,
                       THRESHOLD_PARAM * param)
{
    // Allocate space for preview video
    uint32_t width = in->getInfo()->width;
    uint32_t height = in->getInfo()->height;

    dialog = create_threshold_dialog();

	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
										GTK_RESPONSE_OK,
										GTK_RESPONSE_CANCEL,
										-1);

    gtk_register_dialog(dialog);
    gtk_window_set_title (GTK_WINDOW (dialog),
                          QT_TR_NOOP("Threshold Configuration"));
    gtk_widget_show(dialog);

    myDialog = new flyThreshold (width, height, in,
                                 WID(previewVideo), WID(previewSlider),
                                 thresholdp, param);

    g_signal_connect (GTK_OBJECT (WID(previewVideo)), "configure-event",
                      GTK_SIGNAL_FUNC (preview_video_configured),
                      gpointer (myDialog));

    myDialog->upload();
    myDialog->sliderChanged();

    // update things when settings are changed
#define CNX(_widg,_signame) \
    g_signal_connect(GTK_OBJECT(WID(_widg)), _signame,                \
                     GTK_SIGNAL_FUNC(gui_update), (void *) (1));

//    CNX (minValueSlider, "drag_data_received");
    CNX (minValueSpinner, "value_changed");

//    CNX (maxValueSlider, "drag_data_received");
    CNX (maxValueSpinner, "value_changed");
      
    CNX (outputValuesMenu, "changed");

    g_signal_connect(GTK_OBJECT(WID(previewSlider)), "value_changed",
                     GTK_SIGNAL_FUNC(frame_changed), 0);
    g_signal_connect(GTK_OBJECT(WID(previewVideo)), "expose_event",
                     GTK_SIGNAL_FUNC(gui_draw), 0);

    g_signal_connect(GTK_OBJECT(WID(previewVideo)), "button_press_event",
                     GTK_SIGNAL_FUNC(previewButtonEvent),
                     gpointer(myDialog));
#if 0
    g_signal_connect(GTK_OBJECT(WID(previewVideo)), "motion_notify_event",
                     GTK_SIGNAL_FUNC(previewMotionEvent),
                     gpointer(myDialog));
#endif

    GtkWidget * previewOutputMenu = WID(previewOutputMenu);
    uint32_t filter_count;
    FILTER * filters = getCurrentVideoFilterList (&filter_count);
    int32_t active = -1;

    // The " + (active < 0)" below is a bit of a hack.  We know that in
    // on_action() in gui_filtermanager.cpp, case A_ADD, the new filter-to-be
    // is added to the filter list without incrementing nb_active_filter yet.
    // So if we get to the end of the list and haven't yet found the filter
    // that we're configuring, we know it's a new one and therefore that it is
    // one past the apparent end of the list.  It's not a clean solution, but
    // it seems like the cleanEST solution.

    for (uint32_t i = 0; i < filter_count + (active < 0); i++)
    {
        const char * name
            = (i == 0) ? "(input)" : filterGetNameFromTag (filters [i].tag);
        bool free_name = false;
                                   
        FILTER * filter = filters + i;
        AVDMGenericVideoStream * source = filter->filter;
        uint32_t w = source->getInfo()->width;
        uint32_t h = source->getInfo()->height;
        if (w != width || h != height)
        {
            name = g_strconcat ("XX ", name, " XX", NULL);
            free_name = true;
        }

        printf ("filter [%d] = %s (%d) @ %p; %dx%d\n",
                i, name, filter->tag, source, w, h);
        gtk_combo_box_append_text (GTK_COMBO_BOX (previewOutputMenu), name);
        if (filter->filter == myDialog->getSource())
        {
            gtk_combo_box_set_active (GTK_COMBO_BOX (previewOutputMenu), i);
            printf ("\tfilter [%d] is being configured now\n", i);
            active = i;
        }

        if (free_name)
            g_free (const_cast <char *> (name));
    }

    ADM_assert (active >= 0);
    myDialog->this_filter_index = active;

    g_signal_connect (GTK_OBJECT(previewOutputMenu), "changed",
                      GTK_SIGNAL_FUNC(previewOutputMenuChange),
                      gpointer(myDialog));

    uint8_t ret = 0;
    int response = gtk_dialog_run(GTK_DIALOG(dialog));

    if (response == GTK_RESPONSE_OK)
    {
        myDialog->download();
        myDialog->pushParam();
        ret = 1;
    }
    else
        myDialog->restoreParam();

    gtk_unregister_dialog(dialog);
    gtk_widget_destroy(dialog);

    delete myDialog;

    return ret;
}
コード例 #19
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]);
}
コード例 #20
0
void EditorActionCreateNoteParagraph::apply (GtkTextTagTable * texttagtable, bool editable, EditorActionCreateParagraph * focused_paragraph, GtkWidget *& to_focus)
{
  // Horizontal box to store the note.
  hbox = gtk_hbox_new (false, 0);
  gtk_widget_show (hbox);
  gtk_box_pack_start(GTK_BOX(parent_vbox), hbox, false, false, 0);

  // Eventbox to catch a few events on the caller of the note.
  eventbox = gtk_event_box_new ();
  gtk_widget_show (eventbox);
  gtk_box_pack_start(GTK_BOX(hbox), eventbox, false, false, 0);
  g_signal_connect ((gpointer) eventbox, "enter_notify_event", G_CALLBACK (on_caller_enter_notify_event), gpointer (this));
  g_signal_connect ((gpointer) eventbox, "leave_notify_event", G_CALLBACK (on_caller_leave_notify_event), gpointer (this));

  // The background of the caller is going to be grey.
  // Courier font is chosen to make the spacing of the callers equal so they line up nicely.
  label = gtk_label_new ("");
  gtk_widget_show (label);
  char *markup = g_markup_printf_escaped("<span background=\"grey\" size=\"x-small\"> </span><span background=\"grey\" face=\"Courier\">%s</span><span background=\"grey\" size=\"x-small\"> </span>", caller_text.c_str());
  gtk_label_set_markup(GTK_LABEL(label), markup);
  g_free(markup);
  gtk_container_add (GTK_CONTAINER (eventbox), label);

  // The textbuffer uses the text tag table.
  textbuffer = gtk_text_buffer_new(texttagtable);

  // Text view to view the text buffer.
  textview = gtk_text_view_new_with_buffer(textbuffer);
  gtk_widget_show(textview);
  gtk_box_pack_start(GTK_BOX(hbox), textview, true, true, 0);

  // Set some parameters of the view.
  gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(textview), FALSE);
  gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD);
  gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), editable);
  gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 5);
  gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview), 5);

  // Move the widget to the right position. To be calculated.
  /*
    vector <GtkWidget *> widgets = editor_get_widgets (parent_vbox);
    gint new_paragraph_offset = 0;
    if (focused_paragraph) {
      for (unsigned int i = 0; i < widgets.size(); i++) {
        if (focused_paragraph->textview == widgets[i]) {
          new_paragraph_offset = i + 1;
          break;
        }
      }
    }
    gtk_box_reorder_child (GTK_BOX(parent_vbox), textview, new_paragraph_offset);
  */
  
  // Let the newly created textview be earmarked to grab focus
  // so that the user can type in it,
  // and the internal Editor logic knows about it.
  to_focus = textview;
}
コード例 #21
0
ファイル: gui.cpp プロジェクト: dynbit/TFOS
void GUI::setup_left_box(){
	// create label
	GtkWidget * cpu_frame;
	cpu_frame = gtk_frame_new ("CPU");
	
	// create cpu box
	GtkWidget * cpu_box;
	cpu_box = gtk_vbox_new (FALSE, 0);

	/*	IC REGISTER */	
	// ic box
	GtkWidget * ic_box;
	ic_box = gtk_hbox_new (FALSE, 0);
	// ic label 
	GtkWidget * ic_label;
	ic_label = gtk_label_new ("IC");
	gtk_widget_set_usize (ic_label, 80, 28);
	// create ic
        this->ic_buffer = gtk_entry_buffer_new (NULL, -1);
	this->ic = gtk_entry_new_with_buffer (this->ic_buffer);
	gtk_entry_set_editable (GTK_ENTRY(this->ic), FALSE);
	gtk_widget_set_can_focus (this->ic, FALSE);
	// add content to ic_box
	gtk_box_pack_start (GTK_BOX (ic_box), ic_label, FALSE, FALSE, 20);
	gtk_box_pack_start (GTK_BOX (ic_box), this->ic, FALSE, FALSE, 5);
	
	/*	ST REGISTER */
	// st box 
	GtkWidget * st_box;
	st_box = gtk_hbox_new (FALSE, 0);
	// ic label 
	GtkWidget * st_label;
	st_label = gtk_label_new ("ST");
	gtk_widget_set_usize (st_label, 80, 28);
	// create ic
        this->st_buffer = gtk_entry_buffer_new (NULL, -1);
	this->st = gtk_entry_new_with_buffer (this->st_buffer);
	gtk_entry_set_editable (GTK_ENTRY(this->st), FALSE);
	gtk_widget_set_can_focus (this->st, FALSE);
	// add content to ic_box
	gtk_box_pack_start (GTK_BOX (st_box), st_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (st_box), this->st, FALSE, FALSE, 5);
	
	// add ic_box to cpu box
	gtk_box_pack_start (GTK_BOX (cpu_box), ic_box, FALSE, FALSE, 5);
	gtk_box_pack_end (GTK_BOX (cpu_box), st_box, FALSE, FALSE, 5);
	
	// put cpu_box in cpu_frame
	gtk_container_add (GTK_CONTAINER (cpu_frame), cpu_box);

	// left top box
	GtkWidget * left_top_box;
	left_top_box = gtk_hbox_new (FALSE, 5);
	gtk_box_pack_start (GTK_BOX (left_top_box), cpu_frame, FALSE, FALSE, 0);
	this->left_box = gtk_vbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (this->left_box), left_top_box, FALSE, FALSE, 0);


        // CHANNELS

        // channels frame
	GtkWidget * channels_frame;
	channels_frame = gtk_frame_new ("CHANNELS");

        GtkWidget * channels_vbox;
        channels_vbox = gtk_vbox_new (FALSE, 5);


        // keyboard
        GtkWidget * kb_box;
	kb_box = gtk_hbox_new (FALSE, 0);
        GtkWidget * kb_label;
	kb_label = gtk_label_new ("KEYBOARD");
        gtk_widget_set_usize (kb_label, 80, 28);
        this->keyboard_channel = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY(this->keyboard_channel), FALSE);
	gtk_widget_set_can_focus (this->keyboard_channel, FALSE);
        gtk_box_pack_start (GTK_BOX (kb_box), kb_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (kb_box), this->keyboard_channel, FALSE, FALSE, 5);

        gtk_box_pack_start (GTK_BOX (channels_vbox ), kb_box, FALSE, FALSE, 0);


        // monitor
        GtkWidget * mn_box;
	mn_box = gtk_hbox_new (FALSE, 0);
        GtkWidget * mn_label;
	mn_label = gtk_label_new ("MONITOR");
        gtk_widget_set_usize (mn_label, 80, 28);
        this->monitor_channel = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY(this->monitor_channel), FALSE);
	gtk_widget_set_can_focus (this->monitor_channel, FALSE);
        gtk_box_pack_start (GTK_BOX (mn_box), mn_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (mn_box), this->monitor_channel, FALSE, FALSE, 5);
        gtk_box_pack_start (GTK_BOX (channels_vbox), mn_box, FALSE, FALSE, 0);

        // hdd
        GtkWidget * hdd_box;
	hdd_box = gtk_hbox_new (FALSE, 0);
        GtkWidget * hdd_label;
	hdd_label = gtk_label_new ("HDD");
        gtk_widget_set_usize (hdd_label, 80, 28);
        this->hdd_channel = gtk_entry_new ();
	gtk_entry_set_editable (GTK_ENTRY(this->hdd_channel), FALSE);
	gtk_widget_set_can_focus (this->hdd_channel, FALSE);
        gtk_box_pack_start (GTK_BOX (hdd_box), hdd_label, FALSE, FALSE, 20);
	gtk_box_pack_end (GTK_BOX (hdd_box), this->hdd_channel, FALSE, FALSE, 5);
        gtk_box_pack_start (GTK_BOX (channels_vbox), hdd_box, FALSE, FALSE, 0);


        gtk_container_add (GTK_CONTAINER (channels_frame), channels_vbox);
        gtk_box_pack_start (GTK_BOX (this->left_box), channels_frame, FALSE, FALSE, 0);
        
        GtkWidget * control_buttons;
        control_buttons = gtk_vbutton_box_new ();

        this->rm_mem_show_button = gtk_button_new_with_label("Show RM memory");
        g_signal_connect (this->rm_mem_show_button, "clicked", G_CALLBACK (GUI::rm_mem_show_button_clicked), gpointer(this));

        gtk_box_pack_start (GTK_BOX (control_buttons), this->rm_mem_show_button, FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (this->left_box), control_buttons, FALSE, FALSE, 0);

}
コード例 #22
0
ファイル: gui.cpp プロジェクト: dynbit/TFOS
void GUI::add_program_file(gchar * filepath){
    if (this->is_empty_notebook){
        this->is_empty_notebook = false;
        gtk_notebook_remove_page(GTK_NOTEBOOK(this->programs_notebook), this->empty_notebook_index);
    }
    GuiNotebookItem notebook_item;

    notebook_item.vmachine = NULL;
    notebook_item.filepath = filepath;
    // netobook label
    notebook_item.notebook_label_text = this->extract_file_name(notebook_item.filepath);
    notebook_item.notebook_label = gtk_label_new (notebook_item.notebook_label_text);

    // create inner notebook vbox
    notebook_item.notebook_vbox = gtk_vbox_new(FALSE, 0);
    
    // create scrolled_window
    notebook_item.notebook_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (notebook_item.notebook_scrolled_window),
                                    GTK_POLICY_AUTOMATIC,
                                    GTK_POLICY_AUTOMATIC);
    
    gtk_box_pack_start (GTK_BOX (notebook_item.notebook_vbox),
                        notebook_item.notebook_scrolled_window,
                        TRUE, // vbox gives widget all remaining space
                        TRUE, // widget expands to fill given space
                        0); // pixel of padding around the widget

    // create notebook_source_view
    notebook_item.source_buffer = gtk_source_buffer_new (NULL);
    
    notebook_item.source_view = gtk_source_view_new_with_buffer(notebook_item.source_buffer);
    gtk_container_add (GTK_CONTAINER (notebook_item.notebook_scrolled_window), notebook_item.source_view);

    gtk_source_view_set_auto_indent (   GTK_SOURCE_VIEW (notebook_item.source_view),
                                        TRUE);
    // make a tab be two spaces
    gtk_source_view_set_indent_width (GTK_SOURCE_VIEW (notebook_item.source_view),
                                        2);
    gtk_source_view_set_highlight_current_line (GTK_SOURCE_VIEW (notebook_item.source_view),
                                                TRUE);
    gtk_source_view_set_show_line_numbers ( GTK_SOURCE_VIEW (notebook_item.source_view),
                                            TRUE);
    gtk_source_view_set_right_margin_position ( GTK_SOURCE_VIEW (notebook_item.source_view),
                                                80); // default is 70 chars
    gtk_source_view_set_show_right_margin ( GTK_SOURCE_VIEW (notebook_item.source_view),
                                            TRUE);
    gtk_text_view_set_wrap_mode (   GTK_TEXT_VIEW (notebook_item.source_view),
                                    GTK_WRAP_WORD_CHAR);
    gtk_text_view_set_editable  (   GTK_TEXT_VIEW (notebook_item.source_view),
                                    FALSE);
    gtk_text_view_set_cursor_visible (  GTK_TEXT_VIEW (notebook_item.source_view),
                                        FALSE);

    /* setup view */
    PangoFontDescription * font_desc = NULL;
    font_desc = pango_font_description_from_string ("monospace");
    if (font_desc != NULL){
        gtk_widget_modify_font (notebook_item.source_view, font_desc);
        pango_font_description_free (font_desc);
    }


    // get file content
    gchar * buffer;
    GError * error_here = NULL;

    if (g_file_get_contents (notebook_item.filepath, &buffer, NULL, &error_here)){
        gtk_source_buffer_begin_not_undoable_action (notebook_item.source_buffer);
        gtk_source_buffer_begin_not_undoable_action (notebook_item.source_buffer);
        gtk_text_buffer_set_text (GTK_TEXT_BUFFER (notebook_item.source_buffer), buffer, -1);
        gtk_source_buffer_end_not_undoable_action (notebook_item.source_buffer);
        gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (notebook_item.source_buffer), FALSE);

        /* move cursor to the beginning */
        gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (notebook_item.source_buffer), &notebook_item.iter);
        gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (notebook_item.source_buffer), &notebook_item.iter);
        
        {
            GtkTextIter start, end;
            char *text;
            gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (notebook_item.source_buffer), &start, &end);
            text = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (notebook_item.source_buffer), &start, &end, TRUE);
            g_assert (!strcmp (text, buffer));
            g_free (text);
        }
        g_free (buffer);


        GtkWidget * vm_frame;
        vm_frame = gtk_frame_new ("VM operations");

        // create buttons
        notebook_item.notebook_button_hbox = gtk_hbox_new (FALSE, 0);
        notebook_item.run_step_button = gtk_button_new_with_label ("Run Step");
        notebook_item.run_button = gtk_button_new_with_label ("Run");
        notebook_item.view_vm_mem = gtk_button_new_with_label ("View Vm memory");

        // create time out input
        notebook_item.timeout_field = gtk_entry_new_with_max_length(10);

        GtkWidget * timeout_label;
        timeout_label = gtk_label_new("Timeout:");


        g_signal_connect (notebook_item.run_step_button, "clicked", G_CALLBACK (GUI::run_step_button_clicked), gpointer(this));
        g_signal_connect (notebook_item.run_button, "clicked", G_CALLBACK (GUI::run_button_clicked), gpointer(this));
        g_signal_connect (notebook_item.view_vm_mem, "clicked", G_CALLBACK (GUI::view_vm_mem_clicked), gpointer(this));


        gtk_box_pack_start (GTK_BOX (notebook_item.notebook_button_hbox),
                            notebook_item.view_vm_mem,
                            FALSE, // vbox gives widget all remaining space
                            FALSE, // widget expands to fill given space
                            5); // pixel of padding around the widget

        gtk_box_pack_start (GTK_BOX (notebook_item.notebook_button_hbox),
                            notebook_item.run_step_button,
                            FALSE, // vbox gives widget all remaining space
                            FALSE, // widget expands to fill given space
                            5); // pixel of padding around the widget

        gtk_box_pack_start (GTK_BOX (notebook_item.notebook_button_hbox),
                            timeout_label,
                            FALSE, // vbox gives widget all remaining space
                            FALSE, // widget expands to fill given space
                            5); // pixel of padding around the widget

        gtk_box_pack_start (GTK_BOX (notebook_item.notebook_button_hbox),
                            notebook_item.timeout_field,
                            FALSE, // vbox gives widget all remaining space
                            FALSE, // widget expands to fill given space
                            5); // pixel of padding around the widget

        gtk_box_pack_start (GTK_BOX (notebook_item.notebook_button_hbox),
                            notebook_item.run_button,
                            FALSE, // vbox gives widget all remaining space
                            FALSE, // widget expands to fill given space
                            5); // pixel of padding around the widget

        gtk_container_add(GTK_CONTAINER (vm_frame), notebook_item.notebook_button_hbox);
        
        gtk_box_pack_start (GTK_BOX (notebook_item.notebook_vbox),
                            vm_frame,
                            FALSE, // vbox gives widget all remaining space
                            FALSE, // widget expands to fill given space
                            5);

        gtk_notebook_append_page(   GTK_NOTEBOOK(this->programs_notebook),
                                    notebook_item.notebook_vbox,
                                    notebook_item.notebook_label);
        this->gui_notebook_item_list.push_back(notebook_item);
        gtk_widget_show_all(this->programs_notebook);
    } else {
        g_print("WRONG \n");
    }
}
コード例 #23
0
ファイル: gui.cpp プロジェクト: dynbit/TFOS
void GUI::setup_right_box(){
	this->right_box = gtk_vbox_new (FALSE, 0);
	
	// 
	GtkWidget * vm_programs_frame;
	vm_programs_frame = gtk_frame_new ("Add VM program");

	GtkWidget * add_file_vbox;
	add_file_vbox = gtk_vbox_new(FALSE, 0);

	// p_files_box
	GtkWidget * add_file_box;
	add_file_box = gtk_hbox_new(FALSE, 0);
	
	// add file button
        this->add_chooser_filter = gtk_file_filter_new ();
        gtk_file_filter_add_pattern (this->add_chooser_filter, "*.prg");

	this->add_chooser =  gtk_file_chooser_button_new ( "Select a file", GTK_FILE_CHOOSER_ACTION_OPEN);
            
        gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(this->add_chooser), this->add_chooser_filter);
	gtk_widget_set_usize (this->add_chooser, 250, 28);
	gtk_box_pack_start (GTK_BOX (add_file_box), this->add_chooser, FALSE, FALSE, 5);
	
	this->add_file = gtk_button_new_with_label("Add");
        g_signal_connect (this->add_file, "clicked", G_CALLBACK (GUI::add_file_clicked), gpointer(this));
	gtk_widget_set_usize (this->add_file, 100, 28);
	gtk_box_pack_start (GTK_BOX (add_file_box), this->add_file, FALSE, FALSE, 5);
	
	gtk_box_pack_start (GTK_BOX (add_file_vbox), add_file_box, FALSE, FALSE, 5);
	// add 
	gtk_container_add (GTK_CONTAINER (vm_programs_frame), add_file_vbox);

	// add vm_programs_frame to right_box
	gtk_box_pack_start (GTK_BOX (this->right_box), vm_programs_frame, FALSE, FALSE, 0);

	// programs notebook
	this->programs_notebook = gtk_notebook_new();
        gtk_widget_set_usize (this->programs_notebook, 600, 400);

        gtk_box_pack_start (GTK_BOX (this->right_box), this->programs_notebook, FALSE, FALSE, 5);
        
}
コード例 #24
0
MacWidget::~MacWidget()
{
    // No longer listen to synchronous messages.
    Gst::ScopedObject<GstBus> bus(gst_pipeline_get_bus(GST_PIPELINE(mPipeline)));
    gst_bus_disable_sync_message_emission(bus.get());
    g_signal_handlers_disconnect_by_func(bus.get(), (void*)G_CALLBACK(&MacWidget::OnSyncMessage), gpointer(this));
}
コード例 #25
0
MacWidget::MacWidget(GstElement * inPipeline, WindowId) :
    mPipeline(inPipeline)
{
    // Listen to synchronous messages
    Gst::ScopedObject<GstBus> bus(gst_pipeline_get_bus(GST_PIPELINE(mPipeline)));
    gst_bus_enable_sync_message_emission(bus.get());
    g_signal_connect(bus.get(), "sync-message::element", G_CALLBACK(&MacWidget::OnSyncMessage), gpointer(this));
}
コード例 #26
0
uint8_t DIA_particle (AVDMGenericVideoStream *in,
                      ADMVideoParticle * particlep,
                      PARTICLE_PARAM * param,
                      const MenuMapping * menu_mapping,
                      uint32_t menu_mapping_count)
{
    // Allocate space for preview video
    uint32_t width = in->getInfo()->width;
    uint32_t height = in->getInfo()->height;

    dialog = create_particle_dialog();

	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
								GTK_RESPONSE_OK,
								GTK_RESPONSE_CANCEL,
								-1);
    gtk_register_dialog (dialog);
    gtk_window_set_title (GTK_WINDOW (dialog),
                          QT_TR_NOOP("Particle Analysis Configuration"));
    gtk_widget_show (dialog);	

    // Fix up a bunch of things that Glade can't do.  This is less efficient
    // than just editing the Glade output, but it's not that big a deal and
    // doing it this way makes it MUCH easier to use Glade to tweak the layout
    // later.

    // actually, nothing to fix up in this one.  But if there ever is, this is
    // the place to do it...

    flyParticle * myDialog
        = new flyParticle (width, height, in,
                           WID(previewVideo), WID(previewSlider),
                           GTK_DIALOG(dialog), particlep, param,
                           menu_mapping, menu_mapping_count);

    g_signal_connect (GTK_OBJECT (WID(previewVideo)), "configure-event",
                      GTK_SIGNAL_FUNC (preview_video_configured),
                      gpointer (myDialog));

    myDialog->upload();
    myDialog->sliderChanged();

    g_signal_connect (GTK_OBJECT(WID(outputFileBrowseButton)), "clicked",
                      GTK_SIGNAL_FUNC(browse_button_clicked),
                      gpointer(myDialog));

    // update things when settings are changed
#define CNX(_widg,_signame) \
    g_signal_connect (GTK_OBJECT(WID(_widg)), _signame,                \
                      GTK_SIGNAL_FUNC(gui_update), gpointer(myDialog));

    CNX (minAreaSpinButton, "value_changed");
    CNX (maxAreaSpinButton, "value_changed");
    CNX (leftCropSpinButton, "value_changed");
    CNX (rightCropSpinButton, "value_changed");
    CNX (topCropSpinButton, "value_changed");
    CNX (bottomCropSpinButton, "value_changed");

    g_signal_connect (GTK_OBJECT(WID(previewSlider)), "value_changed",
                      GTK_SIGNAL_FUNC(frame_changed), gpointer(myDialog));
    g_signal_connect (GTK_OBJECT(WID(previewVideo)), "expose_event",
                      GTK_SIGNAL_FUNC(gui_draw), gpointer(myDialog));

    g_signal_connect (GTK_OBJECT(WID(previewVideo)), "button_press_event",
                      GTK_SIGNAL_FUNC(previewButtonEvent),
                      gpointer(myDialog));
#if 0
    g_signal_connect (GTK_OBJECT(WID(previewVideo)), "motion_notify_event",
                      GTK_SIGNAL_FUNC(previewMotionEvent),
                      gpointer(myDialog));
#endif

    GtkWidget * previewOutputMenu = WID(previewOutputMenu);
    uint32_t filter_count;
    FILTER * filters = getCurrentVideoFilterList (&filter_count);
    int32_t active = -1;

    // The " + (active < 0)" below is a bit of a hack.  We know that in
    // on_action() in gui_filtermanager.cpp, case A_ADD, the new filter-to-be
    // is added to the filter list without incrementing nb_active_filter yet.
    // So if we get to the end of the list and haven't yet found the filter
    // that we're configuring, we know it's a new one and therefore that it is
    // one past the apparent end of the list.  It's not a clean solution, but
    // it seems like the cleanEST solution.

    for (uint32_t i = 0; i < filter_count + (active < 0); i++)
    {
        const char * name
            = (i == 0) ? "(input)" : filterGetNameFromTag (filters [i].tag);
        bool free_name = false;
                                   
        FILTER * filter = filters + i;
        AVDMGenericVideoStream * source = filter->filter;
        uint32_t w = source->getInfo()->width;
        uint32_t h = source->getInfo()->height;
        if (w != width || h != height)
        {
            name = g_strconcat ("XX ", name, " XX", NULL);
            free_name = true;
        }

        printf ("filter [%d] = %s (%d) @ %p; %dx%d\n",
                i, name, filter->tag, source, w, h);
        gtk_combo_box_append_text (GTK_COMBO_BOX (previewOutputMenu), name);
        if (filter->filter == myDialog->getSource())
        {
            gtk_combo_box_set_active (GTK_COMBO_BOX (previewOutputMenu), i);
            printf ("\tfilter [%d] is being configured now\n", i);
            active = i;
        }

        if (free_name)
            g_free (const_cast <char *> (name));
    }

    ADM_assert (active >= 0);
    myDialog->this_filter_index = active;

    g_signal_connect (GTK_OBJECT(previewOutputMenu), "changed",
                      GTK_SIGNAL_FUNC(previewOutputMenuChange),
                      gpointer(myDialog));

    uint8_t ret = 0;
    int response = gtk_dialog_run(GTK_DIALOG(dialog));

    if (response == GTK_RESPONSE_OK)
    {
        myDialog->download();
        myDialog->pushParam();
        ret = 1;
    }
    else
        myDialog->restoreParam();

    gtk_unregister_dialog(dialog);
    gtk_widget_destroy(dialog);

    delete myDialog;

    return ret;
}
コード例 #27
0
TextReplacementDialog::TextReplacementDialog(int dummy)
{
  // Get configurations.
  extern Settings *settings;

  // Shortcuts.
  Shortcuts shortcuts(0);

  textreplacementdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(textreplacementdialog), _("Text Replacement"));
  gtk_window_set_position(GTK_WINDOW(textreplacementdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_modal(GTK_WINDOW(textreplacementdialog), TRUE);
  gtk_window_set_type_hint(GTK_WINDOW(textreplacementdialog), GDK_WINDOW_TYPE_HINT_DIALOG);

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

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

  checkbutton1 = gtk_check_button_new_with_mnemonic(_("Replace text when printing and exporting"));
  gtk_widget_show(checkbutton1);
  gtk_box_pack_start(GTK_BOX(vbox1), checkbutton1, FALSE, FALSE, 0);

  shortcuts.button(checkbutton1);
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton1), settings->genconfig.text_replacement_get());

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

  treeview1 = gtk_tree_view_new();
  gtk_widget_show(treeview1);
  gtk_container_add(GTK_CONTAINER(scrolledwindow1), treeview1);
  gtk_tree_view_set_reorderable(GTK_TREE_VIEW(treeview1), TRUE);

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

  new InDialogHelp(textreplacementdialog, NULL, &shortcuts, "menu-preferences/text-replacement");

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

  shortcuts.stockbutton(cancelbutton1);

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

  shortcuts.stockbutton(okbutton1);

  shortcuts.process();

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

  gtk_widget_grab_focus(okbutton1);
  gtk_widget_grab_default(okbutton1);

  // Toggle button.
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton1), settings->genconfig.text_replacement_get());

  // Storage, renderer, column and selection.
  model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_BOOLEAN);
  gtk_tree_view_set_model(GTK_TREE_VIEW(treeview1), GTK_TREE_MODEL(model));
  g_object_unref(model);
  GtkCellRenderer *renderer1 = gtk_cell_renderer_text_new();
  g_signal_connect(renderer1, "edited", G_CALLBACK(cell_text_edited), gpointer(this));

  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview1), -1, "Texts", renderer1, "text", COLUMN_ORIGINALS, "editable", COLUMN_EDITABLE1, NULL);

  GtkCellRenderer *renderer2 = gtk_cell_renderer_text_new();
  g_signal_connect(renderer2, "edited", G_CALLBACK(cell_replacement_edited), gpointer(this));

  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview1), -1, "Replacements", renderer2, "text", COLUMN_REPLACEMENTS, "editable", COLUMN_EDITABLE2, NULL);

  gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview1)), GTK_SELECTION_SINGLE);

  // Load texts and replacements - these get initialized to defaults if there were none.
  vector < ustring > originals;
  vector < ustring > replacements;
  text_replacement_get_words(originals, replacements);

  GtkTreeIter iter;
  for (unsigned int i = 0; i < originals.size(); i++) {
    gtk_list_store_append(model, &iter);
    gtk_list_store_set(model, &iter, COLUMN_ORIGINALS, originals[i].c_str(), COLUMN_EDITABLE1, 1, COLUMN_REPLACEMENTS, replacements[i].c_str(), COLUMN_EDITABLE2, 1, -1);
  }

  gui();

  new DialogAutoScaler (textreplacementdialog, G_MAXINT);
}
コード例 #28
0
ファイル: dialogwordlist.cpp プロジェクト: alerque/bibledit
WordlistDialog::WordlistDialog(int dummy)
{
  extern Settings *settings;

  Shortcuts shortcuts(0);

  wordlistdialog = gtk_dialog_new();
  gtk_window_set_title(GTK_WINDOW(wordlistdialog), _("Wordlists"));
  gtk_window_set_position(GTK_WINDOW(wordlistdialog), GTK_WIN_POS_CENTER_ON_PARENT);
  gtk_window_set_modal(GTK_WINDOW(wordlistdialog), TRUE);

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

  label1 = gtk_label_new(_("This updates the word list entries in the text and generates lists of them"));
  gtk_widget_show(label1);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), label1, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label1), 0, 0.5);

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

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

  checkbutton_wordlist = gtk_check_button_new_with_mnemonic(_("Process general word list"));
  gtk_widget_show(checkbutton_wordlist);
  gtk_box_pack_start(GTK_BOX(vbox2), checkbutton_wordlist, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_wordlist);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_wordlist), settings->genconfig.wordlist_process_general_get());

  label3 = gtk_label_new(_("Insert list between markers \\zopenwordlist and \\zclosewordlist"));
  gtk_widget_show(label3);
  gtk_box_pack_start(GTK_BOX(vbox2), label3, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);

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

  checkbutton_asterisk_general = gtk_check_button_new_with_mnemonic(_("Add an asterisk to each word entry"));
  gtk_widget_show(checkbutton_asterisk_general);
  gtk_box_pack_start(GTK_BOX(hbox1), checkbutton_asterisk_general, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_asterisk_general);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_asterisk_general), settings->genconfig.wordlist_general_asterisk_get());

  checkbutton_general_first_time = gtk_check_button_new_with_mnemonic(_("the first time it occurs in a section"));
  gtk_widget_show(checkbutton_general_first_time);
  gtk_box_pack_start(GTK_BOX(hbox1), checkbutton_general_first_time, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_general_first_time);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_general_first_time), settings->genconfig.wordlist_general_asterisk_first_get());

  hseparator3 = gtk_hseparator_new();
  gtk_widget_show(hseparator3);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), hseparator3, TRUE, TRUE, 0);

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

  checkbutton_hebrew_wordlist = gtk_check_button_new_with_mnemonic(_("Process Hebrew word list"));
  gtk_widget_show(checkbutton_hebrew_wordlist);
  gtk_box_pack_start(GTK_BOX(vbox3), checkbutton_hebrew_wordlist, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_hebrew_wordlist);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_hebrew_wordlist), settings->genconfig.wordlist_process_hebrew_get());

  label4 = gtk_label_new(_("Insert the list between markers \\zopenhebrewwordlist and \\zclosehebrewwordlist"));
  gtk_widget_show(label4);
  gtk_box_pack_start(GTK_BOX(vbox3), label4, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label4), 0, 0.5);

  hbox2 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox2);
  gtk_box_pack_start(GTK_BOX(vbox3), hbox2, TRUE, TRUE, 0);

  checkbutton_asterisk_hebrew = gtk_check_button_new_with_mnemonic(_("Add an asterisk to each word entry"));
  gtk_widget_show(checkbutton_asterisk_hebrew);
  gtk_box_pack_start(GTK_BOX(hbox2), checkbutton_asterisk_hebrew, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_asterisk_hebrew);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_asterisk_hebrew), settings->genconfig.wordlist_hebrew_asterisk_get());

  checkbutton_hebrew_firsttime = gtk_check_button_new_with_mnemonic(_("the first time it occurs in a section"));
  gtk_widget_show(checkbutton_hebrew_firsttime);
  gtk_box_pack_start(GTK_BOX(hbox2), checkbutton_hebrew_firsttime, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_hebrew_firsttime);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_hebrew_firsttime), settings->genconfig.wordlist_hebrew_asterisk_first_get());

  hseparator4 = gtk_hseparator_new();
  gtk_widget_show(hseparator4);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), hseparator4, TRUE, TRUE, 0);

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

  checkbutton_greek_wordlist = gtk_check_button_new_with_mnemonic(_("Process Greek word list"));
  gtk_widget_show(checkbutton_greek_wordlist);
  gtk_box_pack_start(GTK_BOX(vbox4), checkbutton_greek_wordlist, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_greek_wordlist);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_greek_wordlist), settings->genconfig.wordlist_process_greek_get());

  label5 = gtk_label_new(_("Insert the list between markers \\zopengreekwordlist and \\zclosegreekwordlist"));
  gtk_widget_show(label5);
  gtk_box_pack_start(GTK_BOX(vbox4), label5, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label5), 0, 0.5);

  hbox3 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox3);
  gtk_box_pack_start(GTK_BOX(vbox4), hbox3, TRUE, TRUE, 0);

  checkbutton_asterisk_greek = gtk_check_button_new_with_mnemonic(_("Add an asterisk to each word entry"));
  gtk_widget_show(checkbutton_asterisk_greek);
  gtk_box_pack_start(GTK_BOX(hbox3), checkbutton_asterisk_greek, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_asterisk_greek);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_asterisk_greek), settings->genconfig.wordlist_greek_asterisk_get());

  checkbutton_greek_first_time = gtk_check_button_new_with_mnemonic(_("the first time it occurs in a section"));
  gtk_widget_show(checkbutton_greek_first_time);
  gtk_box_pack_start(GTK_BOX(hbox3), checkbutton_greek_first_time, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_greek_first_time);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_greek_first_time), settings->genconfig.wordlist_greek_asterisk_first_get());

  hseparator6 = gtk_hseparator_new();
  gtk_widget_show(hseparator6);
  gtk_box_pack_start(GTK_BOX(dialog_vbox1), hseparator6, TRUE, TRUE, 0);

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

  checkbutton_index = gtk_check_button_new_with_mnemonic(_("Process index"));
  gtk_widget_show(checkbutton_index);
  gtk_box_pack_start(GTK_BOX(vbox6), checkbutton_index, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_index);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_index), settings->genconfig.wordlist_process_index_get());

  label6 = gtk_label_new(_("Insert the list between markers \\zopenindex and \\zcloseindex"));
  gtk_widget_show(label6);
  gtk_box_pack_start(GTK_BOX(vbox6), label6, FALSE, FALSE, 0);
  gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5);

  hbox6 = gtk_hbox_new(FALSE, 0);
  gtk_widget_show(hbox6);
  gtk_box_pack_start(GTK_BOX(vbox6), hbox6, TRUE, TRUE, 0);

  checkbutton_asterisk_index = gtk_check_button_new_with_mnemonic(_("Add an asterisk to each word entry"));
  gtk_widget_show(checkbutton_asterisk_index);
  gtk_box_pack_start(GTK_BOX(hbox6), checkbutton_asterisk_index, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_asterisk_index);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_asterisk_index), settings->genconfig.wordlist_index_asterisk_get());

  checkbutton_index_first_time = gtk_check_button_new_with_mnemonic(_("the first time it occurs in a chapter"));
  gtk_widget_show(checkbutton_index_first_time);
  gtk_box_pack_start(GTK_BOX(hbox6), checkbutton_index_first_time, FALSE, FALSE, 0);

  shortcuts.button(checkbutton_index_first_time);

  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton_index_first_time), settings->genconfig.wordlist_index_asterisk_first_get());

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

  new InDialogHelp(wordlistdialog, NULL, &shortcuts, "tools/generate-word-lists");

  cancelbutton = gtk_button_new_from_stock("gtk-cancel");
  gtk_widget_show(cancelbutton);
  gtk_dialog_add_action_widget(GTK_DIALOG(wordlistdialog), 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(wordlistdialog), okbutton, GTK_RESPONSE_OK);
  gtk_widget_set_can_default (GTK_WIDGET (okbutton), true);

  shortcuts.stockbutton(cancelbutton);
  shortcuts.stockbutton(okbutton);
  shortcuts.process();

  g_signal_connect((gpointer) checkbutton_wordlist, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) checkbutton_asterisk_general, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) checkbutton_hebrew_wordlist, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) checkbutton_asterisk_hebrew, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) checkbutton_greek_wordlist, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) checkbutton_asterisk_greek, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) checkbutton_index, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) checkbutton_asterisk_index, "toggled", G_CALLBACK(on_checkbutton_toggled), gpointer(this));
  g_signal_connect((gpointer) okbutton, "clicked", G_CALLBACK(on_okbutton_clicked), gpointer(this));

  gtk_widget_grab_focus(okbutton);
  gtk_widget_grab_default(okbutton);

  gui();
}
コード例 #29
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);
}
コード例 #30
0
ファイル: webkitbrowser.cpp プロジェクト: alerque/bibledit
WebkitBrowser::WebkitBrowser(GtkWidget * parent_vbox)
{
  // Save and initialize variables.
  vbox = parent_vbox;
  last_focused_time = 0;

  toolbar = gtk_toolbar_new ();
  gtk_widget_show (toolbar);
  gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH);

  toolitem_back = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem_back);
  gtk_container_add (GTK_CONTAINER (toolbar), toolitem_back);

  button_back = gtk_button_new ();
  gtk_widget_show (button_back);
  gtk_container_add (GTK_CONTAINER (toolitem_back), button_back);

  image_back = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image_back);
  gtk_container_add (GTK_CONTAINER (button_back), image_back);

  toolitem_forward = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem_forward);
  gtk_container_add (GTK_CONTAINER (toolbar), toolitem_forward);

  button_forward = gtk_button_new ();
  gtk_widget_show (button_forward);
  gtk_container_add (GTK_CONTAINER (toolitem_forward), button_forward);

  image_forward = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image_forward);
  gtk_container_add (GTK_CONTAINER (button_forward), image_forward);

  toolitem_refresh = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem_refresh);
  gtk_container_add (GTK_CONTAINER (toolbar), toolitem_refresh);

  button_refresh = gtk_button_new ();
  gtk_widget_show (button_refresh);
  gtk_container_add (GTK_CONTAINER (toolitem_refresh), button_refresh);

  image_refresh = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image_refresh);
  gtk_container_add (GTK_CONTAINER (button_refresh), image_refresh);

  toolitem_stop = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem_stop);
  gtk_container_add (GTK_CONTAINER (toolbar), toolitem_stop);

  button_stop = gtk_button_new ();
  gtk_widget_show (button_stop);
  gtk_container_add (GTK_CONTAINER (toolitem_stop), button_stop);

  image_stop = gtk_image_new_from_stock ("gtk-stop", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image_stop);
  gtk_container_add (GTK_CONTAINER (button_stop), image_stop);

  toolitem_home = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem_home);
  gtk_container_add (GTK_CONTAINER (toolbar), toolitem_home);

  button_home = gtk_button_new ();
  gtk_widget_show (button_home);
  gtk_container_add (GTK_CONTAINER (toolitem_home), button_home);
  gtk_button_set_focus_on_click (GTK_BUTTON (button_home), FALSE);

  image_home = gtk_image_new_from_stock ("gtk-home", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image_home);
  gtk_container_add (GTK_CONTAINER (button_home), image_home);

  toolitem_url = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem_url);
  gtk_tool_item_set_expand (GTK_TOOL_ITEM (toolitem_url), TRUE);
  gtk_container_add (GTK_CONTAINER (toolbar), toolitem_url);

  entry_url = gtk_entry_new ();
  gtk_widget_show (entry_url);
  gtk_container_add (GTK_CONTAINER (toolitem_url), entry_url);
  gtk_entry_set_invisible_char (GTK_ENTRY (entry_url), 9679);

  toolitem_enter = (GtkWidget*) gtk_tool_item_new ();
  gtk_widget_show (toolitem_enter);
  gtk_container_add (GTK_CONTAINER (toolbar), toolitem_enter);

  button_enter = gtk_button_new ();
  gtk_widget_show (button_enter);
  gtk_container_add (GTK_CONTAINER (toolitem_enter), button_enter);

  image_enter = gtk_image_new_from_stock ("gtk-ok", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image_enter);
  gtk_container_add (GTK_CONTAINER (button_enter), image_enter);

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

  webview = webkit_web_view_new();
  gtk_widget_show(webview);
  gtk_container_add(GTK_CONTAINER(scrolledwindow), webview);

  notebook = gtk_notebook_new ();
  gtk_widget_show (notebook);
  gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0);
  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
  gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);

  label_status = gtk_label_new ("");
  gtk_widget_show (label_status);
  gtk_container_add (GTK_CONTAINER (notebook), label_status);
  gtk_label_set_ellipsize (GTK_LABEL (label_status), PANGO_ELLIPSIZE_MIDDLE);

  progressbar = gtk_progress_bar_new ();
  gtk_widget_show (progressbar);
  gtk_container_add (GTK_CONTAINER (notebook), progressbar);
  gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (progressbar), PANGO_ELLIPSIZE_MIDDLE);

  // Set gui as if loading has finished, so that the sensitivitiy of buttons gets right.
  load_finished (NULL, NULL);

  // Signals.
  g_signal_connect ((gpointer) button_back, "clicked", G_CALLBACK (on_button_back_clicked), gpointer (this));
  g_signal_connect ((gpointer) button_forward, "clicked", G_CALLBACK (on_button_forward_clicked), gpointer (this));
  g_signal_connect ((gpointer) button_refresh, "clicked", G_CALLBACK (on_button_refresh_clicked), gpointer (this));
  g_signal_connect ((gpointer) button_stop, "clicked", G_CALLBACK (on_button_stop_clicked), gpointer (this));
  g_signal_connect ((gpointer) button_home, "clicked", G_CALLBACK (on_button_home_clicked), gpointer (this));
  g_signal_connect ((gpointer) entry_url, "activate", G_CALLBACK (on_entry_url_activate), gpointer (this));
  g_signal_connect ((gpointer) button_enter, "clicked", G_CALLBACK (on_button_enter_clicked), gpointer (this));
  g_signal_connect(G_OBJECT(webview), "grab_focus", G_CALLBACK(on_webview_grab_focus), gpointer(this));
  g_signal_connect (G_OBJECT (webview), "load-committed", G_CALLBACK (load_commit_cb), gpointer(this));
  g_signal_connect (G_OBJECT (webview), "load-started", G_CALLBACK (load_started_cb), gpointer(this));
  g_signal_connect (G_OBJECT (webview), "load-progress-changed", G_CALLBACK (progress_change_cb), gpointer(this));
  g_signal_connect (G_OBJECT (webview), "load-finished", G_CALLBACK (load_finished_cb), gpointer(this));
  g_signal_connect (G_OBJECT (webview), "hovering-over-link", G_CALLBACK (link_hover_cb), gpointer(this));
}