Beispiel #1
0
static void
date_optionmenu_changed_cb (GtkOptionMenu *option_menu,
			    DialogData    *data)
{
	char *first_image = data->file_list->data;
	int   idx = gtk_option_menu_get_history (option_menu);

	gtk_widget_set_sensitive (data->date_dateedit, idx == FOLLOWING_DATE);

	switch (idx) {
	case NO_DATE:
	case FOLLOWING_DATE:
	case NO_CHANGE:
		break;
	case CURRENT_DATE:
		gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit),
					  time (NULL));

		break;
	case IMAGE_CREATION_DATE:
		gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), 
					  get_file_ctime (first_image));
		break;
	case LAST_MODIFIED_DATE:
		gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), 
					  get_file_mtime (first_image));
		break;
	case EXIF_DATE:
		gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit),
					  get_metadata_time (NULL, first_image));
		break;
	}
}
Beispiel #2
0
void set_properties(ChartInstance *ci) {
	struct buysell_data *data=(struct buysell_data *)ci->instance_data;
	GnomePropertyBox *pbox;
	GladeXML *xxml;
	
	xxml=glade_xml_new(BUYSELLGLADE_FILE,"BuySellPropertyBox");
      	glade_xml_signal_autoconnect(xxml);

	pbox=(GnomePropertyBox *)glade_xml_get_widget(xxml,"BuySellPropertyBox");
	bs_cpick=(GnomeColorPicker *)glade_xml_get_widget(xxml,"BuySellColor");
	bs_pricespin=(GtkSpinButton *)glade_xml_get_widget(xxml,"BuySellPrice");
	bs_numstocks=(GtkSpinButton *)glade_xml_get_widget(xxml,"NumStocks");
	bs_date=(GnomeDateEdit *)glade_xml_get_widget(xxml,"Date");
	bs_buybotton=(GtkWidget *)glade_xml_get_widget(xxml,"BuyButton");
	bs_sellbutton=(GtkWidget *)glade_xml_get_widget(xxml,"SellButton");

	//Hack away the "apply"  button
	gtk_widget_hide(GNOME_PROPERTY_BOX(pbox)->apply_button);

	gnome_property_box_changed(pbox);	//Necessary, or the callback won't be called

	gnome_color_picker_set_i8(bs_cpick,data->r,data->g,data->b,data->a);
	gtk_spin_button_set_value(bs_pricespin,data->price);
	gtk_spin_button_set_value(bs_numstocks,data->amount);
	gnome_date_edit_set_time(bs_date,data->time);

	if (data->buy) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bs_buybotton),TRUE);
	else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bs_sellbutton),TRUE);

	bs_global_ci=ci;		
	gnome_dialog_run(GNOME_DIALOG(pbox));
}
Beispiel #3
0
void
fill_page_from_note_data(note_data *note)
{
    gint  len;
    gchar *buff;
    
    if (note->title != NULL)
    {
        gtk_entry_set_text(GTK_ENTRY(sp->title_entry), note->title);
    }
    if (note->text != NULL)
    {
        len = strlen(note->text);
        gtk_text_insert(GTK_TEXT(sp->text_entry), NULL, NULL, NULL, note->text,
                        len);
        gtk_editable_set_position(GTK_EDITABLE(sp->text_entry), 0);
    }

    time_label_set_time(TIME_LABEL(sp->tlabel_expire), note->expire);
    time_label_set_time(TIME_LABEL(sp->tlabel_created), note->created);
    time_label_set_time(TIME_LABEL(sp->tlabel_changed), note->changed);

    buff = g_strdup_printf("%ld", note->changes);
    gtk_label_set_text(GTK_LABEL(sp->label_changes), buff);
    g_free(buff);
    
    if (note->id != NULL)
    {
        gtk_entry_set_text(GTK_ENTRY(sp->note_id_entry), note->id);
    }
    
    if (note->notetype == CheckNote || note->notetype == TodoNote)
    {
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sp->todo_check),
                                     note->todo);
    }
    if (note->notetype == TodoNote)
    {
        gnome_date_edit_set_time(GNOME_DATE_EDIT(sp->de_deadline), note->deadline);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(sp->prio_entry), note->prio);

        gtk_signal_handler_block_by_func(
            GTK_OBJECT(sp->ad_complete), GTK_SIGNAL_FUNC(cb_complete_updates_done),
            sp->todo_check);
        gtk_adjustment_set_value(GTK_ADJUSTMENT(sp->ad_complete), note->complete);
        gtk_signal_handler_unblock_by_func(
            GTK_OBJECT(sp->ad_complete), GTK_SIGNAL_FUNC(cb_complete_updates_done),
            sp->todo_check);
    }
}
Beispiel #4
0
void
clear_text_page(gboolean add, gint *uncommitted)
{
    guint len;
    gint  ucm;

    ucm = *uncommitted;
    gtk_entry_set_text(GTK_ENTRY(sp->title_entry), "");
    if (add == TRUE)
    {
        time_label_set_time(TIME_LABEL(sp->tlabel_created), time(NULL));
    }
    else
    {
        time_label_set_time(TIME_LABEL(sp->tlabel_created), -1);
    }
    time_label_set_time(TIME_LABEL(sp->tlabel_changed), -1);
    if (add == TRUE)
    {
        gtk_label_set_text(GTK_LABEL(sp->label_changes), _("0"));
    }
    else
    {
        gtk_label_set_text(GTK_LABEL(sp->label_changes), "");
    }
    time_label_set_time(TIME_LABEL(sp->tlabel_expire), -1);
    gtk_entry_set_text(GTK_ENTRY(sp->note_id_entry), "");
    gnome_date_edit_set_time(GNOME_DATE_EDIT(sp->de_deadline), 0);
    gtk_entry_set_text(GTK_ENTRY(sp->prio_entry), "");
    gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sp->todo_check), FALSE);
    gtk_adjustment_set_value(GTK_ADJUSTMENT(sp->ad_complete), 0);
    len = gtk_text_get_length(GTK_TEXT(sp->text_entry));
    if (len)
    {
        gtk_text_freeze(GTK_TEXT(sp->text_entry));
        gtk_text_set_point(GTK_TEXT(sp->text_entry), 0);
        gtk_text_forward_delete(GTK_TEXT(sp->text_entry), len);
        gtk_text_thaw(GTK_TEXT(sp->text_entry));
    }
    *uncommitted = ucm;
}
Beispiel #5
0
static void
do_set_project(GttProject *proj, PropDlg *dlg)
{
	GttProjectStatus status;
	GttRank rank;
	time_t tval;
	char buff[132];
	time_t now = time(NULL);

	if (!dlg) return;

	if (!proj)
	{
		/* We null these out, because old values may be left
		 * over from an earlier project */
		dlg->proj = NULL;
		gtk_entry_set_text(dlg->title, "");
		gtk_entry_set_text(dlg->desc, "");
		xxxgtk_textview_set_text(dlg->notes, "");
		gtk_entry_set_text(dlg->regular, "0.0");
		gtk_entry_set_text(dlg->overtime, "0.0");
		gtk_entry_set_text(dlg->overover, "0.0");
		gtk_entry_set_text(dlg->flatfee, "0.0");
		gtk_entry_set_text(dlg->minimum, "0");
		gtk_entry_set_text(dlg->interval, "0");
		gtk_entry_set_text(dlg->gap, "0");

		gnome_date_edit_set_time(dlg->start, now);
		gnome_date_edit_set_time(dlg->end, now);
		gnome_date_edit_set_time(dlg->due, now+86400);
		gtk_entry_set_text(dlg->sizing, "0.0");
		gtk_entry_set_text(dlg->percent, "0");
		return;
	}


	/* set all the values. Do this even is new project is same as old
	 * project, since widget may be holding rejected changes. */
	dlg->proj = proj;

	gtk_entry_set_text(dlg->title, gtt_project_get_title(proj));
	gtk_entry_set_text(dlg->desc, gtt_project_get_desc(proj));
	xxxgtk_textview_set_text(dlg->notes, gtt_project_get_notes (proj));

	/* hack alert should use local currencies for this */
	g_snprintf (buff, 132, "%.2f", gtt_project_get_billrate(proj));
	gtk_entry_set_text(dlg->regular, buff);
	g_snprintf (buff, 132, "%.2f", gtt_project_get_overtime_rate(proj));
	gtk_entry_set_text(dlg->overtime, buff);
	g_snprintf (buff, 132, "%.2f", gtt_project_get_overover_rate(proj));
	gtk_entry_set_text(dlg->overover, buff);
	g_snprintf (buff, 132, "%.2f", gtt_project_get_flat_fee(proj));
	gtk_entry_set_text(dlg->flatfee, buff);

	g_snprintf (buff, 132, "%d", gtt_project_get_min_interval(proj));
	gtk_entry_set_text(dlg->minimum, buff);
	g_snprintf (buff, 132, "%d", gtt_project_get_auto_merge_interval(proj));
	gtk_entry_set_text(dlg->interval, buff);
	g_snprintf (buff, 132, "%d", gtt_project_get_auto_merge_gap(proj));
	gtk_entry_set_text(dlg->gap, buff);

	rank = gtt_project_get_urgency (proj);
	if (GTT_UNDEFINED   == rank) gtk_option_menu_set_history (dlg->urgency, 0);
	else if (GTT_LOW    == rank) gtk_option_menu_set_history (dlg->urgency, 1);
	else if (GTT_MEDIUM == rank) gtk_option_menu_set_history (dlg->urgency, 2);
	else if (GTT_HIGH   == rank) gtk_option_menu_set_history (dlg->urgency, 3);

	rank = gtt_project_get_importance (proj);
	if (GTT_UNDEFINED   == rank) gtk_option_menu_set_history (dlg->importance, 0);
	else if (GTT_LOW    == rank) gtk_option_menu_set_history (dlg->importance, 1);
	else if (GTT_MEDIUM == rank) gtk_option_menu_set_history (dlg->importance, 2);
	else if (GTT_HIGH   == rank) gtk_option_menu_set_history (dlg->importance, 3);

	status = gtt_project_get_status (proj);
	if (GTT_NO_STATUS	 == status) gtk_option_menu_set_history (dlg->status, 0);
	else if (GTT_NOT_STARTED == status) gtk_option_menu_set_history (dlg->status, 1);
	else if (GTT_IN_PROGRESS == status) gtk_option_menu_set_history (dlg->status, 2);
	else if (GTT_ON_HOLD     == status) gtk_option_menu_set_history (dlg->status, 3);
	else if (GTT_CANCELLED   == status) gtk_option_menu_set_history (dlg->status, 4);
	else if (GTT_COMPLETED   == status) gtk_option_menu_set_history (dlg->status, 5);

	tval = gtt_project_get_estimated_start (proj);
	if (-1 == tval) tval = now;
	gnome_date_edit_set_time (dlg->start, tval);
	tval = gtt_project_get_estimated_end (proj);
	if (-1 == tval) tval = now+3600;
	gnome_date_edit_set_time (dlg->end, tval);
	tval = gtt_project_get_due_date (proj);
	if (-1 == tval) tval = now+86400;
	gnome_date_edit_set_time (dlg->due, tval);

	g_snprintf (buff, 132, "%.2f", ((double) gtt_project_get_sizing(proj))/3600.0);
	gtk_entry_set_text(dlg->sizing, buff);
	g_snprintf (buff, 132, "%d", gtt_project_get_percent_complete(proj));
	gtk_entry_set_text(dlg->percent, buff);

	/* set to unmodified as it reflects the current state of the project */
	gnome_property_box_set_modified(GNOME_PROPERTY_BOX(dlg->dlg),
					FALSE);
}
Beispiel #6
0
void
dlg_comment_update (GtkWidget *dlg)
{
	DialogData    *data;
	CommentData   *cdata;
	GList         *scan;
	char          *first_image;

	g_return_if_fail (dlg != NULL);

	data = g_object_get_data (G_OBJECT (dlg), "dialog_data");
	g_return_if_fail (data != NULL);

	/**/
	
	free_dialog_data (data);

	data->file_list = gth_window_get_file_list_selection (data->window); 

	if (data->file_list == NULL) {
		gtk_widget_set_sensitive (data->ok_button, FALSE);
		gtk_widget_set_sensitive (data->comment_main_box, FALSE);
		return;
	} else 
		gtk_widget_set_sensitive (data->comment_main_box, TRUE);

	/* Set widgets data. */
	
	gtk_option_menu_set_history (GTK_OPTION_MENU (data->date_optionmenu), NO_DATE);
	gtk_text_buffer_set_text (data->note_text_buffer, "", -1);
	gtk_entry_set_text (GTK_ENTRY (data->place_entry), "");

	data->several_images = g_list_length (data->file_list) > 1;

	if (data->several_images) {
		gtk_widget_set_sensitive (data->save_changed_checkbutton, TRUE);
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->save_changed_checkbutton), TRUE);
	} else {
		gtk_widget_set_sensitive (data->save_changed_checkbutton, FALSE);
		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->save_changed_checkbutton), FALSE);
	}

	/* Does at least one image have exif data? */
	data->have_exif_data = FALSE;
	for (scan = data->file_list; scan; scan = scan->next)
		if (have_exif_time (scan->data)) {
			data->have_exif_data = TRUE;
			break;
		}
	
	first_image = data->file_list->data;
	data->original_cdata = cdata = comments_load_comment (first_image, TRUE);

	if (cdata != NULL) {
		comment_data_free_keywords (cdata);

		/* NULL-ify a field if it is not the same in all comments. */
		for (scan = data->file_list->next; scan; scan = scan->next) {
			CommentData *scan_cdata;

			scan_cdata = comments_load_comment (scan->data, TRUE);

			/* If there is no comment then all fields must be
			 * considered to differ. */

			if ((scan_cdata == NULL) 
			    || strcmp_null_tolerant (cdata->place, 
						      scan_cdata->place) != 0) {
				g_free (cdata->place);
				cdata->place = NULL;
			}
			
			if ((scan_cdata == NULL) 
			    || cdata->time != scan_cdata->time)
				cdata->time = 0;
			
			if ((scan_cdata == NULL) 
			    || strcmp_null_tolerant (cdata->comment, 
						      scan_cdata->comment) != 0) {
				g_free (cdata->comment);
				cdata->comment = NULL;
			}

			if (scan_cdata == NULL)
				break;

			comment_data_free (scan_cdata);
		}
	}

	gtk_widget_set_sensitive (get_exif_date_option_item (data), data->have_exif_data);
	gtk_widget_set_sensitive (data->date_dateedit, FALSE);

	if (cdata != NULL) {
		if (cdata->comment != NULL) {
			GtkTextIter iter;

			gtk_text_buffer_set_text (data->note_text_buffer,
						  cdata->comment, 
						  strlen (cdata->comment));

			gtk_text_buffer_get_iter_at_line (data->note_text_buffer,
							  &iter,
							  0);
			gtk_text_buffer_place_cursor (data->note_text_buffer,
						      &iter);
		}

		/**/

		if (cdata->place != NULL) 
			gtk_entry_set_text (GTK_ENTRY (data->place_entry), cdata->place);

		/**/

		if (cdata->time > 0) {
			gtk_option_menu_set_history (GTK_OPTION_MENU (data->date_optionmenu), FOLLOWING_DATE);
			gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), cdata->time);
			gtk_widget_set_sensitive (data->date_dateedit, TRUE);
		} else {
			if (data->several_images)
				gtk_option_menu_set_history (GTK_OPTION_MENU (data->date_optionmenu), NO_CHANGE);
			else
				gtk_option_menu_set_history (GTK_OPTION_MENU (data->date_optionmenu), NO_DATE);
			gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), get_file_ctime (first_image));
		}
	} else {
		time_t ctime = get_file_ctime (first_image);
		gtk_option_menu_set_history (GTK_OPTION_MENU (data->date_optionmenu), NO_DATE);
		gnome_date_edit_set_time (GNOME_DATE_EDIT (data->date_dateedit), ctime);
	}
}