Exemplo n.º 1
0
gboolean project_close(void)
{
  GList *tabs = NULL;
  int i = 0;
  tabs = g_list_copy(gummi_get_all_tabs());

  // XXX: needs refactor
  /* Disable compile thread to prevent it from compiling nonexisting editor */
  motion_stop_compile_thread(gummi->motion);
  tabmanager_set_active_tab(-1);

  for (i = 0; i < g_list_length(tabs); i++) {
    GuTabContext* tab = GU_TAB_CONTEXT(g_list_nth_data(tabs, i));
    if (tab->editor->projfile != NULL)
      on_menu_close_activate(NULL, tab);
  }
  g_list_free(tabs);

  /* Resume compile by selecting an active tag */
  if (gummi_get_all_tabs() != NULL)
    tabmanager_set_active_tab(0);
  motion_start_compile_thread(gummi->motion);

  return TRUE;
}
Exemplo n.º 2
0
gboolean iofunctions_autosave_cb (void *user) {
    gint tabtotal, i;
    GtkWidget *focus;
    GuTabContext* tab;
    GuEditor *ec;
    gchar *text;

    GList *tabs = gummi_get_all_tabs();
    tabtotal = g_list_length(tabs);
    
    /* skip the autosave procedure when there are no tabs open */
    if (tabtotal == 0) return TRUE; 

    for (i=0; i < tabtotal; i++) {
        tab = g_list_nth_data (tabs, i);
        ec = tab->editor;
        
        if ((ec->filename) && editor_buffer_changed (ec)) {
            focus = gtk_window_get_focus (gummi_get_gui ()->mainwindow);
            text = editor_grab_buffer (ec);
            gtk_widget_grab_focus (focus);
            iofunctions_save_file (gummi->io, ec->filename, text);
            gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (ec->buffer), FALSE);
            slog (L_DEBUG, "Autosaving document: %s\n", ec->filename);
            gui_set_filename_display (tab, TRUE, TRUE);
       }
    }
    return TRUE;
}
Exemplo n.º 3
0
GList* gummi_get_all_editors (void) {
    int tabtotal, i;
    GuEditor* ec;
    GList* editors = NULL;
    
    GList *tabs = gummi_get_all_tabs();
    tabtotal = g_list_length(tabs);
    
    for (i = 0; i < tabtotal; ++i) {
        ec = GU_TAB_CONTEXT (g_list_nth_data (tabs, i))->editor;
        editors = g_list_append (editors, ec);
    }
    return editors;
}