added a utility function to reduce code duplication.
2004-11-17 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/script-fu-interface.c: added a utility function to reduce code duplication.
This commit is contained in:

committed by
Sven Neumann

parent
6580cc4c4a
commit
235bb4082a
@ -629,6 +629,16 @@ script_fu_combo_callback (GtkWidget *widget,
|
||||
option->history = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_string_update (gchar **dest,
|
||||
const gchar *src)
|
||||
{
|
||||
if (*dest)
|
||||
g_free (*dest);
|
||||
|
||||
*dest = g_strdup (src);
|
||||
}
|
||||
|
||||
static void
|
||||
script_fu_pattern_callback (const gchar *name,
|
||||
gint width,
|
||||
@ -638,10 +648,7 @@ script_fu_pattern_callback (const gchar *name,
|
||||
gboolean closing,
|
||||
gpointer data)
|
||||
{
|
||||
gchar **pname = data;
|
||||
|
||||
g_free (*pname);
|
||||
*pname = g_strdup (name);
|
||||
script_fu_string_update (data, name);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -651,10 +658,7 @@ script_fu_gradient_callback (const gchar *name,
|
||||
gboolean closing,
|
||||
gpointer data)
|
||||
{
|
||||
gchar **gname = data;
|
||||
|
||||
g_free (*gname);
|
||||
*gname = g_strdup (name);
|
||||
script_fu_string_update (data, name);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -662,10 +666,7 @@ script_fu_font_callback (const gchar *name,
|
||||
gboolean closing,
|
||||
gpointer data)
|
||||
{
|
||||
gchar **fname = data;
|
||||
|
||||
g_free (*fname);
|
||||
*fname = g_strdup (name);
|
||||
script_fu_string_update (data, name);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -673,10 +674,7 @@ script_fu_palette_callback (const gchar *name,
|
||||
gboolean closing,
|
||||
gpointer data)
|
||||
{
|
||||
gchar **fname = data;
|
||||
|
||||
g_free (*fname);
|
||||
*fname = g_strdup (name);
|
||||
script_fu_string_update (data, name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user