[maemo-commits] [maemo-commits] r8578 - in projects/haf/trunk/hildon-theme-tools: . scripts src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Dec 4 15:36:42 EET 2006
- Previous message: [maemo-commits] r8577 - projects/haf/tags/dbus
- Next message: [maemo-commits] r8579 - in projects/haf/branches/hildon-fm/1.x: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2006-12-04 15:36:40 +0200 (Mon, 04 Dec 2006) New Revision: 8578 Modified: projects/haf/trunk/hildon-theme-tools/ChangeLog projects/haf/trunk/hildon-theme-tools/README projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-mk-bundle projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-rc-parser projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-subst projects/haf/trunk/hildon-theme-tools/src/colourizer.c projects/haf/trunk/hildon-theme-tools/src/common.c projects/haf/trunk/hildon-theme-tools/src/outliner.c projects/haf/trunk/hildon-theme-tools/src/regenerator.c projects/haf/trunk/hildon-theme-tools/src/slicer.c Log: Last changes to error-reporting. Modified: projects/haf/trunk/hildon-theme-tools/ChangeLog =================================================================== --- projects/haf/trunk/hildon-theme-tools/ChangeLog 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/ChangeLog 2006-12-04 13:36:40 UTC (rev 8578) @@ -1,3 +1,16 @@ +2006-12-04 Michael Dominic K. <mdk at mdk.am> + + * README: Typo fix. + + * scripts/hildon-theme-mk-bundle: + * scripts/hildon-theme-rc-parser: + * scripts/hildon-theme-subst: + * src/colourizer.c: + * src/common.c: + * src/outliner.c: + * src/regenerator.c: + * src/slicer.c: Last changes to error-reporting. + 2006-12-01 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> * src/common.c: Modified: projects/haf/trunk/hildon-theme-tools/README =================================================================== --- projects/haf/trunk/hildon-theme-tools/README 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/README 2006-12-04 13:36:40 UTC (rev 8578) @@ -1,5 +1,5 @@ These are the hildon theme tools -------------------------------- +-------------------------------- These tools allow you to create themes for the maemo platform. They are intended to support the various theme layout packages (such as Modified: projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-mk-bundle =================================================================== --- projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-mk-bundle 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-mk-bundle 2006-12-04 13:36:40 UTC (rev 8578) @@ -38,7 +38,7 @@ if ($#ARGV + 1 < 1) { show_banner; show_usage (); - print STDERR "ERROR: Not enough arguments specified.\n"; + print STDERR "Not enough arguments specified.\n"; exit 128; } Modified: projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-rc-parser =================================================================== --- projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-rc-parser 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-rc-parser 2006-12-04 13:36:40 UTC (rev 8578) @@ -65,7 +65,7 @@ if ($#ARGV + 1 < 2) { show_banner; show_usage (); - print STDERR "ERROR: Not enough arguments specified.\n"; + print STDERR "Not enough arguments specified.\n"; exit 128; } Modified: projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-subst =================================================================== --- projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-subst 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/scripts/hildon-theme-subst 2006-12-04 13:36:40 UTC (rev 8578) @@ -68,7 +68,7 @@ if ($#ARGV + 1 < 4) { show_banner; show_usage (); - print STDERR "ERROR: Not enough arguments specified.\n"; + print STDERR "Not enough arguments specified.\n"; exit 128; } Modified: projects/haf/trunk/hildon-theme-tools/src/colourizer.c =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/colourizer.c 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/src/colourizer.c 2006-12-04 13:36:40 UTC (rev 8578) @@ -34,7 +34,7 @@ if (color->X > templ->Width || color->Y > templ->Height) - g_warning ("Color '%s' is out of bounds!", color->Name); + g_printerr ("WARNING: Color '%s' is out of bounds!\n", color->Name); else { gchar *hex = get_color (color, pixbuf); if (hex != NULL) { @@ -95,7 +95,8 @@ if (argc != 3) { show_banner (); show_usage (); - g_error ("Not enough arguments given!"); + g_printerr ("Not enough arguments given!\n"); + goto Error; } /* Get file vals */ @@ -105,30 +106,39 @@ if (template_file == NULL || image_file == NULL) { show_banner (); show_usage (); - g_error ("Bad arguments given!"); + g_printerr ("Bad arguments given!\n"); + goto Error; } /* Check the template file... */ - if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) - g_error ("%s not found!", template_file); + if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) { + g_printerr ("ERROR: %s not found!\n", template_file); + goto Error; + } /* Check the image file... */ - if (! g_file_test (image_file, G_FILE_TEST_EXISTS)) - g_error ("%s not found!", image_file); + if (! g_file_test (image_file, G_FILE_TEST_EXISTS)) { + g_printerr ("ERROR: %s not found!\n", image_file); + goto Error; + } /* Read the template file. That spits out errorsi/aborts too */ template = read_template (template_file); /* Try loading the actual image */ image = gdk_pixbuf_new_from_file (image_file, NULL); - if (image == NULL) - g_error ("Failed to load image file!"); + if (image == NULL) { + g_printerr ("ERROR: Failed to load image file!\n"); + goto Error; + } /* Check the color bits */ if ((gdk_pixbuf_get_n_channels (image) != 3 && gdk_pixbuf_get_n_channels (image) != 4) || - gdk_pixbuf_get_bits_per_sample (image) != 8) - g_error ("Only RGB and RGBA images are supported!"); + gdk_pixbuf_get_bits_per_sample (image) != 8) { + g_printerr ("ERROR: Only RGB and RGBA images are supported!\n"); + goto Error; + } process (template, image); goto Done; Modified: projects/haf/trunk/hildon-theme-tools/src/common.c =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/common.c 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/src/common.c 2006-12-04 13:36:40 UTC (rev 8578) @@ -36,40 +36,54 @@ g_return_val_if_fail (templ != NULL, NULL); g_return_val_if_fail (key_file != NULL, NULL); - if (! g_key_file_load_from_file (key_file, template_file, G_KEY_FILE_NONE, NULL)) - g_error ("Failed to load and parse template file!"); + if (! g_key_file_load_from_file (key_file, template_file, G_KEY_FILE_NONE, NULL)) { + g_printerr ("ERROR: Failed to load and parse template file!\n"); + exit (128); + } g_key_file_set_list_separator (key_file, ','); /* Do some basic checks... */ - if (! g_key_file_has_group (key_file, "Main")) - g_error ("[Main] group not present, invalid template file!"); + if (! g_key_file_has_group (key_file, "Main")) { + g_printerr ("ERROR: [Main] group not present, invalid template file!\n"); + exit (128); + } - if (! g_key_file_has_group (key_file, "Elements")) - g_error ("[Elements] group not present, invalid template file!"); + if (! g_key_file_has_group (key_file, "Elements")) { + g_printerr ("ERROR: [Elements] group not present, invalid template file!\n"); + exit (128); + } /* More specific checks... */ - if (! g_key_file_has_key (key_file, "Main", "TemplateWidth", NULL)) - g_error ("No TemplateWidth specified!"); + if (! g_key_file_has_key (key_file, "Main", "TemplateWidth", NULL)) { + g_printerr ("ERROR: No TemplateWidth specified!\n"); + exit (128); + } - if (! g_key_file_has_key (key_file, "Main", "TemplateHeight", NULL)) - g_error ("No TemplateHeight specified!"); + if (! g_key_file_has_key (key_file, "Main", "TemplateHeight", NULL)) { + g_printerr ("ERROR: No TemplateHeight specified!\n"); + exit (128); + } /* Extract our basic params */ templ->Width = g_key_file_get_integer (key_file, "Main", "TemplateWidth", NULL); templ->Height = g_key_file_get_integer (key_file, "Main", "TemplateHeight", NULL); - if (templ->Width == 0 || templ->Height == 0) - g_error ("Bad template dimensions!"); + if (templ->Width == 0 || templ->Height == 0) { + g_printerr ("ERROR: Bad template dimensions!\n"); + exit (128); + } /* Get all the elements */ element_keys = g_key_file_get_keys (key_file, "Elements", &element_count, NULL); - if (element_keys == NULL || element_count == 0) - g_error ("No elements found!"); + if (element_keys == NULL || element_count == 0) { + g_printerr ("ERROR: No elements found!\n"); + exit (128); + } for (i = 0; i < element_count; i++) { Element *element = new_element_from_key (key_file, element_keys [i]); if (element == NULL) - g_warning ("Failed to parse '%s'!", element_keys [i]); + g_printerr ("WARNING: Failed to parse '%s'!\n", element_keys [i]); else templ->ElementList = g_slist_append (templ->ElementList, element); @@ -84,7 +98,7 @@ for (i = 0; i < color_count; i++) { Color *color = new_color_from_key (key_file, color_keys [i]); if (color == NULL) - g_warning ("Failed to parse '%s'!", color_keys [i]); + g_printerr ("WARNING: Failed to parse '%s'!\n", color_keys [i]); else templ->ColorList = g_slist_append (templ->ColorList, color); Modified: projects/haf/trunk/hildon-theme-tools/src/outliner.c =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/outliner.c 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/src/outliner.c 2006-12-04 13:36:40 UTC (rev 8578) @@ -30,8 +30,10 @@ g_return_val_if_fail (templ != NULL, NULL); - if (composite_image == NULL) - g_error ("Failed to allocate memory for new image (%d x %d)!", templ->Width, templ->Height); + if (composite_image == NULL) { + g_printerr ("ERROR: Failed to allocate memory for new image (%d x %d)!\n", templ->Width, templ->Height); + exit (128); + } /* Reset the pixbuf to transparent white */ gdk_pixbuf_fill (composite_image, 0xffffff00); @@ -44,7 +46,7 @@ element->Y > templ->Height || element->X + element->Width > templ->Width || element->Y + element->Height > templ->Height) { - g_warning ("Element '%s' is out of bounds (%d %d %d %d)!", element->Name, + g_printerr ("WARNING: Element '%s' is out of bounds (%d %d %d %d)!\n", element->Name, element->X, element->Y, element->Width, element->Height); } else { image = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, element->Width, element->Height); @@ -65,7 +67,7 @@ /* Draw the stuff over the composite image */ gdk_pixbuf_copy_area (image, 0, 0, element->Width, element->Height, composite_image, element->X, element->Y); - g_print ("OUTLINED %s\n", element->Name); + g_print ("Outlined %s\n", element->Name); gdk_pixbuf_unref (image); } @@ -107,7 +109,8 @@ if (argc < 3) { show_banner (); show_usage (); - g_error ("Not enough arguments given!"); + g_printerr ("Not enough arguments given!\n"); + goto Error; } /* Get file vals */ @@ -117,12 +120,15 @@ if (template_file == NULL || output_image_file == NULL) { show_banner (); show_usage (); - g_error ("Bad arguments given!"); + g_printerr ("Bad arguments given!\n"); + goto Error; } /* Check the template file... */ - if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) - g_error ("%s not found!", template_file); + if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) { + g_printerr ("ERROR: %s not found!\n", template_file); + goto Error; + } /* Read the template file. That spits out errors too */ template = read_template (template_file); Modified: projects/haf/trunk/hildon-theme-tools/src/regenerator.c =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/regenerator.c 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/src/regenerator.c 2006-12-04 13:36:40 UTC (rev 8578) @@ -29,8 +29,10 @@ g_return_val_if_fail (templ != NULL, NULL); - if (composite_image == NULL) - g_error ("Failed to allocate memory for new image (%d x %d)!", templ->Width, templ->Height); + if (composite_image == NULL) { + g_printerr ("ERROR: Failed to allocate memory for new image (%d x %d)!\n", templ->Width, templ->Height); + exit (128); + } /* Reset the pixbuf to transparent white */ gdk_pixbuf_fill (composite_image, 0xffffff00); @@ -49,24 +51,24 @@ element->Y > templ->Height || element->X + element->Width > templ->Width || element->Y + element->Height > templ->Height) { - g_warning ("Element '%s' is out of bounds (%d %d %d %d)!", element->Name, - element->X, element->Y, element->Width, element->Height); + g_printerr ("WARNING: Element '%s' is out of bounds (%d %d %d %d)!\n", element->Name, + element->X, element->Y, element->Width, element->Height); } else if (! g_file_test (fname, G_FILE_TEST_EXISTS)) { - g_warning ("Element file name '%s' not found, using PINK!", element->Name); + g_printerr ("WARNING: Element file name '%s' not found, using PINK!\n", element->Name); image = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, element->Width, element->Height); gdk_pixbuf_fill (image, 0xff00ffff); } else { image = gdk_pixbuf_new_from_file (fname, NULL); if (image == NULL) - g_warning ("Failed to load element image '%s', ignoring!", - element->Name); + g_printerr ("WARNING: Failed to load element image '%s', ignoring!\n", + element->Name); } if (image != NULL) { /* Draw the stuff over the composite image */ gdk_pixbuf_copy_area (image, 0, 0, element->Width, element->Height, composite_image, element->X, element->Y); - g_print ("PROCESSED %s\n", element->Name); + g_print ("Processed %s\n", element->Name); gdk_pixbuf_unref (image); } @@ -110,7 +112,8 @@ if (argc < 3) { show_banner (); show_usage (); - g_error ("Not enough arguments given!"); + g_printerr ("Not enough arguments given!\n"); + goto Error; } /* Get file vals */ @@ -120,12 +123,15 @@ if (template_file == NULL || output_image_file == NULL) { show_banner (); show_usage (); - g_error ("Bad arguments given!"); + g_printerr ("Bad arguments given!\n"); + goto Error; } /* Check the template file... */ - if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) - g_error ("%s not found!", template_file); + if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) { + g_printerr ("ERROR: %s not found!\n", template_file); + goto Error; + } /* Check the optional directory argument */ if (argc >= 4 && argv [3] != NULL) Modified: projects/haf/trunk/hildon-theme-tools/src/slicer.c =================================================================== --- projects/haf/trunk/hildon-theme-tools/src/slicer.c 2006-12-04 12:11:55 UTC (rev 8577) +++ projects/haf/trunk/hildon-theme-tools/src/slicer.c 2006-12-04 13:36:40 UTC (rev 8578) @@ -87,7 +87,7 @@ height, width * 3, g_free, - new_pixels); + (gpointer) new_pixels); return new; } @@ -121,8 +121,8 @@ element->Y > templ->Height || element->X + element->Width > templ->Width || element->Y + element->Height > templ->Height) { - g_warning ("Element '%s' is out of bounds (%d %d %d %d)!", element->Name, - element->X, element->Y, element->Width, element->Height); + g_printerr ("WARNING: Element '%s' is out of bounds (%d %d %d %d)!\n", element->Name, + element->X, element->Y, element->Width, element->Height); } else { /* Create the sub-pixbuf representing the extracted bit */ @@ -131,7 +131,7 @@ element->Width, element->Height); if (sub == NULL) - g_warning ("Failed to process '%s'!", element->Name); + g_printerr ("WARNING: Failed to process '%s'!\n", element->Name); else { gchar *fname = g_build_filename (directory, element->Name, NULL); @@ -155,7 +155,7 @@ g_free (fname); gdk_pixbuf_unref (sub); - g_print ("PROCESSED %s\n", element->Name); + g_printerr ("WARNING: Processed %s\n", element->Name); } } } @@ -194,7 +194,8 @@ if (argc < 3) { show_banner (); show_usage (); - g_error ("Not enough arguments given!"); + g_printerr ("Not enough arguments given!\n"); + goto Error; } /* Get file vals */ @@ -204,24 +205,31 @@ if (template_file == NULL || image_file == NULL) { show_banner (); show_usage (); - g_error ("Bad arguments given!"); + g_printerr ("Bad arguments given!\n"); + goto Error; } /* Check the template file... */ - if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) - g_error ("%s not found!", template_file); + if (! g_file_test (template_file, G_FILE_TEST_EXISTS)) { + g_printerr ("ERROR: %s not found!\n", template_file); + goto Error; + } /* Check the image file... */ - if (! g_file_test (image_file, G_FILE_TEST_EXISTS)) - g_error ("%s not found!", image_file); + if (! g_file_test (image_file, G_FILE_TEST_EXISTS)) { + g_printerr ("ERROR: %s not found!\n", image_file); + goto Error; + } /* Check the optional directory argument */ if (argc >= 4 && argv [3] != NULL) { directory = argv [3]; if (! g_file_test (directory, G_FILE_TEST_IS_DIR || G_FILE_TEST_EXISTS)) { g_print ("Creating directory %s\n", directory); - if (g_mkdir_with_parents (directory, 493) != 0) - g_error ("Failed to create directory!"); + if (g_mkdir_with_parents (directory, 493) != 0) { + g_printerr ("ERROR: Failed to create directory!\n"); + goto Error; + } } } @@ -236,8 +244,10 @@ /* Try loading the actual image */ image = gdk_pixbuf_new_from_file (image_file, NULL); - if (image == NULL) - g_error ("Failed to load image file!"); + if (image == NULL) { + g_printerr ("ERROR: Failed to load image file!\n"); + goto Error; + } process (template, image, directory);
- Previous message: [maemo-commits] r8577 - projects/haf/tags/dbus
- Next message: [maemo-commits] r8579 - in projects/haf/branches/hildon-fm/1.x: . debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]