Example #1
0
static void
on_druid_get_new_page (AnjutaAutogen* gen, gpointer data)
{
	NPWDruid* druid = (NPWDruid *)data;
	gint current;
	NPWPage* page;

	current = gtk_assistant_get_current_page (GTK_ASSISTANT (druid->window));
	page = g_queue_peek_nth (druid->page_list, current - (druid->no_selection ? 0 : 1));

	if (npw_page_get_name (page) == NULL)
	{
		/* no page, display finish page */
		npw_druid_fill_summary_page (druid);

		page = g_queue_pop_nth (druid->page_list, current - (druid->no_selection ? 0 : 1));
		if (page != NULL) npw_page_free (page);
		gtk_container_remove (GTK_CONTAINER (druid->window), gtk_assistant_get_nth_page (GTK_ASSISTANT (druid->window), current + 1));
		gtk_assistant_set_current_page (GTK_ASSISTANT (druid->window), current + 1);
	}
	else
	{
		/* display property page */
		npw_druid_fill_property_page (druid, page);

		gtk_assistant_set_current_page (GTK_ASSISTANT (druid->window), current + 1);
	}
}
Example #2
0
/** This function is called before the Update page is presented to the
 *  user. It gets the active button from the Method page and uses this
 *  to either add the path strings or jump to the install page.  
 */
void
assistant_gconf_update_prep (GtkAssistant *assistant, gpointer user_data)
{
    gconf_data *data = user_data;
    GtkTextBuffer *textbuffer;
    GtkWidget *textview;
    gchar *msg;
    gchar *gconfdir = gnc_path_get_gconfdir (TRUE);

    gint num = gtk_assistant_get_current_page (assistant);
    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);

    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->update_path)))
    {
        g_object_set_data(G_OBJECT(assistant), HOW, GINT_TO_POINTER(HOW_UPDATE));

        textview = data->update_text;
        textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
        msg = g_strdup_printf(PATH_STRING1 PATH_STRING2, gconfdir);
        gtk_text_buffer_set_text(textbuffer, msg, -1);
        g_free (gconfdir);
    }
    else
    {
        g_object_set_data(G_OBJECT(assistant), HOW, GINT_TO_POINTER(HOW_INSTALL));
        gtk_assistant_set_current_page (assistant, num + 2);
    }
}
Example #3
0
static void
account_assistant_present_error_page (EmpathyAccountAssistant *self,
    GError *error, gint page_num)
{
  GtkWidget *error_page, *back_button;
  gint num;

  error_page = account_assistant_build_error_page (self, error,
      page_num);
  num = gtk_assistant_append_page (GTK_ASSISTANT (self), error_page);
  gtk_assistant_set_page_title (GTK_ASSISTANT (self), error_page,
      _("An error occurred"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (self), error_page,
      GTK_ASSISTANT_PAGE_SUMMARY);

  back_button = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
  gtk_assistant_add_action_widget (GTK_ASSISTANT (self), back_button);
  g_object_set_data (G_OBJECT (back_button),
      "page-num", GINT_TO_POINTER (page_num));
  g_signal_connect (back_button, "clicked",
      G_CALLBACK (account_assistant_back_button_clicked_cb), self);
  gtk_widget_show (back_button);

  gtk_assistant_set_current_page (GTK_ASSISTANT (self), num);
}
Example #4
0
JNIEXPORT void JNICALL
Java_org_gnome_gtk_GtkAssistant_gtk_1assistant_1set_1current_1page
(
	JNIEnv* env,
	jclass cls,
	jlong _self,
	jint _pageNum
)
{
	GtkAssistant* self;
	gint pageNum;

	// convert parameter self
	self = (GtkAssistant*) _self;

	// convert parameter pageNum
	pageNum = (gint) _pageNum;

	// call function
	gtk_assistant_set_current_page(self, pageNum);

	// cleanup parameter self

	// cleanup parameter pageNum
}
Example #5
0
/** This function is called before the Step over page is presented to the
 *  user. It allows the jumping of the install page.
 */
void
assistant_gconf_step_prep (GtkAssistant *assistant, gpointer user_data)
{
    gconf_data *data = user_data;
    gint num = gtk_assistant_get_current_page (assistant);
    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);
    gtk_assistant_set_current_page (assistant, num + 2);
}
static void show_error_summary(TyonXceleratorCalibrationAssistant *assistant, gchar const * text) {
	TyonXceleratorCalibrationAssistantPrivate *priv = assistant->priv;
	gtk_label_set_text(priv->summary_label, text);
	gtk_assistant_set_current_page(GTK_ASSISTANT(assistant), priv->summary_page_index);
#if (GTK_CHECK_VERSION(2, 22, 0))
	gtk_assistant_commit(GTK_ASSISTANT(assistant));
#endif
}
Example #7
0
static void
account_assistant_back_button_clicked_cb (GtkButton *button,
    EmpathyAccountAssistant *self)
{
  gint page_num;

  page_num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
          "page-num"));
  gtk_assistant_remove_action_widget (GTK_ASSISTANT (self),
      GTK_WIDGET (button));
  gtk_assistant_set_current_page (GTK_ASSISTANT (self), page_num);
}
void
ap_assistant_finish (GtkAssistant *assistant, gpointer user_data)
{
    AcctPeriodInfo *info = user_data;
    GtkTextBuffer * buffer;
    GtkTextIter startiter, enditer;
    gint len;
    const char *btitle;
    char *bnotes;
    Timespec closing_date;

    ENTER("info=%p", info);

    btitle = gtk_entry_get_text (GTK_ENTRY(info->book_title));
    buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(info->book_notes));
    len = gtk_text_buffer_get_char_count (buffer);
    gtk_text_buffer_get_iter_at_offset(buffer, &startiter, 0);
    gtk_text_buffer_get_iter_at_offset(buffer, &enditer, len);

    bnotes = gtk_text_buffer_get_text(buffer, &startiter, &enditer , 0);
    PINFO("Book title is - %s\n", btitle);

    timespecFromTime64 (&closing_date,
                        gnc_time64_get_day_end_gdate (&info->closing_date));
    g_free(bnotes);

    /* Report the status back to the user. */
    info->close_status = 0;  /* XXX fixme success or failure? */

    /* Find the next closing date ... */
    info->prev_closing_date = info->closing_date;
    recurrenceListNextInstance (info->period, &info->prev_closing_date,
				&info->closing_date);


    /* FIXME Test for valid closing date, not sure why it won't be!!! */
    if (g_date_valid(&info->closing_date) == TRUE)
    {
        /* If the next closing date is in the future, then we are done. */
        if (gnc_time (NULL) >
	    gnc_time64_get_day_end_gdate (&info->closing_date))
        {
            /* Load up the GUI for the next closing period. */
            gnc_frequency_setup_recurrence (info->period_menu, NULL,
					    &info->closing_date);
            /* Jump back to the Close Book page. */
            gtk_assistant_set_current_page (GTK_ASSISTANT(info->window), 1);
        }
    }
}
void RemoteRepositoryAssistant::on_assistant_apply ()
{
  // Configurations.
  extern Settings *settings;
  ProjectConfiguration *projectconfig = settings->projectconfig(bible);

  // Whether to use the remote repository.
  bool use_remote_repository = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_use_repository));
  if (bible_notes_selector_bible ())
    projectconfig->git_use_remote_repository_set(use_remote_repository);
  else
    settings->genconfig.consultation_notes_git_use_remote_repository_set(use_remote_repository);

  // The remote repository URL.
  if (bible_notes_selector_bible ())
    projectconfig->git_remote_repository_url_set(repository_url_get());
  else
    settings->genconfig.consultation_notes_git_remote_repository_url_set(repository_url_get());
  
  // If the repository was cloned, move it into place.
  if (repository_was_cloned()) {
    ustring destination_data_directory;
    if (bible_notes_selector_bible ())
      destination_data_directory = project_data_directory_project(bible);
    else
      destination_data_directory = notes_shared_storage_folder ();
    unix_rmdir(destination_data_directory);
    unix_mv(persistent_clone_directory, destination_data_directory);
    // Switch rename detection off. 
    // This is necessary for the consultation notes, since git has been seen to cause spurious renames.
    GwSpawn spawn ("git");
    spawn.workingdirectory (destination_data_directory);
    spawn.arg ("config");
    spawn.arg ("--global");
    spawn.arg ("diff.renamelimit");
    spawn.arg ("0");
    spawn.run ();
  }

  if (bible_notes_selector_bible ()) {
    // Take a snapshot of the whole project.
    snapshots_shoot_project (bible);
  } else{
    // Create the index for the consultation notes.
    notes_create_index ();
  }

  // Show summary.
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), summary_page_number);
}
Example #10
0
/**
 * cong_new_file_assistant_set_page:
 * @assistant:
 * @page:
 *
 * TODO: Write me
 */
void 
cong_new_file_assistant_set_page(CongNewFileAssistant *assistant, GtkWidget *page)
{
	g_return_if_fail(assistant);
	g_return_if_fail(page);

	int count;
	for(count = gtk_assistant_get_n_pages(assistant->druid); count >= 0; count--) {
		if(gtk_assistant_get_nth_page(assistant->druid, count) == page) {
			gtk_assistant_set_current_page(assistant->druid, count);
			break;
		}
	}
}
Example #11
0
static void
glade_gtk_assistant_parse_finished (GladeProject * project, GObject * object)
{
  GtkAssistant *assistant = GTK_ASSISTANT (object);
  gint pages = gtk_assistant_get_n_pages (assistant);

  if (pages)
    {
      /* also sets pages "complete" and thus allows navigation under glade */
      glade_gtk_assistant_update_page_type (assistant);

      gtk_assistant_set_current_page (assistant, 0);
      glade_widget_property_set (glade_widget_get_from_gobject (object),
                                 "n-pages", pages);
    }
}
Example #12
0
/**************************************************
 * csv_export_file_chooser_confirm_cb
 *
 * call back for ok button in file chooser widget
 **************************************************/
void
csv_export_file_chooser_confirm_cb (GtkWidget *button, CsvExportInfo *info)
{
    GtkAssistant *assistant = GTK_ASSISTANT(info->window);
    gint num = gtk_assistant_get_current_page (assistant);
    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);

    gchar *file_name;

    gtk_assistant_set_page_complete (assistant, page, FALSE);

    file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(info->file_chooser));

    if (file_name)
    {
        if (g_file_test (file_name, G_FILE_TEST_EXISTS))
        {
            const char *format = _("The file %s already exists. "
                                   "Are you sure you want to overwrite it?");

            /* if user says cancel, we should break out */
            if (!gnc_verify_dialog (NULL, FALSE, format, file_name))
                return;
        }

        info->file_name = g_strdup (file_name);
        gtk_assistant_set_page_complete (assistant, page, TRUE);
    }

    if (file_name)
    {
        gchar *filepath = gnc_uri_get_path (file_name);
        gchar *filedir = g_path_get_dirname (filepath);
        info->starting_dir = g_strdup (filedir);
        g_free (filedir);
        g_free (filepath);
    }
    g_free (file_name);

    DEBUG("file_name selected is %s", info->file_name);
    DEBUG("starting directory is %s", info->starting_dir);

    /* Step to next page if page is complete */
    if(gtk_assistant_get_page_complete (assistant, page))
        gtk_assistant_set_current_page (assistant, num + 1);
}
Example #13
0
void
glade_gtk_assistant_replace_child (GladeWidgetAdaptor * adaptor,
                                   GObject * container,
                                   GObject * current, GObject * new_object)
{
  GtkAssistant *assistant = GTK_ASSISTANT (container);
  GtkWidget *page = GTK_WIDGET (new_object), *old_page = GTK_WIDGET (current);
  gint pos = glade_gtk_assistant_get_page (assistant, old_page);
  gboolean set_current = gtk_assistant_get_current_page (assistant) == pos;

  assistant_remove_child (assistant, old_page);

  gtk_assistant_insert_page (assistant, page, pos);
  glade_gtk_assistant_update_page_type (assistant);

  if (set_current)
    gtk_assistant_set_current_page (assistant, pos);
}
/**************************************************
 * csv_file_chooser_confirm_cb
 *
 * call back for ok button in file chooser widget
 **************************************************/
void
csv_import_file_chooser_confirm_cb (GtkWidget *button, CsvImportInfo *info)
{
    GtkAssistant *assistant = GTK_ASSISTANT(info->window);
    gint num = gtk_assistant_get_current_page (assistant);
    GtkWidget *page = gtk_assistant_get_nth_page (assistant, num);

    gchar *file_name;
    csv_import_result res;

    gtk_assistant_set_page_complete (assistant, page, FALSE);

    file_name = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER(info->file_chooser ));

    if (file_name)
    {
        gchar *filepath = gnc_uri_get_path ( file_name );
        gchar *filedir = g_path_get_dirname( filepath );
        info->starting_dir = g_strdup(filedir);
        g_free ( filedir );
        g_free ( filepath );

        info->file_name = g_strdup(file_name);

        // generate preview
        gtk_list_store_clear (info->store);
        res = csv_import_read_file (info->file_name, info->regexp->str, info->store, 1 );
        if (res == RESULT_OPEN_FAILED)
            gnc_error_dialog (info->window, _("The input file can not be opened."));
        else if (res == RESULT_OK)
            gtk_assistant_set_page_complete (assistant, page, TRUE);
        else if (res == MATCH_FOUND)
            gtk_assistant_set_page_complete (assistant, page, TRUE);
    }
    g_free(file_name);

    DEBUG("file_name selected is %s", info->file_name);
    DEBUG("starting directory is %s", info->starting_dir);

    /* Step to next page if page is complete */
    if(gtk_assistant_get_page_complete(assistant, page))
        gtk_assistant_set_current_page (assistant, num + 1);

}
Example #15
0
static void
on_assistant_project_selection_changed (GladeProject *project,
                                        GladeWidget *gassist)
{
  GList *selection = glade_project_selection_get (project);

  if (selection && g_list_next (selection) == NULL)
    {
      GladeWidget *selected = glade_widget_get_from_gobject (selection->data);
      GtkAssistant *assist = GTK_ASSISTANT (glade_widget_get_object (gassist));
      gint pos;

      if (!selected) return;

      if (glade_widget_get_parent (selected) == gassist &&
          glade_widget_property_get (selected, "position", &pos, NULL))
	gtk_assistant_set_current_page (assist, pos);
    }
}
Example #16
0
static void
account_assistant_reset_enter_create_page (EmpathyAccountAssistant *self)
{
  EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
  GtkWidget *page;
  gint idx;

  page = account_assistant_build_enter_or_create_page (self);
  idx = gtk_assistant_append_page (GTK_ASSISTANT (self), page);
  gtk_assistant_set_page_type (GTK_ASSISTANT (self), page,
      GTK_ASSISTANT_PAGE_CONFIRM);
  priv->enter_or_create_page = page;

  gtk_assistant_set_current_page (GTK_ASSISTANT (self), idx);

  account_assistant_finish_enter_or_create_page (self,
      priv->first_resp == RESPONSE_ENTER_ACCOUNT ?
      TRUE : FALSE);
}
Example #17
0
void
glade_gtk_assistant_set_child_property (GladeWidgetAdaptor * adaptor,
                                        GObject * container,
                                        GObject * child,
                                        const gchar * property_name,
                                        const GValue * value)
{
  if (strcmp (property_name, "position") == 0)
    {
      GtkAssistant *assistant = GTK_ASSISTANT (container);
      GtkWidget *widget = GTK_WIDGET (child);
      gint pos;
      gboolean set_current;

      if ((pos = g_value_get_int (value)) < 0)
        return;
      if (pos == glade_gtk_assistant_get_page (assistant, widget))
        return;
      set_current = gtk_assistant_get_current_page (assistant) ==
          glade_gtk_assistant_get_page (assistant, widget);   

      g_object_ref (child);
      assistant_remove_child (assistant, widget);
      gtk_assistant_insert_page (assistant, widget, pos);
      g_object_unref (child);

      if (set_current)
        gtk_assistant_set_current_page (assistant, pos);

      glade_gtk_assistant_update_page_type (assistant);

      glade_gtk_assistant_update_position (assistant);

      return;
    }

  /* Chain Up */
  GWA_GET_CLASS (GTK_TYPE_WINDOW)->child_set_property (adaptor,
                                                       container,
                                                       child,
                                                       property_name, value);
}
void RestoreAssistant::on_assistant_apply ()
{
  // Unpack the tarball.
  ustring unpack_directory = gw_build_filename (Directories->get_temp (), "restore");
  unix_rmdir (unpack_directory);
  gw_mkdir_with_parents (unpack_directory);
  if (uncompress (filename, unpack_directory)) {

    // Do specialized operations on the unpacked data.
    switch (get_type()) {
      case btBible:
      {
        restore_project (unpack_directory, bible_name, restore_feedback);
        break;
      }
      case btNotes:
      {
        restore_notes (unpack_directory, restore_feedback);
        break;
      }
      case btResource:
      {
        restore_resource (unpack_directory, restore_feedback);
        break;
      }
      case btAll:
      {
        restore_all_stage_one (unpack_directory, restore_feedback);
        break;
      }
    }
  } else {
    restore_feedback.push_back (_("Failed to unpack file ") + filename);
  }
 
  // Show summary.
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), page_number_progress);
}
Example #19
0
void
glade_gtk_assistant_post_create (GladeWidgetAdaptor * adaptor,
                                 GObject * object, GladeCreateReason reason)
{
  GladeWidget *parent = glade_widget_get_from_gobject (object);
  GladeProject *project = glade_widget_get_project (parent);

  if (reason == GLADE_CREATE_LOAD)
    {
      g_signal_connect (project, "parse-finished",
                        G_CALLBACK (glade_gtk_assistant_parse_finished),
                        object);
    }
  else if (reason == GLADE_CREATE_USER)
    {
      glade_gtk_assistant_append_new_page (parent, project,
                                           _("Introduction page"),
                                           GTK_ASSISTANT_PAGE_INTRO);

      glade_gtk_assistant_append_new_page (parent, project,
                                           _("Content page"),
                                           GTK_ASSISTANT_PAGE_CONTENT);

      glade_gtk_assistant_append_new_page (parent, project,
                                           _("Confirmation page"),
                                           GTK_ASSISTANT_PAGE_CONFIRM);

      gtk_assistant_set_current_page (GTK_ASSISTANT (object), 0);

      glade_widget_property_set (parent, "n-pages", 3);
    }

  if (project)
    g_signal_connect (project, "selection-changed",
		      G_CALLBACK (on_assistant_project_selection_changed),
		      parent);
}
Example #20
0
/*
  GtkAssistant is a very weird widget, why is it derived from GtkWindow
  instead of GtkNotebook I do not know!

  If there is no GTK_ASSISTANT_PAGE_CONFIRM, GtkAssistant abort when trying to 
  update its navigation buttons!
*/
static void
glade_gtk_assistant_update_page_type (GtkAssistant * assistant)
{
  gint i, current, pages;
  GtkWidget *page;

  current = gtk_assistant_get_current_page (assistant);
  pages = gtk_assistant_get_n_pages (assistant) - 1;
  if (pages < 0)
    return;

  /* Last Page */
  page = gtk_assistant_get_nth_page (assistant, pages);
  gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONFIRM);

  /* First page */
  page = gtk_assistant_get_nth_page (assistant, 0);
  gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_INTRO);

  /* In betwen pages */
  for (i = 1; i < pages; i++)
    {
      page = gtk_assistant_get_nth_page (assistant, i);
      gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONTENT);
    }

  /* Now we have set page-type in every page, force button update */
  for (i = 0; i <= pages; i++)
    {
      page = gtk_assistant_get_nth_page (assistant, i);
      gtk_assistant_set_page_complete (assistant, page, TRUE);
    }

  if (current >= 0)
    gtk_assistant_set_current_page (assistant, current);
}
RemoteRepositoryAssistant::RemoteRepositoryAssistant(int dummy) :
  AssistantBase(_("Remote repository setup"), _("menu-preferences/dialog-remote-repository"))
// Assistant for managing the remote repository.
{
  // Configuration and initialization.
  extern Settings *settings;
  bible = settings->genconfig.project_get();
  event_id_entry_repository = 0;
  persistent_clone_directory = git_testing_directory (_("clone"));
  write_access_granted = false;
  ignore_entry_repository_changed = false;

  gtk_assistant_set_forward_page_func (GTK_ASSISTANT (assistant), GtkAssistantPageFunc (assistant_forward_function), gpointer(this), NULL);

  g_signal_connect (G_OBJECT (assistant), "apply", G_CALLBACK (on_assistant_apply_signal), gpointer(this));
  g_signal_connect (G_OBJECT (assistant), "prepare", G_CALLBACK (on_assistant_prepare_signal), gpointer(this));

  introduction (_("Remote repository management for Bible ") + bible + _(" or the project notes"));

  // Build the GUI for the Bible or notes selector.
  vbox_bible_notes_selector = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_bible_notes_selector);
  page_number_bible_notes_selector = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_notes_selector);

  GSList *radiobutton_bible_notes_selector_group = NULL;

  radiobutton_bible_notes_selector_bible = gtk_radio_button_new_with_mnemonic (NULL, _("B_ible repository"));
  gtk_widget_show (radiobutton_bible_notes_selector_bible);
  gtk_box_pack_start (GTK_BOX (vbox_bible_notes_selector), radiobutton_bible_notes_selector_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_notes_selector_bible), radiobutton_bible_notes_selector_group);
  radiobutton_bible_notes_selector_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_notes_selector_bible));

  radiobutton_bible_notes_selector_notes = gtk_radio_button_new_with_mnemonic (NULL, _("Project _notes repository"));
  gtk_widget_show (radiobutton_bible_notes_selector_notes);
  gtk_box_pack_start (GTK_BOX (vbox_bible_notes_selector), radiobutton_bible_notes_selector_notes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_notes_selector_notes), radiobutton_bible_notes_selector_group);
  radiobutton_bible_notes_selector_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_notes_selector_notes));

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_notes_selector, _("What type of repository would you like to set?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_notes_selector, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_notes_selector, true);
  
  // Build the GUI for the setting whether to use a remote repository.
  checkbutton_use_repository = gtk_check_button_new_with_mnemonic (_("_Use remote repository"));
  gtk_widget_show (checkbutton_use_repository);
  page_number_use_repository = gtk_assistant_append_page (GTK_ASSISTANT (assistant), checkbutton_use_repository);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), checkbutton_use_repository, _("Would you like to use a remote repository?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), checkbutton_use_repository, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), checkbutton_use_repository, true);

  // System for trying out git.
  git_tried_and_okay = false;
  
  label_try_git = gtk_label_new (_("The local content tracker has been tested and works fine"));
  gtk_widget_show (label_try_git);
  page_number_try_git = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_try_git);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_try_git, _("Trying out the content tracker"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_try_git, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_try_git, false);

  // Build GUI for the repository URL.
  vbox_repository = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_repository);
  page_number_repository = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_repository);

  hbox_repository = gtk_hbox_new (FALSE, 3);
  gtk_widget_show (hbox_repository);
  gtk_box_pack_start (GTK_BOX (vbox_repository), hbox_repository, TRUE, TRUE, 0);

  label_repository = gtk_label_new_with_mnemonic (_("_Repository"));
  gtk_widget_show (label_repository);
  gtk_box_pack_start (GTK_BOX (hbox_repository), label_repository, FALSE, FALSE, 0);

  entry_repository = gtk_entry_new ();
  gtk_widget_show (entry_repository);
  gtk_box_pack_start (GTK_BOX (hbox_repository), entry_repository, TRUE, TRUE, 0);
  gtk_entry_set_invisible_char (GTK_ENTRY (entry_repository), 9679);

  label_repository_accessible = gtk_label_new ("");
  gtk_widget_show (label_repository_accessible);
  gtk_box_pack_start (GTK_BOX (vbox_repository), label_repository_accessible, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label_repository_accessible), 0, 0.5);
  
  gtk_label_set_mnemonic_widget (GTK_LABEL (label_repository), entry_repository);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_repository, _("Enter the location of the remote repository"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_repository, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_repository, false);

  g_signal_connect ((gpointer) entry_repository, "changed", G_CALLBACK (on_entry_repository_changed), gpointer (this));

  // GUI for cloning the repository.
  vbox_clone = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_clone);
  page_number_clone = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_clone);

  label_clone = gtk_label_new ("");
  gtk_widget_show (label_clone);
  gtk_box_pack_start (GTK_BOX (vbox_clone), label_clone, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label_clone), 0, 0.5);

  button_clone = gtk_button_new ();
  gtk_widget_show (button_clone);
  gtk_box_pack_start (GTK_BOX (vbox_clone), button_clone, FALSE, FALSE, 0);
  
  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image1;
  GtkWidget *label1;

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_clone), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-copy", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label1 = gtk_label_new_with_mnemonic (_("C_lone the remote repository"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_clone, _("Cloning data"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_clone, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_clone, false);

  g_signal_connect ((gpointer) button_clone, "clicked", G_CALLBACK (on_button_clone_clicked), gpointer (this));

  // Write tester.
  label_write_test = gtk_label_new ("");
  gtk_widget_show (label_write_test);
  page_number_write_test = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_write_test);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_write_test, _("Remote repository write test"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_write_test, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_write_test, false);

  // GUI for pushing our data into the remote repository.
  vbox_push = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_push);
  page_number_push = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_push);

  label_push = gtk_label_new ("");
  gtk_widget_show (label_push);
  gtk_box_pack_start (GTK_BOX (vbox_push), label_push, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label_push), 0, 0.5);

  button_push = gtk_button_new ();
  gtk_widget_show (button_push);
  gtk_box_pack_start (GTK_BOX (vbox_push), button_push, FALSE, FALSE, 0);
  
  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_push), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-copy", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label1 = gtk_label_new_with_mnemonic (_("_Push my data to the remote repository"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_push, _("Would you like to push your data to the repository?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_push, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_push, true);

  g_signal_connect ((gpointer) button_push, "clicked", G_CALLBACK (on_button_push_clicked), gpointer (this));

  // Build the confirmation stuff.
  label_confirm = gtk_label_new (_("Settings are ready to be applied"));
  gtk_widget_show (label_confirm);
  page_number_confirm = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_confirm);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_confirm, _("Settings are ready to be applied"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_confirm, GTK_ASSISTANT_PAGE_CONFIRM);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_confirm, true);
  
  label_progress = gtk_label_new ("");
  gtk_widget_show (label_progress);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_progress);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_progress, "");
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_progress, GTK_ASSISTANT_PAGE_PROGRESS);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_progress, true);
  
  label_summary = gtk_label_new (_("Settings have been applied"));
  gtk_widget_show (label_summary);
  summary_page_number = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_summary);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_summary, _("Ready"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_summary, GTK_ASSISTANT_PAGE_SUMMARY);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_summary, true);
  
  // Finish building assistant.
  gtk_widget_show_all (assistant);
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), 0);
}
RestoreAssistant::RestoreAssistant(GtkWindow *transient_parent) :
  AssistantBase(_("Restore"), _("restore"), transient_parent)
// Restore assistant.
{
  gtk_assistant_set_forward_page_func (GTK_ASSISTANT (assistant), GtkAssistantPageFunc (assistant_forward_function), gpointer(this), NULL);
  
  g_signal_connect (G_OBJECT (assistant), "apply", G_CALLBACK (on_assistant_apply_signal), gpointer(this));
  g_signal_connect (G_OBJECT (assistant), "prepare", G_CALLBACK (on_assistant_prepare_signal), gpointer(this));

  introduction (_("This assists you with restoring a backup"));

  // Configuration and initialization.
  extern Settings *settings;
  ustring project = settings->genconfig.project_get();

  // Build the GUI for the task selector.
  vbox_select_type = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_select_type);
  page_number_select_type = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_select_type);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_select_type), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_select_type, _("What would you like to restore?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_select_type, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_select_type, true);

  GSList *radiobutton_select_type_group = NULL;

  radiobutton_select_type_bible = gtk_radio_button_new_with_mnemonic (NULL, _("Bible"));
  gtk_widget_show (radiobutton_select_type_bible);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible));

  radiobutton_select_type_notes = gtk_radio_button_new_with_mnemonic (NULL, _("Notes"));
  gtk_widget_show (radiobutton_select_type_notes);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_notes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes));

  radiobutton_select_type_resource = gtk_radio_button_new_with_mnemonic (NULL, _("Resource"));
  gtk_widget_show (radiobutton_select_type_resource);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_resource, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_resource), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_resource));

  radiobutton_select_type_everything = gtk_radio_button_new_with_mnemonic (NULL, _("Everything"));
  gtk_widget_show (radiobutton_select_type_everything);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_everything, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_everything), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_everything));

  Shortcuts shortcuts_select_type (0);
  shortcuts_select_type.button (radiobutton_select_type_bible);
  shortcuts_select_type.button (radiobutton_select_type_notes);
  shortcuts_select_type.button (radiobutton_select_type_resource);
  shortcuts_select_type.button (radiobutton_select_type_everything);
  shortcuts_select_type.consider_assistant();
  shortcuts_select_type.process();

  // Confirm or change Bible.
  vbox_bible_name = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox_bible_name);
  page_number_bible_name = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_name);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_bible_name), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_name, _("What will be the name of the Bible?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_name, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_name, true);

  entry_bible_name = gtk_entry_new ();
  gtk_widget_show (entry_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), entry_bible_name, FALSE, FALSE, 0);

  label_bible_name = gtk_label_new ("");
  gtk_widget_show (label_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), label_bible_name, FALSE, FALSE, 0);

  g_signal_connect_after ((gpointer) entry_bible_name, "changed", G_CALLBACK (on_entry_bible_name_changed), gpointer (this));

  // Select file.
  vbox_file = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_file);
  page_number_file = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_file);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_file), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_file, _("What is the file to restore?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_file, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_file, false);

  button_file = gtk_button_new ();
  gtk_widget_show (button_file);
  gtk_box_pack_start (GTK_BOX (vbox_file), button_file, FALSE, FALSE, 0);

  GtkWidget *alignment2;
  GtkWidget *hbox2;
  GtkWidget *image2;

  alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (button_file), alignment2);

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

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

  label_file = gtk_label_new_with_mnemonic ("");
  gtk_widget_show (label_file);
  gtk_box_pack_start (GTK_BOX (hbox2), label_file, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_file, "clicked", G_CALLBACK (on_button_file_clicked), gpointer(this));

  // Build the confirmation stuff.
  label_confirm = gtk_label_new (_("Restore is about to be done"));
  gtk_widget_show (label_confirm);
  page_number_confirm = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_confirm);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_confirm, _("Restore is about to be done"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_confirm, GTK_ASSISTANT_PAGE_CONFIRM);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_confirm, true);
  
  label_progress = gtk_label_new (_("Restore is in progress"));
  gtk_widget_show (label_progress);
  page_number_progress = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_progress);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_progress, "");
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_progress, GTK_ASSISTANT_PAGE_PROGRESS);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_progress, true);
  
  label_summary = gtk_label_new ("");
  gtk_widget_show (label_summary);
  summary_page_number = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_summary);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_summary, _("Ready"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_summary, GTK_ASSISTANT_PAGE_SUMMARY);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_summary, true);
  
  // Finish building assistant.
  gtk_widget_show_all (assistant);
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), 0);
}
Example #23
0
static void
assistant_applied_cb (GtkAssistant *assist, G_GNUC_UNUSED gpointer data)
{
	gboolean allok = TRUE;
	GString *cnc_string = NULL;
	GdauiDsnAssistant *assistant = (GdauiDsnAssistant *) assist;

	g_return_if_fail (GDAUI_IS_DSN_ASSISTANT (assistant));

	/* clear the internal dsn_info */
	if (assistant->priv->dsn_info) {
		data_source_info_free (assistant->priv->dsn_info);
		assistant->priv->dsn_info = NULL;
	}

	/* New database creation first */
	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (assistant->priv->choose_toggle))) {
		if (!gda_server_operation_is_valid (assistant->priv->create_db_op, NULL, NULL)) {
			_gdaui_utility_show_error (NULL, _("Missing mandatory information, to create database"));
			gtk_assistant_set_current_page (assist, PAGE_CREATE_DB_INFO);
			return;
		}
		else {
			GdaProviderInfo *prov_info;
			GSList *dsn_params;
			GError *error = NULL;

			allok = gda_server_operation_perform_create_database (assistant->priv->create_db_op, NULL, &error);
			if (!allok) {
				gchar *str;
				str = g_strdup_printf (_("Error creating database: %s"), 
						       error && error->message ? error->message : _("Unknown error"));
				_gdaui_utility_show_error (NULL, str);
				g_free (str);
				
				gtk_assistant_set_current_page (assist, PAGE_CREATE_DB_INFO);
				return;
			}
			
			/* make the connection string for the data source */
			prov_info = gda_config_get_provider_info (gdaui_provider_selector_get_provider 
								  (GDAUI_PROVIDER_SELECTOR (assistant->priv->general_provider)));
			g_return_if_fail (prov_info);
			for (dsn_params = prov_info->dsn_params->holders; dsn_params; dsn_params = dsn_params->next) {
				GdaHolder *param = GDA_HOLDER (dsn_params->data);
				const GValue *value;
				
				value = gda_server_operation_get_value_at (assistant->priv->create_db_op,
									   "/DB_DEF_P/%s",
									   gda_holder_get_id (param));
				if (!value)
					value = gda_server_operation_get_value_at (assistant->priv->create_db_op,
										   "/SERVER_CNX_P/%s",
										   gda_holder_get_id (param));
				
				if (value && !gda_value_is_null ((GValue *) value)) {
					gchar *str;

					if (dsn_params == prov_info->dsn_params->holders)
						cnc_string = g_string_new ("");
					else
						g_string_append (cnc_string, ";");
					str = gda_value_stringify ((GValue *) value);
					g_string_append_printf (cnc_string, "%s=%s", gda_holder_get_id (param), str);
					g_free (str);
				}
			}
		}
	}

	/* Data source declaration */
	if (allok) {
		assistant->priv->dsn_info = g_new0 (GdaDsnInfo, 1);
		assistant->priv->dsn_info->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (assistant->priv->general_name)));
		assistant->priv->dsn_info->provider = g_strdup (
					 gdaui_provider_selector_get_provider (
					 GDAUI_PROVIDER_SELECTOR (assistant->priv->general_provider)));
		if (cnc_string) {
			assistant->priv->dsn_info->cnc_string = cnc_string->str;
			g_string_free (cnc_string, FALSE);
		}
		else
			assistant->priv->dsn_info->cnc_string = _gdaui_provider_spec_editor_get_specs 
				(GDAUI_PROVIDER_SPEC_EDITOR (assistant->priv->provider_detail));
		assistant->priv->dsn_info->description =
			g_strdup (gtk_entry_get_text (GTK_ENTRY (assistant->priv->general_description)));
		assistant->priv->dsn_info->auth_string = NULL;
		if (assistant->priv->auth_detail)
			assistant->priv->dsn_info->auth_string =
				_gdaui_provider_auth_editor_get_auth (GDAUI_PROVIDER_AUTH_EDITOR (assistant->priv->auth_detail));
		if (gda_config_can_modify_system_config ())
			assistant->priv->dsn_info->is_system = gtk_toggle_button_get_active 
				(GTK_TOGGLE_BUTTON (assistant->priv->general_is_system));
		else
			assistant->priv->dsn_info->is_system = FALSE;
	}

	/* notify listeners */
	g_signal_emit (G_OBJECT (assistant), config_assistant_signals[FINISHED], 0, !allok);
}
Example #24
0
static VALUE
rg_set_current_page(VALUE self, VALUE page_num)
{
    gtk_assistant_set_current_page(_SELF(self), NUM2INT(page_num));
    return self;
}
Example #25
0
ImportAssistant::ImportAssistant(WindowReferences * references_window, WindowStyles * styles_window, WindowCheckKeyterms * check_keyterms_window, WindowsOutpost * windows_outpost) :
  AssistantBase(_("Import"), _("import"))
// Import assistant.
{
  gtk_assistant_set_forward_page_func (GTK_ASSISTANT (assistant), GtkAssistantPageFunc (assistant_forward_function), gpointer(this), NULL);
  
  g_signal_connect (G_OBJECT (assistant), "apply", G_CALLBACK (on_assistant_apply_signal), gpointer(this));
  g_signal_connect (G_OBJECT (assistant), "prepare", G_CALLBACK (on_assistant_prepare_signal), gpointer(this));

  introduction (_("This helps you importing data"));

  // Configuration and initialization.
  extern Settings *settings;
  ustring project = settings->genconfig.project_get();
  my_references_window = references_window;
  my_styles_window = styles_window;
  my_check_keyterms_window = check_keyterms_window;
  my_windows_outpost = windows_outpost;
  import_notes = false;
  import_keyterms = false;

  // Build the GUI for the task selector.
  vbox_select_type = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_select_type);
  page_number_select_type = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_select_type);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_select_type), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_select_type, _("What would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_select_type, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_select_type, true);

  GSList *radiobutton_select_type_group = NULL;

  radiobutton_select_type_bible = gtk_radio_button_new_with_mnemonic (NULL, _("Bible"));
  gtk_widget_show (radiobutton_select_type_bible);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible));

  radiobutton_select_type_references = gtk_radio_button_new_with_mnemonic (NULL, _("References"));
  gtk_widget_show (radiobutton_select_type_references);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_references, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_references), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_references));

  // Importing references only works when the references window shows.
  gtk_widget_set_sensitive (radiobutton_select_type_references, references_window != NULL);
  
  radiobutton_select_type_stylesheet = gtk_radio_button_new_with_mnemonic (NULL, _("Stylesheet"));
  gtk_widget_show (radiobutton_select_type_stylesheet);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_stylesheet, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_stylesheet), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_stylesheet));

  // Importing styles only works when the styles window shows.
  gtk_widget_set_sensitive (radiobutton_select_type_stylesheet, my_styles_window != NULL);

  radiobutton_select_type_notes = gtk_radio_button_new_with_mnemonic (NULL, _("Notes"));
  gtk_widget_show (radiobutton_select_type_notes);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_notes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes));

  radiobutton_select_type_keyterms = gtk_radio_button_new_with_mnemonic (NULL, _("Keyterms"));
  gtk_widget_show (radiobutton_select_type_keyterms);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_keyterms, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_keyterms), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_keyterms));

  // Importing keyterms only works when the check keyterms window shows.
  gtk_widget_set_sensitive (radiobutton_select_type_keyterms, my_check_keyterms_window != NULL);
  
  Shortcuts shortcuts_select_type (0);
  shortcuts_select_type.button (radiobutton_select_type_bible);
  shortcuts_select_type.button (radiobutton_select_type_references);
  shortcuts_select_type.button (radiobutton_select_type_stylesheet);
  shortcuts_select_type.button (radiobutton_select_type_notes);
  shortcuts_select_type.button (radiobutton_select_type_keyterms);
  shortcuts_select_type.consider_assistant();
  shortcuts_select_type.process();

  // Confirm or change Bible to import into.
  vbox_bible_name = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox_bible_name);
  page_number_bible_name = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_name);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_bible_name), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_name, _("Is this the right Bible to import into?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_name, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_name, true);

  label_project_name = gtk_label_new (_("Bible name"));
  gtk_widget_show (label_project_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), label_project_name, FALSE, FALSE, 0);

  button_bible_name = gtk_button_new ();
  gtk_widget_show (button_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), button_bible_name, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_bible_name, "clicked", G_CALLBACK (on_button_bible_name_clicked), gpointer (this));

  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image1;
  GtkWidget *label12;

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_bible_name), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label12 = gtk_label_new_with_mnemonic (_("Choose another one"));
  gtk_widget_show (label12);
  gtk_box_pack_start (GTK_BOX (hbox1), label12, FALSE, FALSE, 0);

  Shortcuts shortcuts_bible_name (0);
  shortcuts_bible_name.label (label12);
  shortcuts_bible_name.consider_assistant();
  shortcuts_bible_name.process();

  // Select what type of Bible data to import.
  vbox_bible_type = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_bible_type);
  page_number_bible_type = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_type);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_bible_type), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_type, _("What type of data would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_type, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_type, true);

  GSList *radiobutton_bible_type_group = NULL;

  radiobutton_bible_usfm = gtk_radio_button_new_with_mnemonic (NULL, _("Unified Standard Format Markers (USFM)"));
  gtk_widget_show (radiobutton_bible_usfm);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_usfm, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_usfm), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_usfm));

  radiobutton_bible_bibleworks = gtk_radio_button_new_with_mnemonic (NULL, _("BibleWorks Exported Database"));
  gtk_widget_show (radiobutton_bible_bibleworks);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_bibleworks, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_bibleworks), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_bibleworks));

  radiobutton_bible_online_bible = gtk_radio_button_new_with_mnemonic (NULL, _("Online Bible Text"));
  gtk_widget_show (radiobutton_bible_online_bible);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_online_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_online_bible), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_online_bible));

  radiobutton_bible_raw_text = gtk_radio_button_new_with_mnemonic (NULL, _("Raw Text"));
  gtk_widget_show (radiobutton_bible_raw_text);
  gtk_box_pack_start (GTK_BOX (vbox_bible_type), radiobutton_bible_raw_text, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_bible_raw_text), radiobutton_bible_type_group);
  radiobutton_bible_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_bible_raw_text));

  Shortcuts shortcuts_select_bible_type (0);
  shortcuts_select_bible_type.button (radiobutton_bible_usfm);
  shortcuts_select_bible_type.button (radiobutton_bible_bibleworks);
  shortcuts_select_bible_type.button (radiobutton_bible_online_bible);
  shortcuts_select_bible_type.button (radiobutton_bible_raw_text);
  shortcuts_select_bible_type.consider_assistant();
  shortcuts_select_bible_type.process();

  // Online Bible connection?
  label_online_bible_running = gtk_label_new ("");
  gtk_widget_show (label_online_bible_running);
  page_number_online_bible_running = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_online_bible_running);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_online_bible_running, _("Connected to the Online Bible?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_online_bible_running, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_online_bible_running, false);

  // In case there's no data in the project, the Online Bible won't get connected.
  // Therefore connect manually.
  if (online_bible_is_running ()) {
    my_windows_outpost->OnlineBibleReferenceGet ();
  }

  // Online Bible to import.
  vbox_online_bible_bible = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_online_bible_bible);
  page_number_online_bible_bible = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_online_bible_bible);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_online_bible_bible, _("Which Bible would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_online_bible_bible, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_online_bible_bible, false);

  combobox_online_bible_bible = gtk_combo_box_new_text ();
  gtk_widget_show (combobox_online_bible_bible);
  gtk_box_pack_start (GTK_BOX (vbox_online_bible_bible), combobox_online_bible_bible, false, false, 0);

  g_signal_connect ((gpointer) combobox_online_bible_bible, "changed", G_CALLBACK (on_combobox_online_bible_bible_changed), gpointer (this));

  // Select files to import from.
  vbox_files = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_files);
  page_number_files = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_files);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_files), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_files, _("Which file or files would you like to import?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_files, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_files, false);

  button_files = gtk_button_new ();
  gtk_widget_show (button_files);
  gtk_box_pack_start (GTK_BOX (vbox_files), button_files, FALSE, FALSE, 0);

  GtkWidget * alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (button_files), 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-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image2);
  gtk_box_pack_start (GTK_BOX (hbox2), image2, FALSE, FALSE, 0);

  GtkWidget * label = gtk_label_new_with_mnemonic (_("Select files"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_files, "clicked", G_CALLBACK (on_button_files_clicked), gpointer(this));

  label_files = gtk_label_new ("");
  gtk_widget_show (label_files);
  gtk_box_pack_start (GTK_BOX (vbox_files), label_files, FALSE, FALSE, 0);

  // Build the confirmation stuff.
  label_confirm = gtk_label_new (_("Import about to be done"));
  gtk_widget_show (label_confirm);
  page_number_confirm = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_confirm);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_confirm, _("The import is about to be done"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_confirm, GTK_ASSISTANT_PAGE_CONFIRM);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_confirm, true);
  
  label_progress = gtk_label_new ("");
  gtk_widget_show (label_progress);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_progress);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_progress, "");
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_progress, GTK_ASSISTANT_PAGE_PROGRESS);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_progress, true);
  
  label_summary = gtk_label_new (_("Import done"));
  gtk_widget_show (label_summary);
  summary_page_number = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_summary);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_summary, _("Ready"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_summary, GTK_ASSISTANT_PAGE_SUMMARY);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_summary, true);
  
  // Finish building assistant.
  gtk_widget_show_all (assistant);
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), 0);
}
Example #26
0
/**
 * new_document:
 * @parent_window:
 *
 * TODO: Write me
 */
void 
new_document(GtkWindow *parent_window)
{
	CongNewFileAssistant *assistant;

	assistant = g_new0(CongNewFileAssistant,1);

	/* FIXME:  what if no document factories found? */

	assistant->druid = GTK_ASSISTANT(gtk_assistant_new());
	gtk_widget_show (GTK_WIDGET (assistant->druid));
	g_printerr("Number of pages: %d\n", gtk_assistant_get_n_pages(assistant->druid));

	gtk_window_set_title (GTK_WINDOW (assistant->druid),
			      _("Creating a new file"));

	if (parent_window != NULL) {
		gtk_window_set_transient_for (GTK_WINDOW (assistant->druid),
					      parent_window);
	}	
	
	g_signal_connect_object (assistant->druid, "cancel",
				 G_CALLBACK (gtk_widget_destroy),
				 assistant->druid,
				 G_CONNECT_SWAPPED);
	g_signal_connect (assistant->druid, "apply",
                     G_CALLBACK (on_apply),
                     assistant);
	g_signal_connect (assistant->druid, "close",
                     G_CALLBACK (gtk_widget_destroy),
                     NULL);

	assistant->first_page = add_new_page(assistant, _("This assistant will "
		"guide you through creating a new file.\n\n"
		"Various types of file are available, and Conglomerate may be "
		"able to supply some of the \"boilerplate\" content for you.\n\n"
		"We hope that in future versions of Conglomerate you will be "
		"able to create \"template documents\" to add to this system."),
	                                     GTK_ASSISTANT_PAGE_INTRO);
	gtk_assistant_set_page_complete(assistant->druid, assistant->first_page, TRUE);

	assistant->type_selection_widget = make_type_selection_widget(assistant);
	assistant->second_page = add_new_page_with_widget(assistant,
	                                                  _("Creating a new file"),
	                                                  _("What type of file would you like to create?"),
	                                                  _("Highlight one of the items in the list and select \"Forward\" to continue"),
	                                                  assistant->type_selection_widget);
	gtk_widget_show_all(assistant->second_page);

	/* 
	   There doesn't seem to be a way to delete pages from a druid.  Hence we have to create the GUI for all of the factories
	   at the creation of the druid, rather than "on-demand".
	   FIXME: With GtkAssistant, gtk_container_remove() should work.
	 */
	assistant->hash_table_of_factory_to_page = g_hash_table_new(g_direct_hash, g_direct_equal);
	assistant->hash_table_of_factory_to_last_page = g_hash_table_new(g_direct_hash, g_direct_equal);
	assistant->hash_table_of_factory_to_data = g_hash_table_new (g_direct_hash, 
								     g_direct_equal);
	cong_plugin_manager_for_each_document_factory (cong_app_get_plugin_manager (cong_app_singleton()), 
						       add_pages_for_factory_callback, 
						       assistant);

	assistant->final_page = add_new_page(assistant, _("Conglomerate now has the "
		"information it needs to create the document.  Press \"Apply\" "
		"to create it.  You will need to save the document if you wish "
		"to keep it."), GTK_ASSISTANT_PAGE_CONFIRM);
	gtk_assistant_set_page_complete(assistant->druid, assistant->final_page, TRUE);

	gtk_assistant_set_current_page(assistant->druid, 0);
	gtk_widget_show(GTK_WIDGET(assistant->druid));

#if 0
	CONG_DO_UNIMPLEMENTED_DIALOG("The selected menu item has not yet been implemented.");
#endif

	/* FIXME:  need to sort out memory leaks */
}
Example #27
0
static void
on_druid_real_prepare (GtkAssistant* assistant, GtkWidget *page, NPWDruid* druid)
{
	if (page == druid->progress_page)
	{
		gint previous;
		gboolean last_warning;

		previous = gtk_assistant_get_current_page (assistant) - 1;
		last_warning = gtk_assistant_get_nth_page (assistant, previous) == druid->error_page;
		if (last_warning)
		{
			/* Remove warning page */
			gtk_container_remove (GTK_CONTAINER (assistant), druid->error_page);
			previous--;
		}
		if (druid->no_selection) previous++;

		/* Generate the next page */
		if (previous == PROJECT_PAGE_INDEX)
		{
			const gchar* new_project;

			new_project = npw_header_get_filename (druid->header);

			if (druid->project_file != new_project)
			{
				npw_druid_remove_following_page (druid);

				/* Check if necessary programs for this project is installed */
				if (!last_warning && !check_and_warn_missing (druid))
				{
					gtk_assistant_set_current_page (assistant, gtk_assistant_get_current_page (assistant) + 1);
					return;
				}

				/* Change project */
				druid->project_file = new_project;
				anjuta_autogen_set_input_file (druid->gen, druid->project_file, "[+","+]");

			}
		}
		else
		{
			if (!npw_druid_save_valid_values (druid))
			{
				/* Display error */
				gtk_assistant_set_current_page (assistant, gtk_assistant_get_current_page (assistant) + 1);

				return;
			}
		}

		if (g_queue_peek_nth (druid->page_list, previous) == NULL)
		{
			/* Regenerate new page */
			gtk_assistant_set_page_complete (assistant, page, FALSE);
			if (druid->parser != NULL)
				npw_page_parser_free (druid->parser);
			druid->parser = npw_page_parser_new (npw_druid_add_new_page (druid), druid->project_file, previous);

			anjuta_autogen_set_output_callback (druid->gen, on_druid_parse_page, druid->parser, NULL);
			anjuta_autogen_write_definition_file (druid->gen, druid->values, NULL);
			anjuta_autogen_execute (druid->gen, on_druid_get_new_page, druid, NULL);
		}
		else
		{
			/* Page is already in cache, change the page to display it */
			on_druid_get_new_page (NULL, druid);
		}
	}
	else if (page == druid->finish_page)
	{
		npw_druid_set_busy (druid, FALSE);
		gtk_container_remove (GTK_CONTAINER (assistant), druid->error_page);
		gtk_container_remove (GTK_CONTAINER (assistant), druid->progress_page);
	}
	else
	{
		npw_druid_set_busy (druid, FALSE);

		if (page != druid->error_page) gtk_container_remove (GTK_CONTAINER (assistant), druid->error_page);

		/* Move progress page */
		gtk_container_remove (GTK_CONTAINER (assistant), druid->progress_page);
		gtk_assistant_insert_page (assistant, druid->progress_page, gtk_assistant_get_current_page (assistant) + 1);
		gtk_assistant_set_page_title (assistant, druid->progress_page, "...");
	}
}
Example #28
0
BackupAssistant::BackupAssistant(int dummy) :
  AssistantBase(_("Backup"), _("backup"))
// Backup assistant.
{
  gtk_assistant_set_forward_page_func (GTK_ASSISTANT (assistant), GtkAssistantPageFunc (assistant_forward_function), gpointer(this), NULL);
  
  g_signal_connect (G_OBJECT (assistant), "apply", G_CALLBACK (on_assistant_apply_signal), gpointer(this));
  g_signal_connect (G_OBJECT (assistant), "prepare", G_CALLBACK (on_assistant_prepare_signal), gpointer(this));

  introduction (_("A backup helps keep your data safe"));

  // Configuration and initialization.
  extern Settings *settings;
  ustring project = settings->genconfig.project_get();

  // Build the GUI for the task selector.
  vbox_select_type = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_select_type);
  page_number_select_type = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_select_type);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_select_type), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_select_type, _("What would you like to backup?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_select_type, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_select_type, true);

  GSList *radiobutton_select_type_group = NULL;

  radiobutton_select_type_bible = gtk_radio_button_new_with_mnemonic (NULL, _("Bible"));
  gtk_widget_show (radiobutton_select_type_bible);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_bible, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_bible));

  radiobutton_select_type_notes = gtk_radio_button_new_with_mnemonic (NULL, _("Notes"));
  gtk_widget_show (radiobutton_select_type_notes);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_notes, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_notes));

  radiobutton_select_type_resource = gtk_radio_button_new_with_mnemonic (NULL, _("Resource"));
  gtk_widget_show (radiobutton_select_type_resource);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_resource, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_resource), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_resource));

  radiobutton_select_type_everything = gtk_radio_button_new_with_mnemonic (NULL, _("Everything"));
  gtk_widget_show (radiobutton_select_type_everything);
  gtk_box_pack_start (GTK_BOX (vbox_select_type), radiobutton_select_type_everything, FALSE, FALSE, 0);
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_select_type_everything), radiobutton_select_type_group);
  radiobutton_select_type_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_select_type_everything));

  Shortcuts shortcuts_select_type (0);
  shortcuts_select_type.button (radiobutton_select_type_bible);
  shortcuts_select_type.button (radiobutton_select_type_notes);
  shortcuts_select_type.button (radiobutton_select_type_resource);
  shortcuts_select_type.button (radiobutton_select_type_everything);
  shortcuts_select_type.consider_assistant();
  shortcuts_select_type.process();

  // Confirm or change Bible.
  vbox_bible_name = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox_bible_name);
  page_number_bible_name = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_bible_name);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_bible_name), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_bible_name, _("Is this the right Bible?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_bible_name, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_bible_name, true);

  label_bible_name = gtk_label_new (_("Bible name"));
  gtk_widget_show (label_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), label_bible_name, FALSE, FALSE, 0);

  button_bible_name = gtk_button_new ();
  gtk_widget_show (button_bible_name);
  gtk_box_pack_start (GTK_BOX (vbox_bible_name), button_bible_name, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_bible_name, "clicked", G_CALLBACK (on_button_bible_name_clicked), gpointer (this));

  GtkWidget *alignment1;
  GtkWidget *hbox1;
  GtkWidget *image1;
  GtkWidget *label1;

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_bible_name), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock (_("gtk-open"), GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label1 = gtk_label_new_with_mnemonic (_("Choose another one"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  Shortcuts shortcuts_bible_name (0);
  shortcuts_bible_name.label (label1);
  shortcuts_bible_name.consider_assistant();
  shortcuts_bible_name.process();

  // Confirm or change Resource.
  vbox_resource_name = gtk_vbox_new (FALSE, 5);
  gtk_widget_show (vbox_resource_name);
  page_number_resource_name = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_resource_name);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_resource_name), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_resource_name, _("Is this the right Resource?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_resource_name, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_resource_name, true);

  label_resource_name = gtk_label_new (_("Resource name"));
  gtk_widget_show (label_resource_name);
  gtk_box_pack_start (GTK_BOX (vbox_resource_name), label_resource_name, FALSE, FALSE, 0);

  button_resource_name = gtk_button_new ();
  gtk_widget_show (button_resource_name);
  gtk_box_pack_start (GTK_BOX (vbox_resource_name), button_resource_name, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_resource_name, "clicked", G_CALLBACK (on_button_resource_name_clicked), gpointer (this));

  alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment1);
  gtk_container_add (GTK_CONTAINER (button_resource_name), alignment1);

  hbox1 = gtk_hbox_new (FALSE, 2);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (alignment1), hbox1);

  image1 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
  gtk_widget_show (image1);
  gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);

  label1 = gtk_label_new_with_mnemonic (_("Choose another one"));
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);

  Shortcuts shortcuts_resource_name (0);
  shortcuts_resource_name.label (label1);
  shortcuts_resource_name.consider_assistant();
  shortcuts_resource_name.process();

  // Select file where to save to.
  vbox_file = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox_file);
  page_number_file = gtk_assistant_append_page (GTK_ASSISTANT (assistant), vbox_file);
  gtk_container_set_border_width (GTK_CONTAINER (vbox_file), 10);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), vbox_file, _("Where would you like to save it?"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), vbox_file, GTK_ASSISTANT_PAGE_CONTENT);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox_file, false);

  button_file = gtk_button_new ();
  gtk_widget_show (button_file);
  gtk_box_pack_start (GTK_BOX (vbox_file), button_file, FALSE, FALSE, 0);

  GtkWidget *alignment2;
  GtkWidget *hbox2;
  GtkWidget *image2;

  alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
  gtk_widget_show (alignment2);
  gtk_container_add (GTK_CONTAINER (button_file), alignment2);

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

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

  label_file = gtk_label_new_with_mnemonic ("");
  gtk_widget_show (label_file);
  gtk_box_pack_start (GTK_BOX (hbox2), label_file, FALSE, FALSE, 0);

  g_signal_connect ((gpointer) button_file, "clicked", G_CALLBACK (on_button_file_clicked), gpointer(this));

  // Build the confirmation stuff.
  label_confirm = gtk_label_new (_("Backup is about to be made"));
  gtk_widget_show (label_confirm);
  page_number_confirm = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_confirm);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_confirm, _("Backup is about to be made"));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_confirm, GTK_ASSISTANT_PAGE_CONFIRM);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_confirm, true);
  
  label_progress = gtk_label_new ("");
  gtk_widget_show (label_progress);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_progress);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_progress, "");
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_progress, GTK_ASSISTANT_PAGE_PROGRESS);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_progress, true);
  
  label_summary = gtk_label_new (_("Backup is done"));
  gtk_widget_show (label_summary);
  summary_page_number = gtk_assistant_append_page (GTK_ASSISTANT (assistant), label_summary);

  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label_summary, _("The backup was completed successfully."));
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label_summary, GTK_ASSISTANT_PAGE_SUMMARY);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label_summary, true);
  
  // Finish building assistant.
  gtk_widget_show_all (assistant);
  gtk_assistant_set_current_page (GTK_ASSISTANT (assistant), 0);
}