mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 01:43:24 +00:00
fixed a couple of issues with the new code: don't include individual glib
2004-07-19 Sven Neumann <sven@gimp.org> * plug-ins/Lighting/lighting_ui.c: fixed a couple of issues with the new code: don't include individual glib headers, never ever use sprintf(), mark user-visible strings for translations, use default messages, removed trailing whitespace.
This commit is contained in:
parent
5bd5413825
commit
95ca2a8dd0
2 changed files with 40 additions and 27 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-07-19 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/Lighting/lighting_ui.c: fixed a couple of issues with
|
||||
the new code: don't include individual glib headers, never ever
|
||||
use sprintf(), mark user-visible strings for translations, use
|
||||
default messages, removed trailing whitespace.
|
||||
|
||||
2004-07-19 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* plug-ins/Lighting/lighting_ui.c: added ability to save and load
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
#include "lighting_ui.h"
|
||||
#include "lighting_main.h"
|
||||
|
@ -342,9 +344,10 @@ create_light_page (void)
|
|||
|
||||
for (k = 0; k < NUM_LIGHTS; k++)
|
||||
{
|
||||
g_sprintf (label_text, "Light %d", k + 1);
|
||||
g_snprintf (label_text, sizeof (label_text), "Light %d", k + 1);
|
||||
label = gtk_label_new (label_text);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label, 2*k + 1, 2*k + 2, 0, 1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table),
|
||||
label, 2*k + 1, 2*k + 2, 0, 1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
light_type_combo[k] = gimp_int_combo_box_new (_("None"), NO_LIGHT,
|
||||
|
@ -1056,9 +1059,8 @@ save_lighting_preset (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
const gchar *tmp = g_get_tmp_dir ();
|
||||
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window), tmp);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window),
|
||||
g_get_tmp_dir ());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1082,13 +1084,15 @@ file_chooser_response (GtkFileChooser *chooser,
|
|||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = gtk_file_chooser_get_filename (chooser);
|
||||
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
||||
|
||||
fp = fopen (filename, "w");
|
||||
|
||||
if (!fp)
|
||||
g_message ("Cannot open file '%s' for saving", filename);
|
||||
{
|
||||
g_message (_("Could not open '%s' for writing: %s"),
|
||||
filename, g_strerror (errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (k = 0; k < NUM_LIGHTS; k++)
|
||||
|
@ -1114,7 +1118,8 @@ file_chooser_response (GtkFileChooser *chooser,
|
|||
fprintf (fp, "Type: Spot\n");
|
||||
break;
|
||||
default:
|
||||
g_message ("Unknown light type: %d", mapvals.lightsource[k].type);
|
||||
g_warning ("Unknown light type: %d",
|
||||
mapvals.lightsource[k].type);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1190,9 +1195,8 @@ load_lighting_preset (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
const gchar *tmp = g_get_tmp_dir ();
|
||||
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window), tmp);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window),
|
||||
g_get_tmp_dir ());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1218,13 +1222,15 @@ load_file_chooser_response (GtkFileChooser *chooser,
|
|||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = gtk_file_chooser_get_filename (chooser);
|
||||
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
||||
|
||||
fp = fopen (filename, "r");
|
||||
|
||||
if (!fp)
|
||||
g_message ("Cannot open file '%s' for reading", filename);
|
||||
{
|
||||
g_message (_("Could not open '%s' for reading: %s"),
|
||||
filename, g_strerror (errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
fscanf (fp, "Number of lights: %d", &num_lights);
|
||||
|
@ -1243,7 +1249,7 @@ load_file_chooser_response (GtkFileChooser *chooser,
|
|||
source->type = SPOT_LIGHT;
|
||||
else
|
||||
{
|
||||
g_message ("Unknown light type: %s", type_label);
|
||||
g_warning ("Unknown light type: %s", type_label);
|
||||
fclose (fp);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue