use gtk_label_new_with_mnemonic():

2002-11-29  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpwidgets.c (gimp_pixmap_button_new):
	use gtk_label_new_with_mnemonic():

	* plug-ins/common/uniteditor.c: Treeviewized and undeprecated.
	Removed all static variables. Cleanup.
This commit is contained in:
Michael Natterer 2002-11-29 13:57:30 +00:00 committed by Michael Natterer
parent 2ed7b029a5
commit 41c5ac54ce
3 changed files with 290 additions and 295 deletions

View File

@ -1,3 +1,11 @@
2002-11-29 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpwidgets.c (gimp_pixmap_button_new):
use gtk_label_new_with_mnemonic():
* plug-ins/common/uniteditor.c: Treeviewized and undeprecated.
Removed all static variables. Cleanup.
2002-11-28 Sven Neumann <sven@gimp.org>
* app/config/Makefile.am

View File

@ -1347,7 +1347,8 @@ gimp_pixmap_button_new (gchar **xpm_data,
gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
gtk_widget_show (pixmap);
label = gtk_label_new (text);
label = gtk_label_new_with_mnemonic (text);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
gtk_widget_show (label);
}

View File

@ -25,15 +25,6 @@
#include <gtk/gtk.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtkclist.h>
#define GTK_DISABLE_DEPRECATED
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
@ -41,8 +32,23 @@
#include "pixmaps/new.xpm"
#include "pixmaps/duplicate.xpm"
#include "pixmaps/yes.xpm"
#include "pixmaps/no.xpm"
enum
{
SAVE,
IDENTIFIER,
FACTOR,
DIGITS,
SYMBOL,
ABBREVIATION,
SINGULAR,
PLURAL,
UNIT,
USER_UNIT,
BG_COLOR,
NUM_COLUMNS
};
static void query (void);
@ -66,6 +72,25 @@ GimpPlugInInfo PLUG_IN_INFO =
MAIN ()
static const gchar *help_strings[] =
{
N_("A unit definition will only be saved before "
"GIMP exits if this column is checked."),
N_("This string will be used to identify a "
"unit in GIMP's configuration files."),
N_("How many units make up an inch."),
N_("This field is a hint for numerical input fields. "
"It specifies how many decimal digits the input field "
"should provide to get approximately the same accuracy as an "
"\"inch\" input field with two decimal digits."),
N_("The unit's symbol if it has one (e.g. \"'\" for inches). "
"Use the unit's abbreviation if it doesn't have a symbol."),
N_("The unit's abbreviation (e.g. \"cm\" for centimeters)."),
N_("The unit's singular form."),
N_("The unit's plural form.")
};
static void
query (void)
{
@ -115,38 +140,6 @@ run (gchar *name,
}
}
static GdkPixmap *yes_pixmap = NULL;
static GdkBitmap *yes_mask = NULL;
static GdkPixmap *no_pixmap = NULL;
static GdkBitmap *no_mask = NULL;
static GtkWidget *delete_button = NULL;
static GtkWidget *undelete_button = NULL;
static GtkWidget *main_dialog = NULL;
static GtkWidget *clist = NULL;
static GdkColor color;
static GimpUnit current_unit = GIMP_UNIT_INCH;
static gint current_row = 0;
enum
{
SAVE,
IDENTIFIER,
FACTOR,
DIGITS,
SYMBOL,
ABBREVIATION,
SINGULAR,
PLURAL,
NUM_FIELDS
};
static gchar *help_strings[NUM_FIELDS];
static void
new_unit_ok_callback (GtkWidget *widget,
gpointer data)
@ -157,7 +150,8 @@ new_unit_ok_callback (GtkWidget *widget,
}
static GimpUnit
new_unit (GimpUnit template)
new_unit (GtkWidget *main_dialog,
GimpUnit template)
{
GtkWidget *dialog;
GtkWidget *table;
@ -175,8 +169,6 @@ new_unit (GimpUnit template)
gboolean ok = FALSE;
GimpUnit unit = GIMP_UNIT_PIXEL;
gtk_widget_set_sensitive (main_dialog, FALSE);
dialog = gimp_dialog_new (_("New Unit"), "uniteditor",
gimp_standard_help_func, "filters/uniteditor.html",
GTK_WIN_POS_MOUSE,
@ -190,6 +182,9 @@ new_unit (GimpUnit template)
NULL);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (main_dialog));
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
table = gtk_table_new (7, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
@ -205,33 +200,31 @@ new_unit (GimpUnit template)
gimp_unit_get_identifier (template));
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("ID:"), 1.0, 0.5,
_("_ID:"), 1.0, 0.5,
entry, 1, FALSE);
gimp_help_set_help_data (entry, help_strings[IDENTIFIER], NULL);
gimp_help_set_help_data (entry, gettext (help_strings[IDENTIFIER]), NULL);
spinbutton = gimp_spin_button_new (&factor_adj,
(template != GIMP_UNIT_PIXEL) ?
gimp_unit_get_factor (template) : 1.0,
GIMP_MIN_RESOLUTION, GIMP_MAX_RESOLUTION,
0.01, 0.1, 0.0, 0.01, 5);
gtk_widget_set_size_request (spinbutton, 100, -1);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Factor:"), 1.0, 0.5,
_("_Factor:"), 1.0, 0.5,
spinbutton, 1, TRUE);
gimp_help_set_help_data (spinbutton, help_strings[FACTOR], NULL);
gimp_help_set_help_data (spinbutton, gettext (help_strings[FACTOR]), NULL);
spinbutton = gimp_spin_button_new (&digits_adj,
(template != GIMP_UNIT_PIXEL) ?
gimp_unit_get_digits (template) : 2.0,
0, 5, 1, 1, 0, 1, 0);
gtk_widget_set_size_request (spinbutton, 50, -1);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 2,
_("Digits:"), 1.0, 0.5,
_("_Digits:"), 1.0, 0.5,
spinbutton, 1, TRUE);
gimp_help_set_help_data (spinbutton, help_strings[DIGITS], NULL);
gimp_help_set_help_data (spinbutton, gettext (help_strings[DIGITS]), NULL);
entry = symbol_entry = gtk_entry_new ();
if (template != GIMP_UNIT_PIXEL)
@ -240,10 +233,10 @@ new_unit (GimpUnit template)
gimp_unit_get_symbol (template));
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 3,
_("Symbol:"), 1.0, 0.5,
_("_Symbol:"), 1.0, 0.5,
entry, 1, FALSE);
gimp_help_set_help_data (entry, help_strings[SYMBOL], NULL);
gimp_help_set_help_data (entry, gettext (help_strings[SYMBOL]), NULL);
entry = abbreviation_entry = gtk_entry_new ();
if (template != GIMP_UNIT_PIXEL)
@ -252,10 +245,10 @@ new_unit (GimpUnit template)
gimp_unit_get_abbreviation (template));
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 4,
_("Abbreviation:"), 1.0, 0.5,
_("_Abbreviation:"), 1.0, 0.5,
entry, 1, FALSE);
gimp_help_set_help_data (entry, help_strings[ABBREVIATION], NULL);
gimp_help_set_help_data (entry, gettext (help_strings[ABBREVIATION]), NULL);
entry = singular_entry = gtk_entry_new ();
if (template != GIMP_UNIT_PIXEL)
@ -264,10 +257,10 @@ new_unit (GimpUnit template)
gimp_unit_get_singular (template));
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 5,
_("Singular:"), 1.0, 0.5,
_("Si_ngular:"), 1.0, 0.5,
entry, 1, FALSE);
gimp_help_set_help_data (entry, help_strings[SINGULAR], NULL);
gimp_help_set_help_data (entry, gettext (help_strings[SINGULAR]), NULL);
entry = plural_entry = gtk_entry_new ();
if (template != GIMP_UNIT_PIXEL)
@ -276,10 +269,10 @@ new_unit (GimpUnit template)
gimp_unit_get_plural (template));
}
gimp_table_attach_aligned (GTK_TABLE (table), 0, 6,
_("Plural:"), 1.0, 0.5,
_("_Plural:"), 1.0, 0.5,
entry, 1, FALSE);
gimp_help_set_help_data (entry, help_strings[PLURAL], NULL);
gimp_help_set_help_data (entry, gettext (help_strings[PLURAL]), NULL);
gtk_widget_show (dialog);
@ -349,192 +342,209 @@ new_unit (GimpUnit template)
gtk_widget_destroy (dialog);
gtk_widget_set_sensitive (main_dialog, TRUE);
return unit;
}
static void
clist_init (void)
list_init (GtkTreeView *tv)
{
gchar *entries[8];
gint num_units;
GimpUnit unit;
gint column_width;
gint row;
gint i;
GtkListStore *list_store;
GtkTreeSelection *sel;
GtkTreeIter iter;
gint num_units;
GimpUnit unit;
GdkColor color;
entries[0] = NULL;
list_store = GTK_LIST_STORE (gtk_tree_view_get_model (tv));
sel = gtk_tree_view_get_selection (tv);
gtk_list_store_clear (list_store);
num_units = gimp_unit_get_number_of_units ();
color.red = 65535;
color.green = 50000;
color.blue = 50000;
for (unit = GIMP_UNIT_INCH; unit < num_units; unit++)
{
row = unit - GIMP_UNIT_INCH;
gboolean user_unit;
entries[1] = (gchar *) gimp_unit_get_identifier (unit);
entries[2] = g_strdup_printf ("%.5f", gimp_unit_get_factor (unit));
entries[3] = g_strdup_printf ("%d", gimp_unit_get_digits (unit));
entries[4] = (gchar *) gimp_unit_get_symbol (unit);
entries[5] = (gchar *) gimp_unit_get_abbreviation (unit);
entries[6] = (gchar *) gimp_unit_get_singular (unit);
entries[7] = (gchar *) gimp_unit_get_plural (unit);
user_unit = (unit >= gimp_unit_get_number_of_built_in_units ());
gtk_clist_append (GTK_CLIST (clist), entries);
gtk_clist_set_row_data (GTK_CLIST (clist), row,
(gpointer) unit);
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
SAVE, ! gimp_unit_get_deletion_flag (unit),
IDENTIFIER, gimp_unit_get_identifier (unit),
FACTOR, gimp_unit_get_factor (unit),
DIGITS, gimp_unit_get_digits (unit),
SYMBOL, gimp_unit_get_symbol (unit),
ABBREVIATION, gimp_unit_get_abbreviation (unit),
SINGULAR, gimp_unit_get_singular (unit),
PLURAL, gimp_unit_get_plural (unit),
UNIT, unit,
USER_UNIT, user_unit,
if (unit < gimp_unit_get_number_of_built_in_units ())
gtk_clist_set_background (GTK_CLIST (clist), row, &color);
user_unit ? -1 : BG_COLOR, &color,
if (gimp_unit_get_deletion_flag (unit))
{
gtk_clist_set_pixmap (GTK_CLIST (clist), row, 0,
no_pixmap, no_mask);
}
else
{
gtk_clist_set_pixmap (GTK_CLIST (clist), row, 0,
yes_pixmap, yes_mask);
}
g_free (entries[2]);
g_free (entries[3]);
-1);
}
for (i = 0; i < 8; i++)
{
column_width = gtk_clist_optimal_column_width (GTK_CLIST (clist), i);
gtk_clist_set_column_width (GTK_CLIST (clist), i, column_width);
}
if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (list_store), &iter))
gtk_tree_selection_select_iter (sel, &iter);
}
static void
select_row_callback (GtkWidget *widget,
gint row,
gint column,
GdkEventButton *bevent,
gpointer data)
new_callback (GtkWidget *widget,
GtkTreeView *tv)
{
GimpUnit unit;
gboolean delete_sensitive = TRUE;
gboolean undelete_sensitive = TRUE;
GtkListStore *list_store;
GtkTreeSelection *sel;
GimpUnit unit;
current_row = row;
list_store = GTK_LIST_STORE (gtk_tree_view_get_model (tv));
sel = gtk_tree_view_get_selection (tv);
unit = current_unit =
(GimpUnit) gtk_clist_get_row_data (GTK_CLIST (widget), row);
if (unit < gimp_unit_get_number_of_built_in_units ())
{
delete_sensitive = FALSE;
undelete_sensitive = FALSE;
}
else if (gimp_unit_get_deletion_flag (unit))
{
delete_sensitive = FALSE;
gtk_clist_set_pixmap (GTK_CLIST (clist), current_row, 0,
no_pixmap, no_mask);
}
else
{
undelete_sensitive = FALSE;
gtk_clist_set_pixmap (GTK_CLIST (clist), current_row, 0,
yes_pixmap, yes_mask);
}
gtk_widget_set_sensitive (delete_button, delete_sensitive);
gtk_widget_set_sensitive (undelete_button, undelete_sensitive);
}
static void
refresh_callback (GtkWidget *widget,
gpointer data)
{
gtk_clist_clear (GTK_CLIST (clist));
clist_init ();
gtk_clist_select_row (GTK_CLIST (clist), 0, 0);
}
static void
new_callback (GtkWidget *widget,
gpointer data)
{
GimpUnit unit;
unit = new_unit (GIMP_UNIT_PIXEL);
unit = new_unit (gtk_widget_get_toplevel (widget), GIMP_UNIT_PIXEL);
if (unit != GIMP_UNIT_PIXEL)
{
refresh_callback (NULL, NULL);
gtk_clist_select_row (GTK_CLIST (clist), unit - GIMP_UNIT_INCH, 0);
gtk_clist_moveto (GTK_CLIST (clist), unit - GIMP_UNIT_INCH, -1, 0.5, 0.0);
GtkTreeIter iter;
list_init (tv);
if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (list_store), &iter) &&
gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list_store), &iter,
NULL, unit - GIMP_UNIT_INCH))
{
GtkAdjustment *adj;
gtk_tree_selection_select_iter (sel, &iter);
adj = gtk_tree_view_get_vadjustment (tv);
gtk_adjustment_set_value (adj, adj->upper);
}
}
}
static void
duplicate_callback (GtkWidget *widget,
gpointer data)
duplicate_callback (GtkWidget *widget,
GtkTreeView *tv)
{
GimpUnit unit;
GtkListStore *list_store;
GtkTreeSelection *sel;
GtkTreeIter iter;
unit = new_unit (current_unit);
list_store = GTK_LIST_STORE (gtk_tree_view_get_model (tv));
sel = gtk_tree_view_get_selection (tv);
if (unit != GIMP_UNIT_PIXEL)
if (gtk_tree_selection_get_selected (sel, NULL, &iter))
{
refresh_callback (NULL, NULL);
gtk_clist_select_row (GTK_CLIST (clist), unit - GIMP_UNIT_INCH, 0);
gtk_clist_moveto (GTK_CLIST (clist), unit - GIMP_UNIT_INCH, -1, 0.5, 0.0);
GimpUnit unit;
gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter,
UNIT, &unit,
-1);
unit = new_unit (gtk_widget_get_toplevel (widget), unit);
if (unit != GIMP_UNIT_PIXEL)
{
GtkTreeIter iter;
list_init (tv);
if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (list_store),
&iter) &&
gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (list_store), &iter,
NULL, unit - GIMP_UNIT_INCH))
{
GtkAdjustment *adj;
gtk_tree_selection_select_iter (sel, &iter);
adj = gtk_tree_view_get_vadjustment (tv);
gtk_adjustment_set_value (adj, adj->upper);
}
}
}
}
static void
delete_callback (GtkWidget *widget,
gpointer data)
saved_toggled_callback (GtkCellRendererToggle *celltoggle,
gchar *path_string,
GtkListStore *list_store)
{
gimp_unit_set_deletion_flag (current_unit, TRUE);
gtk_clist_set_pixmap (GTK_CLIST (clist), current_row, 0,
no_pixmap, no_mask);
gtk_clist_select_row (GTK_CLIST (clist), current_row, 0);
}
GtkTreePath *path;
GtkTreeIter iter;
gboolean saved;
GimpUnit unit;
static void
undelete_callback (GtkWidget *widget,
gpointer data)
{
gimp_unit_set_deletion_flag (current_unit, FALSE);
gtk_clist_set_pixmap (GTK_CLIST (clist), current_row, 0,
yes_pixmap, yes_mask);
gtk_clist_select_row (GTK_CLIST (clist), current_row, 0);
path = gtk_tree_path_new_from_string (path_string);
if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (list_store), &iter, path))
{
g_warning ("%s: bad tree path?", G_STRLOC);
return;
}
gtk_tree_path_free (path);
gtk_tree_model_get (GTK_TREE_MODEL (list_store), &iter,
SAVE, &saved,
UNIT, &unit,
-1);
if (unit >= gimp_unit_get_number_of_built_in_units ())
{
gimp_unit_set_deletion_flag (unit, saved);
gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
SAVE, ! saved,
-1);
}
}
static void
unit_editor_dialog (void)
{
GtkWidget *main_vbox;
GtkWidget *scrolled_win;
GtkWidget *hbox;
GtkWidget *button;
GtkStyle *style;
gchar *titles[NUM_FIELDS];
gint i;
GtkWidget *main_dialog;
GtkWidget *main_vbox;
GtkWidget *scrolled_win;
GtkWidget *hbox;
GtkWidget *button;
GtkListStore *list_store;
GtkWidget *tv;
GtkTreeViewColumn *col;
GtkCellRenderer *rend;
gimp_ui_init ("uniteditor", FALSE);
list_store = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_BOOLEAN,
G_TYPE_STRING,
G_TYPE_DOUBLE,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_BOOLEAN,
GDK_TYPE_COLOR);
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
g_object_unref (list_store);
main_dialog =
gimp_dialog_new (_("Unit Editor"), "uniteditor",
gimp_standard_help_func, "filters/uniteditor.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, TRUE,
gimp_standard_help_func, "filters/uniteditor.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, TRUE,
GTK_STOCK_REFRESH, refresh_callback,
NULL, NULL, NULL, FALSE, FALSE,
GTK_STOCK_REFRESH, list_init,
NULL, tv, NULL, FALSE, FALSE,
GTK_STOCK_CLOSE, gtk_widget_destroy,
NULL, 1, NULL, TRUE, TRUE,
GTK_STOCK_CLOSE, gtk_widget_destroy,
NULL, 1, NULL, TRUE, TRUE,
NULL);
NULL);
g_signal_connect (G_OBJECT (main_dialog), "destroy",
G_CALLBACK (gtk_main_quit),
@ -542,152 +552,128 @@ unit_editor_dialog (void)
gimp_help_init ();
help_strings[SAVE] = _("A unit definition will only be saved before "
"GIMP exits if this column is checked.");
help_strings[IDENTIFIER] = _("This string will be used to identify a "
"unit in GIMP's configuration files.");
help_strings[FACTOR] = _("How many units make up an inch.");
help_strings[DIGITS] = _("This field is a hint for numerical input "
"fields. It specifies how many decimal digits "
"the input field should provide to get "
"approximately the same accuracy as an "
"\"inch\" input field with two decimal "
"digits.");
help_strings[SYMBOL] = _("The unit's symbol if it has one (e.g. \"'\" "
"for inches). Use the unit's abbreviation if "
"it doesn't have a symbol.");
help_strings[ABBREVIATION] = _("The unit's abbreviation (e.g. \"cm\" for "
"centimeters).");
help_strings[SINGULAR] = _("The unit's singular form.");
help_strings[PLURAL] = _("The unit's plural form.");
/* the main vbox */
main_vbox = gtk_vbox_new (FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (main_dialog)->vbox), main_vbox);
gtk_widget_show (main_vbox);
/* the selection list */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_NEVER,
GTK_POLICY_ALWAYS);
gtk_container_add (GTK_CONTAINER (main_vbox), scrolled_win);
gtk_widget_show (scrolled_win);
titles[SAVE] = _("Saved");
titles[IDENTIFIER] = _("ID");
titles[FACTOR] = _("Factor");
titles[DIGITS] = _("Digits");
titles[SYMBOL] = _("Symbol");
titles[ABBREVIATION] = _("Abbr.");
titles[SINGULAR] = _("Singular");
titles[PLURAL] = _("Plural");
gtk_widget_set_size_request (tv, -1, 220);
gtk_container_add (GTK_CONTAINER (scrolled_win), tv);
gtk_widget_show (tv);
clist = gtk_clist_new_with_titles (NUM_FIELDS, titles);
gtk_clist_set_shadow_type (GTK_CLIST (clist), GTK_SHADOW_IN);
gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE);
gtk_clist_column_titles_passive (GTK_CLIST (clist));
/* eek, passive column titles don't show a tooltip, so the next 3 lines
* are useless...
*/
for (i = 0; i < NUM_FIELDS; i++)
gimp_help_set_help_data (gtk_clist_get_column_widget (GTK_CLIST (clist), i),
help_strings[i], NULL);
rend = gtk_cell_renderer_toggle_new ();
col = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (col, _("Saved"));
gtk_tree_view_column_pack_start (col, rend, FALSE);
gtk_tree_view_column_set_attributes (col, rend,
"active", SAVE,
"activatable", USER_UNIT,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gtk_widget_realize (main_dialog);
style = gtk_widget_get_style (main_dialog);
gimp_help_set_help_data (col->button, gettext (help_strings[SAVE]), NULL);
yes_pixmap = gdk_pixmap_create_from_xpm_d (main_dialog->window,
&yes_mask,
&style->bg[GTK_STATE_NORMAL],
yes_xpm);
g_signal_connect (G_OBJECT (rend), "toggled",
G_CALLBACK (saved_toggled_callback),
list_store);
no_pixmap = gdk_pixmap_create_from_xpm_d (main_dialog->window,
&no_mask,
&style->bg[GTK_STATE_NORMAL],
no_xpm);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("ID"), rend,
"text", IDENTIFIER,
"background-gdk", BG_COLOR,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
color.red = 65535;
color.green = 50000;
color.blue = 50000;
gimp_help_set_help_data (col->button, gettext (help_strings[IDENTIFIER]), NULL);
gdk_colormap_alloc_color (gtk_widget_get_colormap (main_dialog),
&color, FALSE, TRUE);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Factor"), rend,
"text", FACTOR,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
clist_init ();
gimp_help_set_help_data (col->button, gettext (help_strings[FACTOR]), NULL);
gtk_widget_set_size_request (clist, -1, 200);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Digits"), rend,
"text", DIGITS,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gtk_container_add (GTK_CONTAINER (scrolled_win), clist);
gtk_widget_show (clist);
gimp_help_set_help_data (col->button, gettext (help_strings[DIGITS]), NULL);
g_signal_connect (G_OBJECT (clist), "select_row",
G_CALLBACK (select_row_callback),
NULL);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Symbol"), rend,
"text", SYMBOL,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gimp_help_set_help_data (col->button, gettext (help_strings[SYMBOL]), NULL);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Abbreviation"), rend,
"text", ABBREVIATION,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gimp_help_set_help_data (col->button, gettext (help_strings[ABBREVIATION]), NULL);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Singular"), rend,
"text", SINGULAR,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gimp_help_set_help_data (col->button, gettext (help_strings[SINGULAR]), NULL);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes (_("Plural"), rend,
"text", PLURAL,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
gimp_help_set_help_data (col->button, gettext (help_strings[PLURAL]), NULL);
list_init (GTK_TREE_VIEW (tv));
hbox = gtk_hbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
button = gimp_pixmap_button_new (new_xpm, _("New Unit"));
button = gimp_pixmap_button_new (new_xpm, _("_New Unit"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (new_callback),
NULL);
tv);
gimp_help_set_help_data (button, _("Create a new unit from scratch."), NULL);
button = gimp_pixmap_button_new (duplicate_xpm, _("Duplicate Unit"));
button = gimp_pixmap_button_new (duplicate_xpm, _("_Duplicate Unit"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (duplicate_callback),
NULL);
tv);
gimp_help_set_help_data (button, _("Create a new unit with the currently "
"seleted unit as template."), NULL);
button = gimp_pixmap_button_new (no_xpm, _("Don't Save Unit"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (delete_callback),
NULL);
gimp_help_set_help_data (button, _("Don't save the currently selected unit "
"before GIMP exits."), NULL);
delete_button = button;
button = gimp_pixmap_button_new (yes_xpm, _("Save Unit"));
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (undelete_callback),
NULL);
gimp_help_set_help_data (button, _("Save the currently selected unit "
"before GIMP exits."), NULL);
undelete_button = button;
gtk_clist_select_row (GTK_CLIST (clist), 0, 0);
gtk_widget_show (main_dialog);
gtk_main ();
gimp_help_free ();
gdk_flush ();
g_object_unref (yes_pixmap);
g_object_unref (yes_mask);
g_object_unref (no_pixmap);
g_object_unref (no_mask);
}