示例#1
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_custom_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
    gchar *creation_function, *string1, *string2;
    gint int1, int2;

    creation_function = gb_widget_input_string (data, CreationFunction);
    if (data->apply)
    {
        g_free (gtk_object_get_data (GTK_OBJECT (widget), CreationFunction));
        gtk_object_set_data (GTK_OBJECT (widget), CreationFunction,
                             g_strdup (creation_function));

        /* If we are applying the property, we set the last modification time. */
        if (data->action == GB_APPLYING)
        {
            gb_custom_set_last_mod_time (widget, -1);
        }
    }

    string1 = gb_widget_input_string (data, String1);
    if (data->apply)
    {
        g_free (gtk_object_get_data (GTK_OBJECT (widget), String1));
        gtk_object_set_data (GTK_OBJECT (widget), String1, g_strdup (string1));
    }

    string2 = gb_widget_input_string (data, String2);
    if (data->apply)
    {
        g_free (gtk_object_get_data (GTK_OBJECT (widget), String2));
        gtk_object_set_data (GTK_OBJECT (widget), String2, g_strdup (string2));
    }

    int1 = gb_widget_input_int (data, Int1);
    if (data->apply)
        gtk_object_set_data (GTK_OBJECT (widget), Int1, GINT_TO_POINTER (int1));

    int2 = gb_widget_input_int (data, Int2);
    if (data->apply)
        gtk_object_set_data (GTK_OBJECT (widget), Int2, GINT_TO_POINTER (int2));

    /* If we are loading, load the last modification time. */
    if (data->action == GB_LOADING)
    {
        time_t last_mod_time;

        last_mod_time = load_date (data, LastModTime);
        if (data->apply)
        {
            gb_custom_set_last_mod_time (widget, last_mod_time);
        }
    }
}
示例#2
0
void load(FILE *in)
{
	time_t actual = load_date(in);
	time_t expected = load_date(in);
	printf("%d\n", solve(actual, expected));
}