/** * adg_dim_set_limits: * @dim: an #AdgDim * @min: (allow-none): the new minumum value * @max: (allow-none): the new maximum value * * Shortcut to set both the limits at once. * * Since: 1.0 **/ void adg_dim_set_limits(AdgDim *dim, const gchar *min, const gchar *max) { g_return_if_fail(ADG_IS_DIM(dim)); g_object_freeze_notify((GObject *) dim); adg_dim_set_min(dim, min); adg_dim_set_max(dim, max); g_object_thaw_notify((GObject *) dim); }
static void _adg_property_min(void) { AdgDim *dim; const gchar *valid_text, *latin1_text; const gchar *min; gchar *min_dup; dim = ADG_DIM(adg_ldim_new()); valid_text = "This is some text..."; latin1_text = "This is some àèìòù Latin1 text..."; /* Using the public APIs */ adg_dim_set_min(dim, valid_text); min = adg_dim_get_min(dim); g_assert_cmpstr(min, ==, valid_text); adg_dim_set_min(dim, latin1_text); min = adg_dim_get_min(dim); g_assert_cmpstr(min, ==, latin1_text); adg_dim_set_min(dim, NULL); min = adg_dim_get_min(dim); g_assert_null(min); /* Using GObject property methods */ g_object_set(dim, "min", valid_text, NULL); g_object_get(dim, "min", &min_dup, NULL); g_assert_cmpstr(min_dup, ==, valid_text); g_free(min_dup); g_object_set(dim, "min", latin1_text, NULL); g_object_get(dim, "min", &min_dup, NULL); g_assert_cmpstr(min_dup, ==, latin1_text); g_free(min_dup); g_object_set(dim, "min", NULL, NULL); g_object_get(dim, "min", &min_dup, NULL); g_assert_null(min_dup); adg_entity_destroy(ADG_ENTITY(dim)); }