Commit 991a7e5b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/gui/file-new-dialog.c app/gui/offset-dialog.c

2002-09-07  Michael Natterer  <mitch@gimp.org>

	* app/gui/file-new-dialog.c
	* app/gui/offset-dialog.c
	* app/gui/preferences-dialog.c
	* app/gui/resolution-calibrate-dialog.c
	* app/gui/user-install-dialog.c: replaced some more pixel sizes by
	char sizes. Tweaked table spacings. Mnemonics.

	* app/gui/info-dialog.[ch]: internal cleanup.

	* app/gui/resize-dialog.[ch]: same here. Removed the "cancel_cb"
	from the API and simply destroy the dialog on "Cancel". Makes the
	dialog construction less weird.

	* app/gui/image-commands.c
	* app/gui/layers-commands.c: changed accordingly. Same cleanups
	as above.
parent b7afbfee
2002-09-07 Michael Natterer <mitch@gimp.org>
* app/gui/file-new-dialog.c
* app/gui/offset-dialog.c
* app/gui/preferences-dialog.c
* app/gui/resolution-calibrate-dialog.c
* app/gui/user-install-dialog.c: replaced some more pixel sizes by
char sizes. Tweaked table spacings. Mnemonics.
* app/gui/info-dialog.[ch]: internal cleanup.
* app/gui/resize-dialog.[ch]: same here. Removed the "cancel_cb"
from the API and simply destroy the dialog on "Cancel". Makes the
dialog construction less weird.
* app/gui/image-commands.c
* app/gui/layers-commands.c: changed accordingly. Same cleanups
as above.
2002-09-07 Michael Natterer <mitch@gimp.org>
* plug-ins/FractalExplorer/Dialogs.c
......
......@@ -127,20 +127,21 @@ image_resize_cmd_callback (GtkWidget *widget,
image_resize->gdisp = gdisp;
image_resize->gimage = gimage;
image_resize->resize = resize_widget_new (gimage,
ResizeWidget,
ResizeImage,
G_OBJECT (gdisp),
"disconnect",
gimage->width,
gimage->height,
gimage->xresolution,
gimage->yresolution,
gimage->unit,
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_CALLBACK (image_resize_callback),
NULL,
image_resize);
image_resize->resize =
resize_widget_new (gimage,
ResizeWidget,
ResizeImage,
G_OBJECT (gdisp),
"disconnect",
gimage->width,
gimage->height,
gimage->xresolution,
gimage->yresolution,
gimage->unit,
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_CALLBACK (image_resize_callback),
image_resize);
g_object_weak_ref (G_OBJECT (image_resize->resize->resize_shell),
(GWeakNotify) g_free,
......@@ -164,20 +165,21 @@ image_scale_cmd_callback (GtkWidget *widget,
image_scale->gdisp = gdisp;
image_scale->gimage = gimage;
image_scale->resize = resize_widget_new (gimage,
ScaleWidget,
ResizeImage,
G_OBJECT (gdisp),
"disconnect",
gimage->width,
gimage->height,
gimage->xresolution,
gimage->yresolution,
gimage->unit,
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_CALLBACK (image_scale_callback),
NULL,
image_scale);
image_scale->resize =
resize_widget_new (gimage,
ScaleWidget,
ResizeImage,
G_OBJECT (gdisp),
"disconnect",
gimage->width,
gimage->height,
gimage->xresolution,
gimage->yresolution,
gimage->unit,
GIMP_DISPLAY_SHELL (gdisp->shell)->dot_for_dot,
G_CALLBACK (image_scale_callback),
image_scale);
g_object_weak_ref (G_OBJECT (image_scale->resize->resize_shell),
(GWeakNotify) g_free,
......
......@@ -617,7 +617,7 @@ layers_new_layer_query (GimpImage *gimage,
options);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
vbox);
......@@ -628,19 +628,12 @@ layers_new_layer_query (GimpImage *gimage,
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
/* The name label and entry */
label = gtk_label_new (_("Layer Name:"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 1);
gtk_widget_show (label);
options->name_entry = gtk_entry_new ();
gtk_widget_set_size_request (options->name_entry, 75, -1);
gtk_table_attach_defaults (GTK_TABLE (table),
options->name_entry, 1, 2, 0, 1);
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
(layer_name ? layer_name : _("New Layer")));
gtk_widget_show (options->name_entry);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Layer _Name:"), 1.0, 0.5,
options->name_entry, 1, FALSE);
/* The size labels */
label = gtk_label_new (_("Layer Width:"));
......@@ -656,19 +649,23 @@ layers_new_layer_query (GimpImage *gimage,
gtk_widget_show (label);
/* The size sizeentry */
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 75, -1);
spinbutton = gimp_spin_button_new (&adjustment,
1, 1, 1, 1, 10, 1,
1, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 10);
options->size_se = gimp_size_entry_new (1, gimage->unit, "%a",
TRUE, TRUE, FALSE, 75,
TRUE, TRUE, FALSE, 10,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (options->size_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (options->size_se), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (options->size_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (options->size_se), spinbutton,
1, 2, 0, 1);
gtk_widget_show (spinbutton);
gtk_table_attach (GTK_TABLE (table), options->size_se, 1, 2, 1, 3,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (options->size_se);
......@@ -777,8 +774,7 @@ layers_edit_layer_query (GimpLayer *layer)
{
EditLayerOptions *options;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *table;
options = g_new0 (EditLayerOptions, 1);
......@@ -813,33 +809,30 @@ layers_edit_layer_query (GimpLayer *layer)
G_CONNECT_SWAPPED);
/* The main vbox */
vbox = gtk_vbox_new (FALSE, 2);
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (options->query_box)->vbox),
vbox);
/* The name hbox, label and entry */
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new (_("Layer name:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* The name label and entry */
table = gtk_table_new (1, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
options->name_entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (hbox), options->name_entry, TRUE, TRUE, 0);
gtk_entry_set_text (GTK_ENTRY (options->name_entry),
((gimp_layer_is_floating_sel (layer) ?
_("Floating Selection") :
gimp_object_get_name (GIMP_OBJECT (layer)))));
gtk_widget_show (options->name_entry);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("Layer _Name"), 1.0, 0.5,
options->name_entry, 1, FALSE);
g_signal_connect (G_OBJECT (options->name_entry), "activate",
G_CALLBACK (edit_layer_query_ok_callback),
options);
gtk_widget_show (hbox);
gtk_widget_show (vbox);
gtk_widget_show (options->query_box);
}
......@@ -1048,9 +1041,10 @@ layers_scale_layer_query (GimpImage *gimage,
{
ScaleLayerOptions *options;
/* the new options structure */
options = g_new (ScaleLayerOptions, 1);
options->layer = layer;
options = g_new0 (ScaleLayerOptions, 1);
options->layer = layer;
options->resize =
resize_widget_new (gimage,
ScaleWidget,
......@@ -1064,8 +1058,7 @@ layers_scale_layer_query (GimpImage *gimage,
gimage->unit,
TRUE,
G_CALLBACK (scale_layer_query_ok_callback),
NULL,
options);
options);
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
(GWeakNotify) g_free,
......@@ -1140,9 +1133,10 @@ layers_resize_layer_query (GimpImage *gimage,
{
ResizeLayerOptions *options;
/* the new options structure */
options = g_new (ResizeLayerOptions, 1);
options->layer = layer;
options = g_new0 (ResizeLayerOptions, 1);
options->layer = layer;
options->resize =
resize_widget_new (gimage,
ResizeWidget,
......@@ -1156,8 +1150,7 @@ layers_resize_layer_query (GimpImage *gimage,
gimage->unit,
TRUE,
G_CALLBACK (resize_layer_query_ok_callback),
NULL,
options);
options);
g_object_weak_ref (G_OBJECT (options->resize->resize_shell),
(GWeakNotify) g_free,
......
......@@ -41,6 +41,9 @@
#include "libgimp/gimpintl.h"
#define SB_WIDTH 10
typedef struct
{
GtkWidget *dialog;
......@@ -89,7 +92,7 @@ file_new_dialog_create (Gimp *gimp,
GimpImage *gimage)
{
NewImageInfo *info;
GtkWidget *top_vbox;
GtkWidget *main_vbox;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *abox;
......@@ -131,15 +134,15 @@ file_new_dialog_create (Gimp *gimp,
gtk_window_set_resizable (GTK_WINDOW (info->dialog), FALSE);
/* vbox holding the rest of the dialog */
top_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (top_vbox), 4);
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->dialog)->vbox),
top_vbox, TRUE, TRUE, 0);
gtk_widget_show (top_vbox);
main_vbox, TRUE, TRUE, 0);
gtk_widget_show (main_vbox);
/* Image size frame */
frame = gtk_frame_new (_("Image Size"));
gtk_box_pack_start (GTK_BOX (top_vbox), frame, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
vbox = gtk_vbox_new (FALSE, 0);
......@@ -149,7 +152,7 @@ file_new_dialog_create (Gimp *gimp,
table = gtk_table_new (7, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 4);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacing (GTK_TABLE (table), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (table), 2, 4);
gtk_table_set_row_spacing (GTK_TABLE (table), 4, 4);
......@@ -190,30 +193,33 @@ file_new_dialog_create (Gimp *gimp,
/* create the sizeentry which keeps it all together */
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 3, 5);
info->size_se =
gimp_size_entry_new (0, info->values->unit, "%a", FALSE, FALSE, TRUE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (info->size_se), 1, 2);
gtk_widget_show (abox);
info->size_se = gimp_size_entry_new (0, info->values->unit, "%a",
FALSE, FALSE, TRUE, SB_WIDTH,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
gtk_table_set_col_spacing (GTK_TABLE (info->size_se), 1, 4);
gtk_table_set_row_spacing (GTK_TABLE (info->size_se), 1, 2);
gtk_container_add (GTK_CONTAINER (abox), info->size_se);
gtk_widget_show (info->size_se);
gtk_widget_show (abox);
/* height in units */
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 75, -1);
spinbutton = gimp_spin_button_new (&adjustment,
1, 1, 1, 1, 10, 0,
1, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
/* add the "height in units" spinbutton to the sizeentry */
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
0, 1, 2, 3);
gtk_widget_show (spinbutton);
/* height in pixels */
hbox = gtk_hbox_new (FALSE, 2);
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
gtk_widget_set_size_request (spinbutton2, 75, -1);
hbox = gtk_hbox_new (FALSE, 4);
spinbutton2 = gimp_spin_button_new (&adjustment,
1, 1, 1, 1, 10, 0,
1, 0);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
gtk_box_pack_start (GTK_BOX (hbox), spinbutton2, FALSE, FALSE, 0);
gtk_widget_show (spinbutton2);
......@@ -235,10 +241,10 @@ file_new_dialog_create (Gimp *gimp,
GTK_SPIN_BUTTON (spinbutton2));
/* width in units */
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 75, -1);
spinbutton = gimp_spin_button_new (&adjustment,
1, 1, 1, 1, 10, 0,
1, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
/* add the "width in units" spinbutton to the sizeentry */
gtk_table_attach_defaults (GTK_TABLE (info->size_se), spinbutton,
0, 1, 1, 2);
......@@ -247,14 +253,15 @@ file_new_dialog_create (Gimp *gimp,
/* width in pixels */
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 0, 1);
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton2), TRUE);
gtk_widget_set_size_request (spinbutton2, 75, -1);
gtk_widget_show (abox);
spinbutton2 = gimp_spin_button_new (&adjustment,
1, 1, 1, 1, 10, 0,
1, 0);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton2), SB_WIDTH);
/* add the "width in pixels" spinbutton to the main table */
gtk_container_add (GTK_CONTAINER (abox), spinbutton2);
gtk_widget_show (spinbutton2);
gtk_widget_show (abox);
/* register the width spinbuttons with the sizeentry */
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->size_se),
......@@ -303,28 +310,30 @@ file_new_dialog_create (Gimp *gimp,
gtk_widget_show (label);
/* the resolution sizeentry */
adjustment = gtk_adjustment_new (1, 1, 1, 1, 10, 1);
spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (adjustment), 1, 2);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
gtk_widget_set_size_request (spinbutton, 75, -1);
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 5, 7);
gtk_widget_show (abox);
spinbutton = gimp_spin_button_new (&adjustment,
1, 1, 1, 1, 10, 0,
1, 2);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), SB_WIDTH);
info->resolution_se =
gimp_size_entry_new (1, gimp->config->default_resolution_units,
_("pixels/%a"),
FALSE, FALSE, FALSE, 75,
FALSE, FALSE, FALSE, SB_WIDTH,
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 1, 2);
gtk_table_set_col_spacing (GTK_TABLE (info->resolution_se), 2, 2);
gtk_table_set_row_spacing (GTK_TABLE (info->resolution_se), 0, 2);
gimp_size_entry_add_field (GIMP_SIZE_ENTRY (info->resolution_se),
GTK_SPIN_BUTTON (spinbutton), NULL);
gtk_table_attach_defaults (GTK_TABLE (info->resolution_se), spinbutton,
1, 2, 0, 1);
gtk_widget_show (spinbutton);
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
gtk_table_attach_defaults (GTK_TABLE (table), abox, 1, 2, 5, 7);
gtk_widget_show (abox);
gtk_container_add (GTK_CONTAINER (abox), info->resolution_se);
gtk_widget_show (info->resolution_se);
......@@ -355,8 +364,8 @@ file_new_dialog_create (Gimp *gimp,
gtk_widget_show (info->couple_resolutions);
/* hbox containing the Image type and fill type frames */
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (top_vbox), hbox, FALSE, FALSE, 0);
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
/* frame for Image Type */
......
......@@ -30,202 +30,52 @@
#include "info-dialog.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
/* static functions */
static void info_field_new (InfoDialog *idialog,
InfoFieldType field_type,
gchar *title,
GtkWidget *widget,
GtkObject *object,
gpointer value_ptr,
GCallback callback,
gpointer callback_data);
static void update_field (InfoField *info_field);
static gint info_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void
info_field_new (InfoDialog *idialog,
InfoFieldType field_type,
gchar *title,
GtkWidget *widget,
GtkObject *obj,
gpointer value_ptr,
GCallback callback,
gpointer callback_data)
{
GtkWidget *label;
InfoField *field;
gint row;
field = g_new (InfoField, 1);
row = idialog->nfields + 1;
gtk_table_resize (GTK_TABLE (idialog->info_table), 2, row);
label = gtk_label_new (title);
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
gtk_table_attach (GTK_TABLE (idialog->info_table), label,
0, 1, row - 1, row,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
gtk_table_attach_defaults (GTK_TABLE (idialog->info_table), widget,
1, 2, row - 1, row);
gtk_widget_show (widget);
gtk_table_set_col_spacing (GTK_TABLE (idialog->info_table), 0, 6);
gtk_table_set_row_spacings (GTK_TABLE (idialog->info_table), 2);
field->field_type = field_type;
#define SB_WIDTH 10
if (obj == NULL)
field->obj = GTK_OBJECT (widget);
else
field->obj = obj;
field->value_ptr = value_ptr;
field->callback = callback;
field->callback_data = callback_data;
/* local function prototypes */
idialog->field_list = g_slist_prepend (idialog->field_list, field);
idialog->nfields++;
}
static InfoDialog * info_dialog_new_extended (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data,
gboolean in_notebook);
static gboolean info_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void info_dialog_field_new (InfoDialog *idialog,
InfoFieldType field_type,
gchar *title,
GtkWidget *widget,
GtkObject *object,
gpointer value_ptr,
GCallback callback,
gpointer callback_data);
static void info_dialog_update_field (InfoField *info_field);
static void
update_field (InfoField *field)
{
const gchar *old_text;
gint num;
gint i;
if (field->value_ptr == NULL)
return;
if (field->field_type != INFO_LABEL)
g_signal_handlers_block_by_func (G_OBJECT (field->obj),
field->callback,
field->callback_data);
switch (field->field_type)
{
case INFO_LABEL:
gtk_label_set_text (GTK_LABEL (field->obj), (gchar *) field->value_ptr);
break;
case INFO_ENTRY:
old_text = gtk_entry_get_text (GTK_ENTRY (field->obj));
if (strcmp (old_text, (gchar *) field->value_ptr))
gtk_entry_set_text (GTK_ENTRY (field->obj), (gchar *) field->value_ptr);
break;
case INFO_SCALE:
case INFO_SPINBUTTON:
gtk_adjustment_set_value (GTK_ADJUSTMENT (field->obj),
*((gdouble *) field->value_ptr));
break;
case INFO_SIZEENTRY:
num = GIMP_SIZE_ENTRY (field->obj)->number_of_fields;
for (i = 0; i < num; i++)
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (field->obj), i,
((gdouble *) field->value_ptr)[i]);
break;
default:
g_warning ("%s: Unknown info_dialog field type.", G_STRLOC);
break;
}
if (field->field_type != INFO_LABEL)
g_signal_handlers_unblock_by_func (G_OBJECT (field->obj),
field->callback,
field->callback_data);
}
static gboolean
info_dialog_delete_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
info_dialog_popdown ((InfoDialog *) data);
return TRUE;
}
/* public functions */
static InfoDialog *
info_dialog_new_extended (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data,
gboolean in_notebook)
InfoDialog *
info_dialog_new (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data)
{
InfoDialog *idialog;
GtkWidget *shell;
GtkWidget *vbox;
GtkWidget *info_table;
GtkWidget *info_notebook;
idialog = g_new (InfoDialog, 1);
idialog->field_list = NULL;
idialog->nfields = 0;
shell = gimp_viewable_dialog_new (viewable,
title, wmclass_name,
stock_id, desc,
help_func, help_data,
NULL);
g_signal_connect (G_OBJECT (shell), "delete_event",
G_CALLBACK (info_dialog_delete_callback),
idialog);
vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
info_table = gtk_table_new (2, 0, FALSE);
if (in_notebook)
{
info_notebook = gtk_notebook_new ();
gtk_container_set_border_width (GTK_CONTAINER (info_table), 4);
gtk_notebook_append_page (GTK_NOTEBOOK (info_notebook),
info_table,
gtk_label_new (_("General")));
gtk_box_pack_start (GTK_BOX (vbox), info_notebook, FALSE, FALSE, 0);
}
else
{
info_notebook = NULL;
gtk_box_pack_start (GTK_BOX (vbox), info_table, FALSE, FALSE, 0);
}
idialog->shell = shell;
idialog->vbox = vbox;
idialog->info_table = info_table;
idialog->info_notebook = info_notebook;
if (in_notebook)
gtk_widget_show (idialog->info_notebook);
gtk_widget_show (idialog->info_table);
gtk_widget_show (idialog->vbox);
return idialog;
return info_dialog_new_extended (viewable, title, wmclass_name,
stock_id, desc,
help_func, help_data, FALSE);
}
/* public functions */
InfoDialog *
info_dialog_notebook_new (GimpViewable *viewable,
const gchar *title,
......@@ -240,38 +90,16 @@ info_dialog_notebook_new (GimpViewable *viewable,
help_func, help_data, TRUE);
}
InfoDialog *
info_dialog_new (GimpViewable *viewable,
const gchar *title,
const gchar *wmclass_name,
const gchar *stock_id,
const gchar *desc,
GimpHelpFunc help_func,
gpointer help_data)
{
return info_dialog_new_extended (viewable, title, wmclass_name,
stock_id, desc,
help_func, help_data, FALSE);
}
void
info_dialog_free (InfoDialog *idialog)
{
GSList *list;
g_return_if_fail (idialog != NULL);