diff --git a/ChangeLog b/ChangeLog index 1733f18af9..bf5ad5e2c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-10-19 Sven Neumann + + * app/config/Makefile.am + * app/config/test-config.c: it became impossible to link the test + because the GimpRc class pulls in too many symbols. Changed it to + use a GimpGrid object instead. + + * app/core/gimpgrid.[ch]: reordered properties so they match the + order they appear in the grid dialog. + 2003-10-18 Sven Neumann * app/widgets/gimpdockbook.c: removed the "Select Tab" menu and diff --git a/app/config/Makefile.am b/app/config/Makefile.am index 1a92ce2d2f..f670412ce3 100644 --- a/app/config/Makefile.am +++ b/app/config/Makefile.am @@ -67,11 +67,11 @@ TESTS = test-config test_config_DEPENDENCIES = $(gimpconfig_libs) test_config_LDADD = \ - libappconfig.a \ ../base/libappbase.a \ ../core/libappcore.a \ ../display/libappdisplay.a \ ../widgets/libappwidgets.a \ + libappconfig.a \ $(top_builddir)/libgimpbase/libgimpbase-$(LT_RELEASE).la \ $(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \ $(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \ diff --git a/app/config/test-config.c b/app/config/test-config.c index 0f656ab043..2f04cf3b65 100644 --- a/app/config/test-config.c +++ b/app/config/test-config.c @@ -26,15 +26,14 @@ #include -#include "libgimpbase/gimplimits.h" -#include "libgimpbase/gimpbasetypes.h" +#include "libgimpbase/gimpbase.h" -#include "config-types.h" +#include "core/core-types.h" +#include "core/gimpgrid.h" #include "gimpconfig.h" #include "gimpconfig-serialize.h" #include "gimpconfig-utils.h" -#include "gimprc.h" static void notify_callback (GObject *object, @@ -48,8 +47,8 @@ int main (int argc, char *argv[]) { - GimpConfig *gimprc; - GimpConfig *gimprc2; + GimpConfig *grid; + GimpConfig *grid2; const gchar *filename = "foorc"; gchar *header; gchar *result; @@ -70,20 +69,20 @@ main (int argc, g_type_init (); - g_print ("\nTesting GimpConfig ...\n\n"); + g_print ("\nTesting GimpConfig ...\n"); - g_print (" Creating a new GimpRc object ..."); - gimprc = g_object_new (GIMP_TYPE_RC, NULL); - g_print (" done.\n\n"); + g_print (" Creating a new Grid object ..."); + grid = g_object_new (GIMP_TYPE_GRID, NULL); + g_print (" done.\n"); g_print (" Adding the unknown token (foobar \"hadjaha\") ..."); - gimp_config_add_unknown_token (gimprc, "foobar", "hadjaha"); - g_print (" done.\n\n"); + gimp_config_add_unknown_token (grid, "foobar", "hadjaha"); + g_print (" done.\n"); g_print (" Serializing %s to '%s' ...", - g_type_name (G_TYPE_FROM_INSTANCE (gimprc)), filename); + g_type_name (G_TYPE_FROM_INSTANCE (grid)), filename); - if (! gimp_config_serialize_to_file (gimprc, + if (! gimp_config_serialize_to_file (grid, filename, "foorc", "end of foorc", NULL, &error)) @@ -91,69 +90,40 @@ main (int argc, g_print ("%s\n", error->message); return EXIT_FAILURE; } - g_print (" done.\n\n"); + g_print (" done.\n"); - g_signal_connect (gimprc, "notify", + g_signal_connect (grid, "notify", G_CALLBACK (notify_callback), NULL); - g_print (" Deserializing from '%s' ...\n\n", filename); - if (! gimp_config_deserialize_file (gimprc, filename, NULL, &error)) + g_print (" Deserializing from '%s' ...\n", filename); + if (! gimp_config_deserialize_file (grid, filename, NULL, &error)) { g_print ("%s\n", error->message); return EXIT_FAILURE; } - header = "\n Unknown string tokens:\n"; - gimp_config_foreach_unknown_token (gimprc, output_unknown_token, &header); - g_print ("\n done.\n"); - - g_print ("\n Changing a property ..."); - g_object_set (gimprc, "use-help", FALSE, NULL); - - g_print ("\n Testing gimp_config_duplicate() ..."); - gimprc2 = gimp_config_duplicate (gimprc); + header = " Unknown string tokens:\n"; + gimp_config_foreach_unknown_token (grid, output_unknown_token, &header); g_print (" done.\n"); - g_signal_connect (gimprc2, "notify", + g_print (" Changing a property ..."); + g_object_set (grid, "style", GIMP_GRID_DOTS, NULL); + + g_print (" Testing gimp_config_duplicate() ..."); + grid2 = gimp_config_duplicate (grid); + g_print (" done.\n"); + + g_signal_connect (grid2, "notify", G_CALLBACK (notify_callback), NULL); - g_print ("\n Changing a property in the duplicate ..."); - g_object_set (gimprc2, "show-tips", FALSE, NULL); + g_print (" Changing a property in the duplicate ..."); + g_object_set (grid2, "xspacing", 20.0, NULL); - g_print ("\n Querying for \"default-comment\" ... "); + g_object_unref (grid2); - result = gimp_rc_query (GIMP_RC (gimprc2), "default-comment"); - if (result) - { - g_print ("OK, found \"%s\".\n", result); - } - else - { - g_print ("failed!\n"); - return EXIT_FAILURE; - } - g_free (result); - - g_print (" Querying for \"foobar\" ... "); - - result = gimp_rc_query (GIMP_RC (gimprc2), "foobar"); - if (result && strcmp (result, "hadjaha") == 0) - { - g_print ("OK, found \"%s\".\n", result); - } - else - { - g_print ("failed!\n"); - return EXIT_FAILURE; - } - - g_free (result); - - g_object_unref (gimprc2); - - g_print ("\n Deserializing from gimpconfig.c (should fail) ..."); - if (! gimp_config_deserialize_file (gimprc, "gimpconfig.c", NULL, &error)) + g_print (" Deserializing from gimpconfig.c (should fail) ..."); + if (! gimp_config_deserialize_file (grid, "gimpconfig.c", NULL, &error)) { g_print (" OK, failed. The error was:\n %s\n", error->message); g_error_free (error); @@ -165,13 +135,13 @@ main (int argc, return EXIT_FAILURE; } - g_print ("\n Serializing to a string and back ... "); + g_print (" Serializing to a string and back ... "); - result = gimp_config_serialize_to_string (gimprc, NULL); + result = gimp_config_serialize_to_string (grid, NULL); - gimprc2 = g_object_new (GIMP_TYPE_RC, NULL); + grid2 = g_object_new (GIMP_TYPE_GRID, NULL); - if (! gimp_config_deserialize_string (gimprc2, result, -1, NULL, &error)) + if (! gimp_config_deserialize_string (grid2, result, -1, NULL, &error)) { g_print ("failed!\nThe error was:\n %s\n", error->message); g_error_free (error); @@ -179,7 +149,7 @@ main (int argc, } else { - GList *diff = gimp_config_diff (gimprc, gimprc2, 0); + GList *diff = gimp_config_diff (grid, grid2, 0); if (diff) { @@ -198,10 +168,10 @@ main (int argc, } g_free (result); - g_object_unref (gimprc2); - g_object_unref (gimprc); + g_object_unref (grid2); + g_object_unref (grid); - g_print ("\nFinished test of GimpConfig.\n\n"); + g_print ("Finished test of GimpConfig.\n\n"); return EXIT_SUCCESS; } diff --git a/app/core/gimpgrid.c b/app/core/gimpgrid.c index 4a42b11d34..7c10ed7ed9 100644 --- a/app/core/gimpgrid.c +++ b/app/core/gimpgrid.c @@ -43,15 +43,15 @@ enum { PROP_0, + PROP_STYLE, + PROP_FGCOLOR, + PROP_BGCOLOR, PROP_XSPACING, PROP_YSPACING, PROP_SPACING_UNIT, PROP_XOFFSET, PROP_YOFFSET, - PROP_OFFSET_UNIT, - PROP_FGCOLOR, - PROP_BGCOLOR, - PROP_STYLE + PROP_OFFSET_UNIT }; static void gimp_grid_class_init (GimpGridClass *klass); @@ -123,6 +123,23 @@ gimp_grid_class_init (GimpGridClass *klass) gimp_rgba_set (&black, 0.0, 0.0, 0.0, GIMP_OPACITY_OPAQUE); gimp_rgba_set (&white, 1.0, 1.0, 1.0, GIMP_OPACITY_OPAQUE); + GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_STYLE, + "style", + N_("Line style used for the grid."), + GIMP_TYPE_GRID_STYLE, + GIMP_GRID_INTERSECTIONS, + 0); + GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_FGCOLOR, + "fgcolor", + N_("The foreground color of the grid."), + &black, + 0); + GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_BGCOLOR, + "bgcolor", + N_("The background color of the grid; " + "only used in double dashed line style."), + &white, + 0); GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XSPACING, "xspacing", N_("Horizontal spacing of grid lines."), @@ -155,23 +172,6 @@ gimp_grid_class_init (GimpGridClass *klass) "offset-unit", NULL, FALSE, FALSE, GIMP_UNIT_INCH, 0); - GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_FGCOLOR, - "fgcolor", - N_("The foreground color of the grid."), - &black, - 0); - GIMP_CONFIG_INSTALL_PROP_COLOR (object_class, PROP_BGCOLOR, - "bgcolor", - N_("The background color of the grid; " - "only used in double dashed line style."), - &white, - 0); - GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_STYLE, - "style", - N_("Line style used for the grid."), - GIMP_TYPE_GRID_STYLE, - GIMP_GRID_INTERSECTIONS, - 0); } static void @@ -191,6 +191,15 @@ gimp_grid_get_property (GObject *object, switch (property_id) { + case PROP_STYLE: + g_value_set_enum (value, grid->style); + break; + case PROP_FGCOLOR: + g_value_set_boxed (value, &grid->fgcolor); + break; + case PROP_BGCOLOR: + g_value_set_boxed (value, &grid->bgcolor); + break; case PROP_XSPACING: g_value_set_double (value, grid->xspacing); break; @@ -209,15 +218,6 @@ gimp_grid_get_property (GObject *object, case PROP_OFFSET_UNIT: g_value_set_int (value, grid->offset_unit); break; - case PROP_FGCOLOR: - g_value_set_boxed (value, &grid->fgcolor); - break; - case PROP_BGCOLOR: - g_value_set_boxed (value, &grid->bgcolor); - break; - case PROP_STYLE: - g_value_set_enum (value, grid->style); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -235,6 +235,17 @@ gimp_grid_set_property (GObject *object, switch (property_id) { + case PROP_STYLE: + grid->style = g_value_get_enum (value); + break; + case PROP_FGCOLOR: + color = g_value_get_boxed (value); + grid->fgcolor = *color; + break; + case PROP_BGCOLOR: + color = g_value_get_boxed (value); + grid->bgcolor = *color; + break; case PROP_XSPACING: grid->xspacing = g_value_get_double (value); break; @@ -253,17 +264,6 @@ gimp_grid_set_property (GObject *object, case PROP_OFFSET_UNIT: grid->offset_unit = g_value_get_int (value); break; - case PROP_FGCOLOR: - color = g_value_get_boxed (value); - grid->fgcolor = *color; - break; - case PROP_BGCOLOR: - color = g_value_get_boxed (value); - grid->bgcolor = *color; - break; - case PROP_STYLE: - grid->style = g_value_get_enum (value); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; diff --git a/app/core/gimpgrid.h b/app/core/gimpgrid.h index 6630942259..0f467a6e59 100644 --- a/app/core/gimpgrid.h +++ b/app/core/gimpgrid.h @@ -38,17 +38,17 @@ typedef struct _GimpGridClass GimpGridClass; struct _GimpGrid { - GimpObject parent_instance; + GimpObject parent_instance; + GimpGridStyle style; + GimpRGB fgcolor; + GimpRGB bgcolor; gdouble xspacing; gdouble yspacing; GimpUnit spacing_unit; gdouble xoffset; gdouble yoffset; GimpUnit offset_unit; - GimpRGB fgcolor; - GimpRGB bgcolor; - GimpGridStyle style; };