Commit edf4ef1e authored by Manish Singh's avatar Manish Singh
Browse files

made the g_message errors a little smarter instead of popping up a ton of

* app/tile_swap.c: made the g_message errors a little smarter instead
of popping up a ton of dialogs

* app/layer.c
* app/channel.c
* app/gdisplay.c
* app/gimprc.c: some code cleanups

-Yosh
parent 27e90260
Sat Jul 4 16:58:43 PDT 1998 Manish Singh <yosh@gimp.org>
* app/tile_swap.c: made the g_message errors a little smarter instead
of popping up a ton of dialogs
* app/layer.c
* app/channel.c
* app/gdisplay.c
* app/gimprc.c: some code cleanups
Thu Jul 2 18:10:43 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* blend.c boundary.c by_color_select.c channel.c color_picker.c
......
......@@ -83,6 +83,7 @@ static long swap_file_grow = 16 * TILE_WIDTH * TILE_HEIGHT * 4;
static pthread_mutex_t swapfile_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
static gboolean seek_err_msg = TRUE, read_err_msg = TRUE, write_err_msg = TRUE;
static void
tile_swap_print_gaps (DefSwapFile *def_swap_file)
......@@ -110,7 +111,7 @@ tile_swap_exit1 (gpointer key,
DefSwapFile *def_swap_file;
if (tile_ref_count != 0)
g_print ("tile ref count balance: %d\n", tile_ref_count);
g_message ("tile ref count balance: %d\n", tile_ref_count);
swap_file = value;
if (swap_file->swap_func == tile_swap_default)
......@@ -118,7 +119,7 @@ tile_swap_exit1 (gpointer key,
def_swap_file = swap_file->user_data;
if (def_swap_file->swap_file_end != 0)
{
g_print ("swap file not empty: \"%s\"\n", swap_file->filename);
g_message ("swap file not empty: \"%s\"\n", swap_file->filename);
tile_swap_print_gaps (def_swap_file);
}
......@@ -381,7 +382,9 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
offset = lseek (fd, tile->swap_offset, SEEK_SET);
if (offset == -1)
{
g_message ("unable to seek to tile location on disk: %d", err);
if (seek_err_msg)
g_message ("unable to seek to tile location on disk: %d", err);
seek_err_msg = FALSE;
return;
}
}
......@@ -398,7 +401,9 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
if (err <= 0)
{
g_message ("unable to read tile data from disk: %d/%d ( %d ) bytes read", err, errno, nleft);
if (read_err_msg)
g_message ("unable to read tile data from disk: %d/%d ( %d ) bytes read", err, errno, nleft);
read_err_msg = FALSE;
return;
}
......@@ -409,6 +414,8 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
/* Do not delete the swap from the file */
/* tile_swap_default_delete (def_swap_file, fd, tile); */
read_err_msg = seek_err_msg = TRUE;
}
static void
......@@ -436,7 +443,9 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
offset = lseek (fd, tile->swap_offset, SEEK_SET);
if (offset == -1)
{
g_message ("unable to seek to tile location on disk: %d", errno);
if (seek_err_msg)
g_message ("unable to seek to tile location on disk: %d", errno);
seek_err_msg = FALSE;
return;
}
}
......@@ -447,7 +456,9 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
err = write (fd, tile->data + rbytes - nleft, nleft);
if (err <= 0)
{
g_message ("unable to write tile data to disk: %d ( %d ) bytes written", err, nleft);
if (write_err_msg)
g_message ("unable to write tile data to disk: %d ( %d ) bytes written", err, nleft);
write_err_msg = FALSE;
return;
}
......@@ -459,6 +470,8 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
/* g_free (tile->data);
tile->data = NULL; */
tile->dirty = FALSE;
write_err_msg = seek_err_msg = TRUE;
}
static void
......
......@@ -62,8 +62,8 @@ gimp_channel_get_type ()
sizeof (GimpChannelClass),
(GtkClassInitFunc) gimp_channel_class_init,
(GtkObjectInitFunc) gimp_channel_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......
......@@ -62,8 +62,8 @@ gimp_channel_get_type ()
sizeof (GimpChannelClass),
(GtkClassInitFunc) gimp_channel_class_init,
(GtkObjectInitFunc) gimp_channel_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......
......@@ -62,8 +62,8 @@ gimp_channel_get_type ()
sizeof (GimpChannelClass),
(GtkClassInitFunc) gimp_channel_class_init,
(GtkObjectInitFunc) gimp_channel_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......
......@@ -68,8 +68,8 @@ gimp_layer_get_type ()
sizeof (GimpLayerClass),
(GtkClassInitFunc) gimp_layer_class_init,
(GtkObjectInitFunc) gimp_layer_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......@@ -117,8 +117,8 @@ gimp_layer_mask_get_type ()
sizeof (GimpLayerMaskClass),
(GtkClassInitFunc) gimp_layer_mask_class_init,
(GtkObjectInitFunc) gimp_layer_mask_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......
......@@ -1259,7 +1259,7 @@ gdisplays_update_area (GimpImage* gimage,
{
GDisplay *gdisp;
GSList *list = display_list;
int x1, y1, x2, y2;
/* int x1, y1, x2, y2; */
/* int count = 0; */
/* traverse the linked list of displays */
......
......@@ -1259,7 +1259,7 @@ gdisplays_update_area (GimpImage* gimage,
{
GDisplay *gdisp;
GSList *list = display_list;
int x1, y1, x2, y2;
/* int x1, y1, x2, y2; */
/* int count = 0; */
/* traverse the linked list of displays */
......
......@@ -1259,7 +1259,7 @@ gdisplays_update_area (GimpImage* gimage,
{
GDisplay *gdisp;
GSList *list = display_list;
int x1, y1, x2, y2;
/* int x1, y1, x2, y2; */
/* int count = 0; */
/* traverse the linked list of displays */
......
......@@ -62,8 +62,8 @@ gimp_channel_get_type ()
sizeof (GimpChannelClass),
(GtkClassInitFunc) gimp_channel_class_init,
(GtkObjectInitFunc) gimp_channel_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......
......@@ -68,8 +68,8 @@ gimp_layer_get_type ()
sizeof (GimpLayerClass),
(GtkClassInitFunc) gimp_layer_class_init,
(GtkObjectInitFunc) gimp_layer_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......@@ -117,8 +117,8 @@ gimp_layer_mask_get_type ()
sizeof (GimpLayerMaskClass),
(GtkClassInitFunc) gimp_layer_mask_class_init,
(GtkObjectInitFunc) gimp_layer_mask_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......
......@@ -1362,8 +1362,6 @@ parse_menu_path (gpointer val1p,
goto error;
token = get_next_token ();
// FIXME menus_add_path (menu_path, accelerator);
return OK;
error:
......
......@@ -68,8 +68,8 @@ gimp_layer_get_type ()
sizeof (GimpLayerClass),
(GtkClassInitFunc) gimp_layer_class_init,
(GtkObjectInitFunc) gimp_layer_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......@@ -117,8 +117,8 @@ gimp_layer_mask_get_type ()
sizeof (GimpLayerMaskClass),
(GtkClassInitFunc) gimp_layer_mask_class_init,
(GtkObjectInitFunc) gimp_layer_mask_init,
/* reversed_1 */ NULL,
/* reversed_2 */ NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
......
......@@ -83,6 +83,7 @@ static long swap_file_grow = 16 * TILE_WIDTH * TILE_HEIGHT * 4;
static pthread_mutex_t swapfile_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
static gboolean seek_err_msg = TRUE, read_err_msg = TRUE, write_err_msg = TRUE;
static void
tile_swap_print_gaps (DefSwapFile *def_swap_file)
......@@ -110,7 +111,7 @@ tile_swap_exit1 (gpointer key,
DefSwapFile *def_swap_file;
if (tile_ref_count != 0)
g_print ("tile ref count balance: %d\n", tile_ref_count);
g_message ("tile ref count balance: %d\n", tile_ref_count);
swap_file = value;
if (swap_file->swap_func == tile_swap_default)
......@@ -118,7 +119,7 @@ tile_swap_exit1 (gpointer key,
def_swap_file = swap_file->user_data;
if (def_swap_file->swap_file_end != 0)
{
g_print ("swap file not empty: \"%s\"\n", swap_file->filename);
g_message ("swap file not empty: \"%s\"\n", swap_file->filename);
tile_swap_print_gaps (def_swap_file);
}
......@@ -381,7 +382,9 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
offset = lseek (fd, tile->swap_offset, SEEK_SET);
if (offset == -1)
{
g_message ("unable to seek to tile location on disk: %d", err);
if (seek_err_msg)
g_message ("unable to seek to tile location on disk: %d", err);
seek_err_msg = FALSE;
return;
}
}
......@@ -398,7 +401,9 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
if (err <= 0)
{
g_message ("unable to read tile data from disk: %d/%d ( %d ) bytes read", err, errno, nleft);
if (read_err_msg)
g_message ("unable to read tile data from disk: %d/%d ( %d ) bytes read", err, errno, nleft);
read_err_msg = FALSE;
return;
}
......@@ -409,6 +414,8 @@ tile_swap_default_in (DefSwapFile *def_swap_file,
/* Do not delete the swap from the file */
/* tile_swap_default_delete (def_swap_file, fd, tile); */
read_err_msg = seek_err_msg = TRUE;
}
static void
......@@ -436,7 +443,9 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
offset = lseek (fd, tile->swap_offset, SEEK_SET);
if (offset == -1)
{
g_message ("unable to seek to tile location on disk: %d", errno);
if (seek_err_msg)
g_message ("unable to seek to tile location on disk: %d", errno);
seek_err_msg = FALSE;
return;
}
}
......@@ -447,7 +456,9 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
err = write (fd, tile->data + rbytes - nleft, nleft);
if (err <= 0)
{
g_message ("unable to write tile data to disk: %d ( %d ) bytes written", err, nleft);
if (write_err_msg)
g_message ("unable to write tile data to disk: %d ( %d ) bytes written", err, nleft);
write_err_msg = FALSE;
return;
}
......@@ -459,6 +470,8 @@ tile_swap_default_out (DefSwapFile *def_swap_file,
/* g_free (tile->data);
tile->data = NULL; */
tile->dirty = FALSE;
write_err_msg = seek_err_msg = TRUE;
}
static void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment