app/widgets/gimppropwidgets.[ch] replaced
2004-04-19 Sven Neumann <sven@gimp.org> * app/widgets/gimppropwidgets.[ch] * app/gui/preferences-dialog.c: replaced gimp_prop_boolean_option_menu_new() with gimp_prop_boolean_combo_box_new().
This commit is contained in:

committed by
Sven Neumann

parent
e2709b97ba
commit
1d2976f934
@ -1,3 +1,10 @@
|
|||||||
|
2004-04-19 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/widgets/gimppropwidgets.[ch]
|
||||||
|
* app/gui/preferences-dialog.c: replaced
|
||||||
|
gimp_prop_boolean_option_menu_new() with
|
||||||
|
gimp_prop_boolean_combo_box_new().
|
||||||
|
|
||||||
2004-04-19 Sven Neumann <sven@gimp.org>
|
2004-04-19 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpenumstore.[ch]: avoid unnecessary casts.
|
* app/widgets/gimpenumstore.[ch]: avoid unnecessary casts.
|
||||||
|
@ -805,7 +805,7 @@ prefs_enum_combo_box_add (GObject *config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
prefs_boolean_option_menu_add (GObject *config,
|
prefs_boolean_combo_box_add (GObject *config,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
const gchar *true_text,
|
const gchar *true_text,
|
||||||
const gchar *false_text,
|
const gchar *false_text,
|
||||||
@ -815,7 +815,7 @@ prefs_boolean_option_menu_add (GObject *config,
|
|||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
|
|
||||||
menu = gimp_prop_boolean_option_menu_new (config, property_name,
|
menu = gimp_prop_boolean_combo_box_new (config, property_name,
|
||||||
true_text, false_text);
|
true_text, false_text);
|
||||||
|
|
||||||
if (menu)
|
if (menu)
|
||||||
@ -1506,7 +1506,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||||||
|
|
||||||
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
|
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
|
||||||
|
|
||||||
prefs_boolean_option_menu_add (object, "initial-zoom-to-fit",
|
prefs_boolean_combo_box_add (object, "initial-zoom-to-fit",
|
||||||
_("Fit to Window"),
|
_("Fit to Window"),
|
||||||
"1:1",
|
"1:1",
|
||||||
_("Inital Zoom Ratio:"),
|
_("Inital Zoom Ratio:"),
|
||||||
@ -1931,7 +1931,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||||||
|
|
||||||
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
|
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
|
||||||
|
|
||||||
prefs_boolean_option_menu_add (object, "trust-dirty-flag",
|
prefs_boolean_combo_box_add (object, "trust-dirty-flag",
|
||||||
_("Only when Modified"),
|
_("Only when Modified"),
|
||||||
_("Always"),
|
_("Always"),
|
||||||
_("\"File -> Save\" Saves the Image:"),
|
_("\"File -> Save\" Saves the Image:"),
|
||||||
|
@ -805,7 +805,7 @@ prefs_enum_combo_box_add (GObject *config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
prefs_boolean_option_menu_add (GObject *config,
|
prefs_boolean_combo_box_add (GObject *config,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
const gchar *true_text,
|
const gchar *true_text,
|
||||||
const gchar *false_text,
|
const gchar *false_text,
|
||||||
@ -815,7 +815,7 @@ prefs_boolean_option_menu_add (GObject *config,
|
|||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
|
|
||||||
menu = gimp_prop_boolean_option_menu_new (config, property_name,
|
menu = gimp_prop_boolean_combo_box_new (config, property_name,
|
||||||
true_text, false_text);
|
true_text, false_text);
|
||||||
|
|
||||||
if (menu)
|
if (menu)
|
||||||
@ -1506,7 +1506,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||||||
|
|
||||||
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
|
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
|
||||||
|
|
||||||
prefs_boolean_option_menu_add (object, "initial-zoom-to-fit",
|
prefs_boolean_combo_box_add (object, "initial-zoom-to-fit",
|
||||||
_("Fit to Window"),
|
_("Fit to Window"),
|
||||||
"1:1",
|
"1:1",
|
||||||
_("Inital Zoom Ratio:"),
|
_("Inital Zoom Ratio:"),
|
||||||
@ -1931,7 +1931,7 @@ prefs_dialog_new (Gimp *gimp,
|
|||||||
|
|
||||||
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
|
table = prefs_table_new (2, GTK_CONTAINER (vbox2), TRUE);
|
||||||
|
|
||||||
prefs_boolean_option_menu_add (object, "trust-dirty-flag",
|
prefs_boolean_combo_box_add (object, "trust-dirty-flag",
|
||||||
_("Only when Modified"),
|
_("Only when Modified"),
|
||||||
_("Always"),
|
_("Always"),
|
||||||
_("\"File -> Save\" Saves the Image:"),
|
_("\"File -> Save\" Saves the Image:"),
|
||||||
|
@ -380,13 +380,96 @@ gimp_prop_enum_combo_box_notify (GObject *config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************/
|
/************************/
|
||||||
/* option menus */
|
/* boolean combo box */
|
||||||
/******************/
|
/************************/
|
||||||
|
|
||||||
static void gimp_prop_option_menu_callback (GtkWidget *widget,
|
static void gimp_prop_boolean_combo_box_callback (GtkWidget *widget,
|
||||||
GObject *config);
|
GObject *config);
|
||||||
static void gimp_prop_option_menu_notify (GObject *config,
|
static void gimp_prop_boolean_combo_box_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *widget);
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gimp_prop_boolean_combo_box_new (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
const gchar *true_text,
|
||||||
|
const gchar *false_text)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
GtkWidget *combo_box;
|
||||||
|
gboolean value;
|
||||||
|
|
||||||
|
param_spec = check_param_spec (config, property_name,
|
||||||
|
G_TYPE_PARAM_BOOLEAN, G_STRLOC);
|
||||||
|
if (! param_spec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
property_name, &value,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
combo_box = gtk_combo_box_new_text ();
|
||||||
|
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), true_text);
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), false_text);
|
||||||
|
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), value ? 0 : 1);
|
||||||
|
|
||||||
|
g_signal_connect (combo_box, "changed",
|
||||||
|
G_CALLBACK (gimp_prop_boolean_combo_box_callback),
|
||||||
|
config);
|
||||||
|
|
||||||
|
set_param_spec (G_OBJECT (combo_box), combo_box, param_spec);
|
||||||
|
|
||||||
|
connect_notify (config, property_name,
|
||||||
|
G_CALLBACK (gimp_prop_boolean_combo_box_notify),
|
||||||
|
combo_box);
|
||||||
|
|
||||||
|
return combo_box;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_boolean_combo_box_callback (GtkWidget *widget,
|
||||||
|
GObject *config)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
gint value;
|
||||||
|
|
||||||
|
param_spec = get_param_spec (G_OBJECT (widget));
|
||||||
|
if (! param_spec)
|
||||||
|
return;
|
||||||
|
|
||||||
|
value = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
||||||
|
|
||||||
|
g_object_set (config,
|
||||||
|
param_spec->name, value ? FALSE : TRUE,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_boolean_combo_box_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *combo_box)
|
||||||
|
{
|
||||||
|
gint value;
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
param_spec->name, &value,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), value ? 0 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************/
|
||||||
|
/* paint menu */
|
||||||
|
/****************/
|
||||||
|
|
||||||
|
static void gimp_prop_paint_menu_callback (GtkWidget *widget,
|
||||||
|
GObject *config);
|
||||||
|
static void gimp_prop_paint_menu_notify (GObject *config,
|
||||||
GParamSpec *param_spec,
|
GParamSpec *param_spec,
|
||||||
GtkWidget *menu);
|
GtkWidget *menu);
|
||||||
|
|
||||||
@ -408,7 +491,7 @@ gimp_prop_paint_mode_menu_new (GObject *config,
|
|||||||
property_name, &value,
|
property_name, &value,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
menu = gimp_paint_mode_menu_new (G_CALLBACK (gimp_prop_option_menu_callback),
|
menu = gimp_paint_mode_menu_new (G_CALLBACK (gimp_prop_paint_menu_callback),
|
||||||
config,
|
config,
|
||||||
with_behind_mode,
|
with_behind_mode,
|
||||||
value);
|
value);
|
||||||
@ -416,53 +499,14 @@ gimp_prop_paint_mode_menu_new (GObject *config,
|
|||||||
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
||||||
|
|
||||||
connect_notify (config, property_name,
|
connect_notify (config, property_name,
|
||||||
G_CALLBACK (gimp_prop_option_menu_notify),
|
G_CALLBACK (gimp_prop_paint_menu_notify),
|
||||||
menu);
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
gimp_prop_boolean_option_menu_new (GObject *config,
|
|
||||||
const gchar *property_name,
|
|
||||||
const gchar *true_text,
|
|
||||||
const gchar *false_text)
|
|
||||||
{
|
|
||||||
GParamSpec *param_spec;
|
|
||||||
GtkWidget *menu;
|
|
||||||
gboolean value;
|
|
||||||
|
|
||||||
param_spec = check_param_spec (config, property_name,
|
|
||||||
G_TYPE_PARAM_BOOLEAN, G_STRLOC);
|
|
||||||
if (! param_spec)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
g_object_get (config,
|
|
||||||
property_name, &value,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
menu =
|
|
||||||
gimp_int_option_menu_new (FALSE,
|
|
||||||
G_CALLBACK (gimp_prop_option_menu_callback),
|
|
||||||
config, value,
|
|
||||||
|
|
||||||
true_text, TRUE, NULL,
|
|
||||||
false_text, FALSE, NULL,
|
|
||||||
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
|
||||||
|
|
||||||
connect_notify (config, property_name,
|
|
||||||
G_CALLBACK (gimp_prop_option_menu_notify),
|
|
||||||
menu);
|
menu);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prop_option_menu_callback (GtkWidget *widget,
|
gimp_prop_paint_menu_callback (GtkWidget *widget,
|
||||||
GObject *config)
|
GObject *config)
|
||||||
{
|
{
|
||||||
if (GTK_IS_MENU (widget->parent))
|
if (GTK_IS_MENU (widget->parent))
|
||||||
@ -491,7 +535,7 @@ gimp_prop_option_menu_callback (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prop_option_menu_notify (GObject *config,
|
gimp_prop_paint_menu_notify (GObject *config,
|
||||||
GParamSpec *param_spec,
|
GParamSpec *param_spec,
|
||||||
GtkWidget *menu)
|
GtkWidget *menu)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
GtkWidget * gimp_prop_check_button_new (GObject *config,
|
GtkWidget * gimp_prop_check_button_new (GObject *config,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
const gchar *label);
|
const gchar *label);
|
||||||
GtkWidget * gimp_prop_boolean_option_menu_new (GObject *config,
|
GtkWidget * gimp_prop_boolean_combo_box_new (GObject *config,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
const gchar *true_text,
|
const gchar *true_text,
|
||||||
const gchar *false_text);
|
const gchar *false_text);
|
||||||
|
@ -380,13 +380,96 @@ gimp_prop_enum_combo_box_notify (GObject *config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************/
|
/************************/
|
||||||
/* option menus */
|
/* boolean combo box */
|
||||||
/******************/
|
/************************/
|
||||||
|
|
||||||
static void gimp_prop_option_menu_callback (GtkWidget *widget,
|
static void gimp_prop_boolean_combo_box_callback (GtkWidget *widget,
|
||||||
GObject *config);
|
GObject *config);
|
||||||
static void gimp_prop_option_menu_notify (GObject *config,
|
static void gimp_prop_boolean_combo_box_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *widget);
|
||||||
|
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gimp_prop_boolean_combo_box_new (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
const gchar *true_text,
|
||||||
|
const gchar *false_text)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
GtkWidget *combo_box;
|
||||||
|
gboolean value;
|
||||||
|
|
||||||
|
param_spec = check_param_spec (config, property_name,
|
||||||
|
G_TYPE_PARAM_BOOLEAN, G_STRLOC);
|
||||||
|
if (! param_spec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
property_name, &value,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
combo_box = gtk_combo_box_new_text ();
|
||||||
|
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), true_text);
|
||||||
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), false_text);
|
||||||
|
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), value ? 0 : 1);
|
||||||
|
|
||||||
|
g_signal_connect (combo_box, "changed",
|
||||||
|
G_CALLBACK (gimp_prop_boolean_combo_box_callback),
|
||||||
|
config);
|
||||||
|
|
||||||
|
set_param_spec (G_OBJECT (combo_box), combo_box, param_spec);
|
||||||
|
|
||||||
|
connect_notify (config, property_name,
|
||||||
|
G_CALLBACK (gimp_prop_boolean_combo_box_notify),
|
||||||
|
combo_box);
|
||||||
|
|
||||||
|
return combo_box;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_boolean_combo_box_callback (GtkWidget *widget,
|
||||||
|
GObject *config)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
gint value;
|
||||||
|
|
||||||
|
param_spec = get_param_spec (G_OBJECT (widget));
|
||||||
|
if (! param_spec)
|
||||||
|
return;
|
||||||
|
|
||||||
|
value = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
||||||
|
|
||||||
|
g_object_set (config,
|
||||||
|
param_spec->name, value ? FALSE : TRUE,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_prop_boolean_combo_box_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkWidget *combo_box)
|
||||||
|
{
|
||||||
|
gint value;
|
||||||
|
|
||||||
|
g_object_get (config,
|
||||||
|
param_spec->name, &value,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), value ? 0 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************/
|
||||||
|
/* paint menu */
|
||||||
|
/****************/
|
||||||
|
|
||||||
|
static void gimp_prop_paint_menu_callback (GtkWidget *widget,
|
||||||
|
GObject *config);
|
||||||
|
static void gimp_prop_paint_menu_notify (GObject *config,
|
||||||
GParamSpec *param_spec,
|
GParamSpec *param_spec,
|
||||||
GtkWidget *menu);
|
GtkWidget *menu);
|
||||||
|
|
||||||
@ -408,7 +491,7 @@ gimp_prop_paint_mode_menu_new (GObject *config,
|
|||||||
property_name, &value,
|
property_name, &value,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
menu = gimp_paint_mode_menu_new (G_CALLBACK (gimp_prop_option_menu_callback),
|
menu = gimp_paint_mode_menu_new (G_CALLBACK (gimp_prop_paint_menu_callback),
|
||||||
config,
|
config,
|
||||||
with_behind_mode,
|
with_behind_mode,
|
||||||
value);
|
value);
|
||||||
@ -416,53 +499,14 @@ gimp_prop_paint_mode_menu_new (GObject *config,
|
|||||||
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
||||||
|
|
||||||
connect_notify (config, property_name,
|
connect_notify (config, property_name,
|
||||||
G_CALLBACK (gimp_prop_option_menu_notify),
|
G_CALLBACK (gimp_prop_paint_menu_notify),
|
||||||
menu);
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
gimp_prop_boolean_option_menu_new (GObject *config,
|
|
||||||
const gchar *property_name,
|
|
||||||
const gchar *true_text,
|
|
||||||
const gchar *false_text)
|
|
||||||
{
|
|
||||||
GParamSpec *param_spec;
|
|
||||||
GtkWidget *menu;
|
|
||||||
gboolean value;
|
|
||||||
|
|
||||||
param_spec = check_param_spec (config, property_name,
|
|
||||||
G_TYPE_PARAM_BOOLEAN, G_STRLOC);
|
|
||||||
if (! param_spec)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
g_object_get (config,
|
|
||||||
property_name, &value,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
menu =
|
|
||||||
gimp_int_option_menu_new (FALSE,
|
|
||||||
G_CALLBACK (gimp_prop_option_menu_callback),
|
|
||||||
config, value,
|
|
||||||
|
|
||||||
true_text, TRUE, NULL,
|
|
||||||
false_text, FALSE, NULL,
|
|
||||||
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
set_param_spec (G_OBJECT (menu), menu, param_spec);
|
|
||||||
|
|
||||||
connect_notify (config, property_name,
|
|
||||||
G_CALLBACK (gimp_prop_option_menu_notify),
|
|
||||||
menu);
|
menu);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prop_option_menu_callback (GtkWidget *widget,
|
gimp_prop_paint_menu_callback (GtkWidget *widget,
|
||||||
GObject *config)
|
GObject *config)
|
||||||
{
|
{
|
||||||
if (GTK_IS_MENU (widget->parent))
|
if (GTK_IS_MENU (widget->parent))
|
||||||
@ -491,7 +535,7 @@ gimp_prop_option_menu_callback (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_prop_option_menu_notify (GObject *config,
|
gimp_prop_paint_menu_notify (GObject *config,
|
||||||
GParamSpec *param_spec,
|
GParamSpec *param_spec,
|
||||||
GtkWidget *menu)
|
GtkWidget *menu)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
GtkWidget * gimp_prop_check_button_new (GObject *config,
|
GtkWidget * gimp_prop_check_button_new (GObject *config,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
const gchar *label);
|
const gchar *label);
|
||||||
GtkWidget * gimp_prop_boolean_option_menu_new (GObject *config,
|
GtkWidget * gimp_prop_boolean_combo_box_new (GObject *config,
|
||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
const gchar *true_text,
|
const gchar *true_text,
|
||||||
const gchar *false_text);
|
const gchar *false_text);
|
||||||
|
Reference in New Issue
Block a user