mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +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>
|
2004-07-19 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||||
|
|
||||||
* plug-ins/Lighting/lighting_ui.c: added ability to save and load
|
* plug-ins/Lighting/lighting_ui.c: added ability to save and load
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
#include <glib/gprintf.h>
|
|
||||||
|
|
||||||
#include "lighting_ui.h"
|
#include "lighting_ui.h"
|
||||||
#include "lighting_main.h"
|
#include "lighting_main.h"
|
||||||
|
@ -342,9 +344,10 @@ create_light_page (void)
|
||||||
|
|
||||||
for (k = 0; k < NUM_LIGHTS; k++)
|
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);
|
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);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
light_type_combo[k] = gimp_int_combo_box_new (_("None"), NO_LIGHT,
|
light_type_combo[k] = gimp_int_combo_box_new (_("None"), NO_LIGHT,
|
||||||
|
@ -1056,9 +1059,8 @@ save_lighting_preset (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const gchar *tmp = g_get_tmp_dir ();
|
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window),
|
||||||
|
g_get_tmp_dir ());
|
||||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window), tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1082,13 +1084,15 @@ file_chooser_response (GtkFileChooser *chooser,
|
||||||
|
|
||||||
if (response_id == GTK_RESPONSE_OK)
|
if (response_id == GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
gchar *filename;
|
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
||||||
|
|
||||||
filename = gtk_file_chooser_get_filename (chooser);
|
|
||||||
|
|
||||||
fp = fopen (filename, "w");
|
fp = fopen (filename, "w");
|
||||||
|
|
||||||
if (!fp)
|
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
|
else
|
||||||
{
|
{
|
||||||
for (k = 0; k < NUM_LIGHTS; k++)
|
for (k = 0; k < NUM_LIGHTS; k++)
|
||||||
|
@ -1114,7 +1118,8 @@ file_chooser_response (GtkFileChooser *chooser,
|
||||||
fprintf (fp, "Type: Spot\n");
|
fprintf (fp, "Type: Spot\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_message ("Unknown light type: %d", mapvals.lightsource[k].type);
|
g_warning ("Unknown light type: %d",
|
||||||
|
mapvals.lightsource[k].type);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1190,9 +1195,8 @@ load_lighting_preset (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const gchar *tmp = g_get_tmp_dir ();
|
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window),
|
||||||
|
g_get_tmp_dir ());
|
||||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (window), tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1218,13 +1222,15 @@ load_file_chooser_response (GtkFileChooser *chooser,
|
||||||
|
|
||||||
if (response_id == GTK_RESPONSE_OK)
|
if (response_id == GTK_RESPONSE_OK)
|
||||||
{
|
{
|
||||||
gchar *filename;
|
gchar *filename = gtk_file_chooser_get_filename (chooser);
|
||||||
|
|
||||||
filename = gtk_file_chooser_get_filename (chooser);
|
|
||||||
|
|
||||||
fp = fopen (filename, "r");
|
fp = fopen (filename, "r");
|
||||||
|
|
||||||
if (!fp)
|
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
|
else
|
||||||
{
|
{
|
||||||
fscanf (fp, "Number of lights: %d", &num_lights);
|
fscanf (fp, "Number of lights: %d", &num_lights);
|
||||||
|
@ -1243,7 +1249,7 @@ load_file_chooser_response (GtkFileChooser *chooser,
|
||||||
source->type = SPOT_LIGHT;
|
source->type = SPOT_LIGHT;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_message ("Unknown light type: %s", type_label);
|
g_warning ("Unknown light type: %s", type_label);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue