Ejemplo n.º 1
0
G_MODULE_EXPORT
void on_menu_runmakeindex_activate(GtkWidget *widget, void *user)
{
  if (latex_run_makeindex(g_active_editor)) {
    statusbar_set_message(_("Running Makeindex.."));
  } else {
    statusbar_set_message(_("Error running Makeindex.."));
  }
  motion_force_compile(gummi->motion);
}
Ejemplo n.º 2
0
G_MODULE_EXPORT
void on_menu_cleanup_activate(GtkWidget *widget, void *user)
{
  int result = latex_remove_auxfile(g_active_editor);

  if (result == 0) {
    statusbar_set_message(_("Succesfully removed build files.."));
  } else {
    statusbar_set_message(_("Error removing build files.."));
  }
}
Ejemplo n.º 3
0
G_MODULE_EXPORT
void on_menu_recent_activate(GtkWidget *widget, void *user)
{
  const gchar* name = gtk_menu_item_get_label(GTK_MENU_ITEM(widget));
  gchar* tstr;
  gint index = name[0] - '0' - 1;

  if (utils_path_exists(gui->recent_list[index])) {
    gui_open_file(gui->recent_list[index]);
  } else {
    tstr = g_strdup_printf(_("Error loading recent file: %s"),
                           gui->recent_list[index]);
    slog(L_ERROR, "%s\n", tstr);
    slog(L_G_ERROR, "Could not find the file %s.\n",
         gui->recent_list[index]);
    statusbar_set_message(tstr);
    g_free(tstr);
    g_free(gui->recent_list[index]);
    gui->recent_list[index] = NULL;
    while (index < RECENT_FILES_NUM - 1) {
      gui->recent_list[index] = gui->recent_list[index + 1];
      ++index;
    }
    gui->recent_list[RECENT_FILES_NUM - 1] = g_strdup("__NULL__");
  }
  display_recent_files(gui);
}
Ejemplo n.º 4
0
gboolean project_create_new(const gchar* filename)
{
  const gchar* version = g_strdup("0.6.0");
  const gchar* csetter = config_get_value("typesetter");
  const gchar* csteps = config_get_value("compile_steps");
  const gchar* rootfile = g_active_editor->filename;
  // TODO: do we need to encode this text?
  const gchar* content = g_strdup_printf("version=%s\n"
                                         "typesetter=%s\n"
                                         "steps=%s\n"
                                         "root=%s\n",
                                         version, csetter, csteps, rootfile);

  if (!STR_EQU(filename + strlen(filename) - 6, ".gummi")) {
    filename = g_strdup_printf("%s.gummi", filename);
  }

  statusbar_set_message(g_strdup_printf("Creating project file: %s",
                                        filename));
  utils_set_file_contents(filename, content, -1);

  gummi->project->projfile = g_strdup(filename);

  return TRUE;
}
Ejemplo n.º 5
0
G_MODULE_EXPORT
void on_menu_projopen_activate(GtkWidget *widget, void *user)
{

  gchar* filename = get_open_filename(TYPE_PROJECT);
  if (!filename) return;

  if (project_open_existing(filename)) {
    statusbar_set_message(g_strdup_printf("Loading project %s", filename));
    projectgui_enable(gummi->project, gui->projectgui);
    projectgui_list_projfiles(gummi->project->projfile);
  } else {
    statusbar_set_message(g_strdup_printf("An error ocurred while "
                                          "loading project %s", filename));
  }
  g_free(filename);
}
Ejemplo n.º 6
0
void iofunctions_load_file (GuIOFunc* io, const gchar* filename) {
    gchar* status;

    slog (L_INFO, "loading %s ...\n", filename);

    /* add Loading message to status bar and ensure GUI is current */
    status = g_strdup_printf ("Loading %s...", filename);
    statusbar_set_message (status);
    g_free (status);

    g_signal_emit_by_name (io->sig_hook, "document-load", filename);
}
Ejemplo n.º 7
0
void iofunctions_save_file (GuIOFunc* io, gchar* filename, gchar *text) {
    gchar* status = NULL;

    status = g_strdup_printf (_("Saving %s..."), filename);
    statusbar_set_message (status);    
    g_free (status);
    
    GObject *savecontext = g_object_new(G_TYPE_OBJECT, NULL);
    
    g_object_set_data (savecontext, "filename", filename);
    g_object_set_data (savecontext, "text", text);
    
    g_signal_emit_by_name (io->sig_hook, "document-write", savecontext);
    
    gtk_text_buffer_set_modified 
                (GTK_TEXT_BUFFER(gummi_get_active_editor()->buffer), FALSE);
}