mirror of https://github.com/GNOME/gimp.git
app/config/test-config.c use g_error_free() so we crash if our GimpConfig
2002-05-28 Sven Neumann <sven@gimp.org> * app/config/test-config.c * app/gui/test-commands.c: use g_error_free() so we crash if our GimpConfig functions return FALSE and don't set an error. * app/widgets/gimpdevices.c: don't warn if devicerc was not found. * app/gui/preferences-dialog.c: use G_MAXULONG as upper limit for the mem_size entries. * libgimpwidgets/gimpwidgets.c (gimp_mem_size_entry): use gulong and set the range of the spinbutton's adjustment properly.
This commit is contained in:
parent
17c02510ef
commit
89585b4c14
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2002-05-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/config/test-config.c
|
||||
* app/gui/test-commands.c: use g_error_free() so we crash if our
|
||||
GimpConfig functions return FALSE and don't set an error.
|
||||
|
||||
* app/widgets/gimpdevices.c: don't warn if devicerc was not found.
|
||||
|
||||
* app/gui/preferences-dialog.c: use G_MAXULONG as upper limit for
|
||||
the mem_size entries.
|
||||
|
||||
* libgimpwidgets/gimpwidgets.c (gimp_mem_size_entry): use gulong
|
||||
and set the range of the spinbutton's adjustment properly.
|
||||
|
||||
2002-05-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/config/gimpconfig-types.c: derive GIMP_TYPE_MEMSIZE from
|
||||
|
|
|
@ -416,7 +416,7 @@ gimp_config_scanner_message (GScanner *scanner,
|
|||
|
||||
g_set_error (error,
|
||||
GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("Error while parsing '%s' in line %d:\n %s"),
|
||||
_("Error while parsing '%s' in line %d:\n%s"),
|
||||
scanner->input_name, scanner->line, message);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ main (int argc,
|
|||
"gimpconfig.c", NULL, &error))
|
||||
{
|
||||
g_print (" OK, failed. The error was:\n %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1975,7 +1975,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
/* The maximum size of a new image */
|
||||
adjustment = gtk_adjustment_new (gimprc.max_new_image_size,
|
||||
0, (4069.0 * 1024 * 1024 - 1),
|
||||
0, G_MAXULONG,
|
||||
1.0, 1.0, 0.0);
|
||||
hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment));
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
|
@ -2632,7 +2632,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
/* The tile cache size */
|
||||
adjustment = gtk_adjustment_new (edit_tile_cache_size,
|
||||
0, (4069.0 * 1024 * 1024 - 1),
|
||||
0, G_MAXULONG,
|
||||
1.0, 1.0, 0.0);
|
||||
hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment));
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
|
|
|
@ -1975,7 +1975,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
/* The maximum size of a new image */
|
||||
adjustment = gtk_adjustment_new (gimprc.max_new_image_size,
|
||||
0, (4069.0 * 1024 * 1024 - 1),
|
||||
0, G_MAXULONG,
|
||||
1.0, 1.0, 0.0);
|
||||
hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment));
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
|
@ -2632,7 +2632,7 @@ preferences_dialog_create (Gimp *gimp)
|
|||
|
||||
/* The tile cache size */
|
||||
adjustment = gtk_adjustment_new (edit_tile_cache_size,
|
||||
0, (4069.0 * 1024 * 1024 - 1),
|
||||
0, G_MAXULONG,
|
||||
1.0, 1.0, 0.0);
|
||||
hbox = gimp_mem_size_entry_new (GTK_ADJUSTMENT (adjustment));
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
|
|
|
@ -311,7 +311,7 @@ test_serialize_context_cmd_callback (GtkWidget *widget,
|
|||
&error))
|
||||
{
|
||||
g_message ("Serializing Context failed:\n%s", error->message);
|
||||
g_clear_error (&error);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
|
@ -335,7 +335,7 @@ test_deserialize_context_cmd_callback (GtkWidget *widget,
|
|||
&error))
|
||||
{
|
||||
g_message ("Deserializing Context failed:\n%s", error->message);
|
||||
g_clear_error (&error);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
|
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
@ -92,10 +88,9 @@ gimp_devices_init (Gimp *gimp,
|
|||
{
|
||||
device = (GdkDevice *) list->data;
|
||||
|
||||
g_print ("############# adding %s\n", device->name);
|
||||
|
||||
device_info = gimp_device_info_new (gimp, device->name);
|
||||
gimp_container_add (manager->device_info_list, GIMP_OBJECT (device_info));
|
||||
gimp_container_add (manager->device_info_list,
|
||||
GIMP_OBJECT (device_info));
|
||||
g_object_unref (G_OBJECT (device_info));
|
||||
|
||||
gimp_device_info_set_from_device (device_info, device);
|
||||
|
@ -139,9 +134,10 @@ gimp_devices_restore (Gimp *gimp)
|
|||
gimp,
|
||||
&error))
|
||||
{
|
||||
g_message ("Could not read devicerc: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
g_message (error->message);
|
||||
|
||||
g_error_free (error);
|
||||
/* don't bail out here */
|
||||
}
|
||||
|
||||
|
@ -183,8 +179,8 @@ gimp_devices_save (Gimp *gimp)
|
|||
NULL,
|
||||
&error))
|
||||
{
|
||||
g_message ("Could not write devicerc: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
g_message (error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
|
|
|
@ -416,7 +416,7 @@ gimp_config_scanner_message (GScanner *scanner,
|
|||
|
||||
g_set_error (error,
|
||||
GIMP_CONFIG_ERROR, GIMP_CONFIG_ERROR_PARSE,
|
||||
_("Error while parsing '%s' in line %d:\n %s"),
|
||||
_("Error while parsing '%s' in line %d:\n%s"),
|
||||
scanner->input_name, scanner->line, message);
|
||||
}
|
||||
|
||||
|
|
|
@ -1095,10 +1095,10 @@ gimp_mem_size_entry_callback (GtkAdjustment *adj,
|
|||
gpointer data)
|
||||
{
|
||||
GimpMemSizeEntryData *gmsed;
|
||||
guint new_value;
|
||||
gulong new_value;
|
||||
|
||||
gmsed = (GimpMemSizeEntryData *)data;
|
||||
new_value = adj->value * gmsed->mem_size_unit;
|
||||
new_value = (gulong) adj->value * gmsed->mem_size_unit;
|
||||
|
||||
gtk_adjustment_set_value (gmsed->adjustment, new_value);
|
||||
}
|
||||
|
@ -1108,7 +1108,7 @@ gimp_mem_size_unit_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
GimpMemSizeEntryData *gmsed;
|
||||
guint divided_mem_size;
|
||||
gulong divided_mem_size;
|
||||
guint new_unit;
|
||||
|
||||
gmsed = (GimpMemSizeEntryData *)data;
|
||||
|
@ -1118,9 +1118,16 @@ gimp_mem_size_unit_callback (GtkWidget *widget,
|
|||
|
||||
if (new_unit && new_unit != gmsed->mem_size_unit)
|
||||
{
|
||||
divided_mem_size = gmsed->adjustment->value / new_unit;
|
||||
GtkAdjustment *div_adj = GTK_ADJUSTMENT (gmsed->divided_adj);
|
||||
|
||||
divided_mem_size = (gulong) gmsed->adjustment->value / new_unit;
|
||||
gmsed->mem_size_unit = new_unit;
|
||||
|
||||
div_adj->lower = gmsed->adjustment->lower / new_unit;
|
||||
div_adj->upper = gmsed->adjustment->upper / new_unit;
|
||||
|
||||
gtk_adjustment_changed (div_adj);
|
||||
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (gmsed->divided_adj),
|
||||
divided_mem_size);
|
||||
}
|
||||
|
@ -1141,25 +1148,31 @@ gimp_mem_size_entry_new (GtkAdjustment *adjustment)
|
|||
GtkWidget *optionmenu;
|
||||
|
||||
GimpMemSizeEntryData *gmsed;
|
||||
guint mem_size_unit = 1;
|
||||
guint divided_mem_size;
|
||||
gint i;
|
||||
gulong mem_size_unit;
|
||||
gulong divided_mem_size;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL);
|
||||
g_return_val_if_fail (adjustment->lower >= 0, NULL);
|
||||
g_return_val_if_fail (adjustment->value >= 0, NULL);
|
||||
|
||||
gmsed = g_new (GimpMemSizeEntryData, 1);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
for (i = 0, mem_size_unit = 1; i < 2; i++)
|
||||
{
|
||||
if ( (gint) adjustment->value % (mem_size_unit * 1024) != 0 )
|
||||
if ( (gulong) adjustment->value % (mem_size_unit << 10) != 0 )
|
||||
break;
|
||||
mem_size_unit *= 1024;
|
||||
mem_size_unit <<= 10;
|
||||
}
|
||||
divided_mem_size = adjustment->value / mem_size_unit;
|
||||
|
||||
divided_mem_size = (gulong) adjustment->value / mem_size_unit;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
spinbutton =
|
||||
gimp_spin_button_new (÷d_adj, divided_mem_size,
|
||||
0.0, (4096.0 * 1024 * 1024 - 1), 1.0, 16.0, 0.0,
|
||||
1.0, 0.0);
|
||||
adjustment->lower / mem_size_unit,
|
||||
adjustment->upper / mem_size_unit,
|
||||
1.0, 16.0, 0.0, 1.0, 0.0);
|
||||
g_signal_connect (G_OBJECT (divided_adj), "value_changed",
|
||||
G_CALLBACK (gimp_mem_size_entry_callback),
|
||||
gmsed);
|
||||
|
@ -1170,11 +1183,12 @@ gimp_mem_size_entry_new (GtkAdjustment *adjustment)
|
|||
gimp_option_menu_new2 (FALSE, G_CALLBACK (gimp_mem_size_unit_callback),
|
||||
gmsed, (gpointer) mem_size_unit,
|
||||
|
||||
_("Bytes"), (gpointer) 1, NULL,
|
||||
_("KiloBytes"), (gpointer) 1024, NULL,
|
||||
_("MegaBytes"), (gpointer) (1024 * 1024), NULL,
|
||||
_("Bytes"), GINT_TO_POINTER (1 << 0), NULL,
|
||||
_("KiloBytes"), GINT_TO_POINTER (1 << 10), NULL,
|
||||
_("MegaBytes"), GINT_TO_POINTER (1 << 20), NULL,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
|
||||
gtk_widget_show (optionmenu);
|
||||
|
||||
|
|
Loading…
Reference in New Issue