Commit 662559ee authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

don't include "libgimp/stdplugins-intl.h".

2004-09-30  Michael Natterer  <mitch@gimp.org>

	* plug-ins/dbbrowser/gimpprocbox.c: don't include
	"libgimp/stdplugins-intl.h".

	* plug-ins/dbbrowser/gimpprocbrowser.c
	* plug-ins/dbbrowser/plugin-browser.c: use gimp_destroy_paramdefs()
	so we don't leak all param names and descriptions.

	* plug-ins/dbbrowser/gimpprocview.c: don't show empty rows or
	redundant information (help == blurb for deprecated procedures).
parent 9ba57069
2004-09-30 Michael Natterer <mitch@gimp.org>
* plug-ins/dbbrowser/gimpprocbox.c: don't include
"libgimp/stdplugins-intl.h".
* plug-ins/dbbrowser/gimpprocbrowser.c
* plug-ins/dbbrowser/plugin-browser.c: use gimp_destroy_paramdefs()
so we don't leak all param names and descriptions.
* plug-ins/dbbrowser/gimpprocview.c: don't show empty rows or
redundant information (help == blurb for deprecated procedures).
2004-09-30 Michael Natterer <mitch@gimp.org>
* plug-ins/dbbrowser/Makefile.am
......
......@@ -308,8 +308,9 @@ browser_show_procedure (GimpDBBrowser *browser,
g_free (browser->proc_author);
g_free (browser->proc_copyright);
g_free (browser->proc_date);
g_free (browser->params);
g_free (browser->return_vals);
gimp_destroy_paramdefs (browser->params, browser->n_params);
gimp_destroy_paramdefs (browser->return_vals, browser->n_return_vals);
gimp_procedural_db_proc_info (proc_name,
&browser->proc_blurb,
......
......@@ -72,6 +72,16 @@ gimp_proc_view_new (const gchar *name,
GtkSizeGroup *name_group;
GtkSizeGroup *type_group;
GtkSizeGroup *desc_group;
gint row;
if (blurb && strlen (blurb) < 2) blurb = NULL;
if (help && strlen (help) < 2) help = NULL;
if (author && strlen (author) < 2) author = NULL;
if (date && strlen (date) < 2) date = NULL;
if (copyright && strlen (copyright) < 2) copyright = NULL;
if (blurb && help && ! strcmp (blurb, help))
help = NULL;
main_vbox = gtk_vbox_new (FALSE, 12);
......@@ -95,7 +105,7 @@ gimp_proc_view_new (const gchar *name,
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
if (menu_path && strlen (menu_path) > 1)
if (menu_path)
{
label = gtk_label_new_with_mnemonic (menu_path);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
......@@ -104,7 +114,7 @@ gimp_proc_view_new (const gchar *name,
gtk_widget_show (label);
}
if (blurb && strlen (blurb) > 1)
if (blurb)
{
label = gtk_label_new (blurb);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
......@@ -143,6 +153,9 @@ gimp_proc_view_new (const gchar *name,
gtk_widget_show (table);
}
if (! help && ! author && ! date && ! copyright)
return main_vbox;
frame = gimp_frame_new (_("Additional Information"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
......@@ -152,7 +165,7 @@ gimp_proc_view_new (const gchar *name,
gtk_widget_show (vbox);
/* show the help */
if (help && strlen (help) > 1)
if (help)
{
label = gtk_label_new (help);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
......@@ -163,35 +176,50 @@ gimp_proc_view_new (const gchar *name,
/* show the author & the copyright */
table = gtk_table_new (3, 2, FALSE);
if (! author && ! date && ! copyright)
return main_vbox;
table = gtk_table_new ((author != 0) + (date != 0) + (copyright != 0), 2,
FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
label = gtk_label_new (author);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
row = 0;
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Author:"), 0.0, 0.0,
label, 3, FALSE);
if (author)
{
label = gtk_label_new (author);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
label = gtk_label_new (date);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Author:"), 0.0, 0.0,
label, 3, FALSE);
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Date:"), 0.0, 0.0,
label, 3, FALSE);
if (date)
{
label = gtk_label_new (date);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
label = gtk_label_new (copyright);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Date:"), 0.0, 0.0,
label, 3, FALSE);
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Copyright:"), 0.0, 0.0,
label, 3, FALSE);
if (copyright)
{
label = gtk_label_new (copyright);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Copyright:"), 0.0, 0.0,
label, 3, FALSE);
}
return main_vbox;
}
......@@ -229,7 +257,8 @@ gimp_proc_view_create_params (GimpParamDef *params,
type = GParamType_to_string (params[i].type);
label = gtk_label_new (type);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
PANGO_ATTR_FAMILY, "monospace",
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_size_group_add_widget (type_group, label);
......@@ -243,7 +272,7 @@ gimp_proc_view_create_params (GimpParamDef *params,
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_size_group_add_widget (desc_group, label);
gtk_table_attach (GTK_TABLE (table), label,
2, 3, i, i + 1, GTK_FILL, GTK_FILL, 0, 0);
2, 3, i, i + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
}
......
......@@ -897,60 +897,52 @@ static void
browser_show_plugin (PluginBrowser *browser,
PInfo *pinfo)
{
gchar *selected_proc_blurb;
gchar *selected_proc_help;
gchar *selected_proc_author;
gchar *selected_proc_copyright;
gchar *selected_proc_date;
GimpPDBProcType selected_proc_type;
gint selected_nparams;
gint selected_nreturn_vals;
GimpParamDef *selected_params;
GimpParamDef *selected_return_vals;
gchar *blurb = NULL;
gchar *help = NULL;
gchar *author = NULL;
gchar *copyright = NULL;
gchar *date = NULL;
GimpPDBProcType type = 0;
gint n_params = 0;
gint n_return_vals = 0;
GimpParamDef *params = NULL;
GimpParamDef *return_vals = NULL;
g_return_if_fail (browser != NULL);
g_return_if_fail (pinfo != NULL);
selected_proc_blurb = NULL;
selected_proc_help = NULL;
selected_proc_author = NULL;
selected_proc_copyright = NULL;
selected_proc_date = NULL;
selected_proc_type = 0;
selected_nparams = 0;
selected_nreturn_vals = 0;
selected_params = NULL;
selected_return_vals = NULL;
gimp_procedural_db_proc_info (pinfo->realname,
&selected_proc_blurb,
&selected_proc_help,
&selected_proc_author,
&selected_proc_copyright,
&selected_proc_date,
&selected_proc_type,
&selected_nparams, &selected_nreturn_vals,
&selected_params, &selected_return_vals);
&blurb,
&help,
&author,
&copyright,
&date,
&type,
&n_params,
&n_return_vals,
&params,
&return_vals);
gimp_proc_box_set_widget (browser->proc_box,
gimp_proc_view_new (pinfo->realname,
pinfo->menu,
selected_proc_blurb,
selected_proc_help,
selected_proc_author,
selected_proc_copyright,
selected_proc_date,
selected_proc_type,
selected_nparams,
selected_nreturn_vals,
selected_params,
selected_return_vals));
g_free (selected_proc_blurb);
g_free (selected_proc_help);
g_free (selected_proc_author);
g_free (selected_proc_copyright);
g_free (selected_proc_date);
g_free (selected_params);
g_free (selected_return_vals);
blurb,
help,
author,
copyright,
date,
type,
n_params,
n_return_vals,
params,
return_vals));
g_free (blurb);
g_free (help);
g_free (author);
g_free (copyright);
g_free (date);
gimp_destroy_paramdefs (params, n_params);
gimp_destroy_paramdefs (return_vals, n_return_vals);
}
......@@ -24,8 +24,6 @@
#include "gimpprocbox.h"
#include "libgimp/stdplugins-intl.h"
/* public functions */
......
......@@ -308,8 +308,9 @@ browser_show_procedure (GimpDBBrowser *browser,
g_free (browser->proc_author);
g_free (browser->proc_copyright);
g_free (browser->proc_date);
g_free (browser->params);
g_free (browser->return_vals);
gimp_destroy_paramdefs (browser->params, browser->n_params);
gimp_destroy_paramdefs (browser->return_vals, browser->n_return_vals);
gimp_procedural_db_proc_info (proc_name,
&browser->proc_blurb,
......
......@@ -72,6 +72,16 @@ gimp_proc_view_new (const gchar *name,
GtkSizeGroup *name_group;
GtkSizeGroup *type_group;
GtkSizeGroup *desc_group;
gint row;
if (blurb && strlen (blurb) < 2) blurb = NULL;
if (help && strlen (help) < 2) help = NULL;
if (author && strlen (author) < 2) author = NULL;
if (date && strlen (date) < 2) date = NULL;
if (copyright && strlen (copyright) < 2) copyright = NULL;
if (blurb && help && ! strcmp (blurb, help))
help = NULL;
main_vbox = gtk_vbox_new (FALSE, 12);
......@@ -95,7 +105,7 @@ gimp_proc_view_new (const gchar *name,
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
if (menu_path && strlen (menu_path) > 1)
if (menu_path)
{
label = gtk_label_new_with_mnemonic (menu_path);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
......@@ -104,7 +114,7 @@ gimp_proc_view_new (const gchar *name,
gtk_widget_show (label);
}
if (blurb && strlen (blurb) > 1)
if (blurb)
{
label = gtk_label_new (blurb);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
......@@ -143,6 +153,9 @@ gimp_proc_view_new (const gchar *name,
gtk_widget_show (table);
}
if (! help && ! author && ! date && ! copyright)
return main_vbox;
frame = gimp_frame_new (_("Additional Information"));
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
......@@ -152,7 +165,7 @@ gimp_proc_view_new (const gchar *name,
gtk_widget_show (vbox);
/* show the help */
if (help && strlen (help) > 1)
if (help)
{
label = gtk_label_new (help);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
......@@ -163,35 +176,50 @@ gimp_proc_view_new (const gchar *name,
/* show the author & the copyright */
table = gtk_table_new (3, 2, FALSE);
if (! author && ! date && ! copyright)
return main_vbox;
table = gtk_table_new ((author != 0) + (date != 0) + (copyright != 0), 2,
FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
label = gtk_label_new (author);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
row = 0;
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Author:"), 0.0, 0.0,
label, 3, FALSE);
if (author)
{
label = gtk_label_new (author);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
label = gtk_label_new (date);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Author:"), 0.0, 0.0,
label, 3, FALSE);
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Date:"), 0.0, 0.0,
label, 3, FALSE);
if (date)
{
label = gtk_label_new (date);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
label = gtk_label_new (copyright);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Date:"), 0.0, 0.0,
label, 3, FALSE);
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Copyright:"), 0.0, 0.0,
label, 3, FALSE);
if (copyright)
{
label = gtk_label_new (copyright);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Copyright:"), 0.0, 0.0,
label, 3, FALSE);
}
return main_vbox;
}
......@@ -229,7 +257,8 @@ gimp_proc_view_create_params (GimpParamDef *params,
type = GParamType_to_string (params[i].type);
label = gtk_label_new (type);
gimp_label_set_attributes (GTK_LABEL (label),
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
PANGO_ATTR_FAMILY, "monospace",
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
-1);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
gtk_size_group_add_widget (type_group, label);
......@@ -243,7 +272,7 @@ gimp_proc_view_create_params (GimpParamDef *params,
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_size_group_add_widget (desc_group, label);
gtk_table_attach (GTK_TABLE (table), label,
2, 3, i, i + 1, GTK_FILL, GTK_FILL, 0, 0);
2, 3, i, i + 1, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (label);
}
......
......@@ -897,60 +897,52 @@ static void
browser_show_plugin (PluginBrowser *browser,
PInfo *pinfo)
{
gchar *selected_proc_blurb;
gchar *selected_proc_help;
gchar *selected_proc_author;
gchar *selected_proc_copyright;
gchar *selected_proc_date;
GimpPDBProcType selected_proc_type;
gint selected_nparams;
gint selected_nreturn_vals;
GimpParamDef *selected_params;
GimpParamDef *selected_return_vals;
gchar *blurb = NULL;
gchar *help = NULL;
gchar *author = NULL;
gchar *copyright = NULL;
gchar *date = NULL;
GimpPDBProcType type = 0;
gint n_params = 0;
gint n_return_vals = 0;
GimpParamDef *params = NULL;
GimpParamDef *return_vals = NULL;
g_return_if_fail (browser != NULL);
g_return_if_fail (pinfo != NULL);
selected_proc_blurb = NULL;
selected_proc_help = NULL;
selected_proc_author = NULL;
selected_proc_copyright = NULL;
selected_proc_date = NULL;
selected_proc_type = 0;
selected_nparams = 0;
selected_nreturn_vals = 0;
selected_params = NULL;
selected_return_vals = NULL;
gimp_procedural_db_proc_info (pinfo->realname,
&selected_proc_blurb,
&selected_proc_help,
&selected_proc_author,
&selected_proc_copyright,
&selected_proc_date,
&selected_proc_type,
&selected_nparams, &selected_nreturn_vals,
&selected_params, &selected_return_vals);
&blurb,
&help,
&author,
&copyright,
&date,
&type,
&n_params,
&n_return_vals,
&params,
&return_vals);
gimp_proc_box_set_widget (browser->proc_box,
gimp_proc_view_new (pinfo->realname,
pinfo->menu,
selected_proc_blurb,
selected_proc_help,
selected_proc_author,
selected_proc_copyright,
selected_proc_date,
selected_proc_type,
selected_nparams,
selected_nreturn_vals,
selected_params,
selected_return_vals));
g_free (selected_proc_blurb);
g_free (selected_proc_help);
g_free (selected_proc_author);
g_free (selected_proc_copyright);
g_free (selected_proc_date);
g_free (selected_params);
g_free (selected_return_vals);
blurb,
help,
author,
copyright,
date,
type,
n_params,
n_return_vals,
params,
return_vals));
g_free (blurb);
g_free (help);
g_free (author);
g_free (copyright);
g_free (date);
gimp_destroy_paramdefs (params, n_params);
gimp_destroy_paramdefs (return_vals, n_return_vals);
}
Markdown is supported
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