Esempio n. 1
0
static void
proj_notes_changed (GtkTextBuffer *entry, NotesArea *na)
{
	PRJ_SETUP
	str = xxxgtk_textview_get_text (na->proj_notes);
	gtt_project_set_notes (na->proj, str);
	na->ignore_events = FALSE;
}
Esempio n. 2
0
static void
task_notes_changed (GtkTextBuffer *entry, NotesArea *na)
{
	TSK_SETUP;
	str = xxxgtk_textview_get_text (na->task_notes);
	gtt_task_set_notes (tsk, str);
	na->ignore_events = FALSE;
}
Esempio n. 3
0
static void
prop_set(GnomePropertyBox * pb, gint page, PropDlg *dlg)
{
	long ivl;
	const gchar *cstr;
	gchar *str;
	double rate;
	time_t tval;

	if (!dlg->proj) return;

	if (0 == page)
	{
		gtt_project_freeze (dlg->proj);
		cstr = gtk_entry_get_text(dlg->title);
		if (cstr && cstr[0])
		{
			gtt_project_set_title(dlg->proj, cstr);
		}
		else
		{
			gtt_project_set_title(dlg->proj, _("empty"));
			gtk_entry_set_text(dlg->title, _("empty"));
		}
	
		gtt_project_set_desc(dlg->proj, gtk_entry_get_text(dlg->desc));
		str = xxxgtk_textview_get_text(dlg->notes);
		gtt_project_set_notes(dlg->proj, str);
		g_free(str);
		gtt_project_thaw (dlg->proj);
	}

	if (1 == page)
	{
		gtt_project_freeze (dlg->proj);
		rate = atof (gtk_entry_get_text(dlg->regular));
		gtt_project_set_billrate (dlg->proj, rate);
		rate = atof (gtk_entry_get_text(dlg->overtime));
		gtt_project_set_overtime_rate (dlg->proj, rate);
		rate = atof (gtk_entry_get_text(dlg->overover));
		gtt_project_set_overover_rate (dlg->proj, rate);
		rate = atof (gtk_entry_get_text(dlg->flatfee));
		gtt_project_set_flat_fee (dlg->proj, rate);
		gtt_project_thaw (dlg->proj);
	}
	
	if (2 == page)
	{
		gtt_project_freeze (dlg->proj);
		ivl = atoi (gtk_entry_get_text(dlg->minimum));
		gtt_project_set_min_interval (dlg->proj, ivl);
		ivl = atoi (gtk_entry_get_text(dlg->interval));
		gtt_project_set_auto_merge_interval (dlg->proj, ivl);
		ivl = atoi (gtk_entry_get_text(dlg->gap));
		gtt_project_set_auto_merge_gap (dlg->proj, ivl);
		gtt_project_thaw (dlg->proj);
	}
	if (3 == page)
	{
		gtt_project_freeze (dlg->proj);
		
		ivl = (long) GET_MENU (dlg->urgency, "urgency");
		gtt_project_set_urgency (dlg->proj, (GttRank) ivl);
		ivl = (long) GET_MENU (dlg->importance, "importance");
		gtt_project_set_importance (dlg->proj, (GttRank) ivl);

		ivl = (long) GET_MENU (dlg->status, "status");
		gtt_project_set_status (dlg->proj, (GttProjectStatus) ivl);

		tval = gnome_date_edit_get_time (dlg->start);
		gtt_project_set_estimated_start (dlg->proj, tval);
		tval = gnome_date_edit_get_time (dlg->end);
		gtt_project_set_estimated_end (dlg->proj, tval);
		tval = gnome_date_edit_get_time (dlg->due);
		gtt_project_set_due_date (dlg->proj, tval);

		rate = atof (gtk_entry_get_text(dlg->sizing));
		ivl = rate * 3600.0;
		gtt_project_set_sizing (dlg->proj, ivl);

		ivl = atoi (gtk_entry_get_text(dlg->percent));
		gtt_project_set_percent_complete (dlg->proj, ivl);

		gtt_project_thaw (dlg->proj);
	}
}
Esempio n. 4
0
static gboolean
ap_close_period (GnomeDruidPage *druidpage,
                 GtkWidget *druid,
                 gpointer user_data)
{
    AcctPeriodInfo *info = user_data;
    QofBook *closed_book = NULL, *current_book;
    const char *btitle;
    char *bnotes;
    Timespec closing_date;
    KvpFrame *book_frame;
    gboolean really_do_close_books = FALSE;

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

    current_book = gnc_get_current_book ();

    btitle = gtk_entry_get_text (info->book_title);
    bnotes = xxxgtk_textview_get_text (info->book_notes);
    PINFO("book title=%s\n", btitle);

    timespecFromTime_t (&closing_date,
                        gnc_timet_get_day_end_gdate (&info->closing_date));

#define REALLY_DO_CLOSE_BOOKS
#ifdef REALLY_DO_CLOSE_BOOKS
    really_do_close_books = TRUE;
#endif /* REALLY_DO_CLOSE_BOOKS */

    if (really_do_close_books)
    {
        /* Close the books ! */
        qof_event_suspend ();
        gnc_suspend_gui_refresh ();

        scrub_all();
        closed_book = gnc_book_close_period (current_book, closing_date, NULL, btitle);

        book_frame = qof_book_get_slots(closed_book);
        kvp_frame_set_str (book_frame, "/book/title", btitle);
        kvp_frame_set_str (book_frame, "/book/notes", bnotes);

        qof_session_add_book (gnc_get_current_session(), closed_book);

        /* We must save now; if we don't, and the user bails without saving,
         * then opening account balances will be incorrect, and this can only
         * lead to unhappiness.
         */
        gnc_file_save ();
        gnc_resume_gui_refresh ();
        qof_event_resume ();
        gnc_gui_refresh_all ();  /* resume above should have been enough ??? */
    }
    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);

    /* If the next closing date is in the future, then we are done. */
    if (time(NULL) < gnc_timet_get_day_end_gdate (&info->closing_date))
    {
        return FALSE;
    }

    /* Load up the GUI for the next closing period. */
    gnc_frequency_setup_recurrence(info->period_menu, NULL, &info->closing_date);

    show_book_details (info);
    return TRUE;
}