libgimpwidgets/gimppropwidgets.[ch] added new function
2006-12-18 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimppropwidgets.[ch] * libgimpwidgets/gimpwidgets.def: added new function gimp_prop_file_chooser_button_new_with_dialog().
This commit is contained in:

committed by
Sven Neumann

parent
e81dfcf5e7
commit
988e1a442d
@ -1,3 +1,9 @@
|
|||||||
|
2006-12-18 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpwidgets/gimppropwidgets.[ch]
|
||||||
|
* libgimpwidgets/gimpwidgets.def: added new function
|
||||||
|
gimp_prop_file_chooser_button_new_with_dialog().
|
||||||
|
|
||||||
2006-12-16 Mukund Sivaraman <muks@mukund.org>
|
2006-12-16 Mukund Sivaraman <muks@mukund.org>
|
||||||
|
|
||||||
* app/core/gimp-transform-resize.c: Fixed code in
|
* app/core/gimp-transform-resize.c: Fixed code in
|
||||||
|
@ -1925,11 +1925,15 @@ gimp_prop_text_buffer_notify (GObject *config,
|
|||||||
/*************************/
|
/*************************/
|
||||||
|
|
||||||
|
|
||||||
static void gimp_prop_file_chooser_button_callback (GtkFileChooser *button,
|
static GtkWidget * gimp_prop_file_chooser_button_setup (GtkWidget *button,
|
||||||
GObject *config);
|
GObject *config,
|
||||||
static void gimp_prop_file_chooser_button_notify (GObject *config,
|
GParamSpec *param_spec);
|
||||||
GParamSpec *param_spec,
|
static void gimp_prop_file_chooser_button_callback (GtkFileChooser *button,
|
||||||
GtkFileChooser *button);
|
GObject *config);
|
||||||
|
static void gimp_prop_file_chooser_button_notify (GObject *config,
|
||||||
|
GParamSpec *param_spec,
|
||||||
|
GtkFileChooser *button);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_prop_file_chooser_button_new:
|
* gimp_prop_file_chooser_button_new:
|
||||||
@ -1955,9 +1959,6 @@ gimp_prop_file_chooser_button_new (GObject *config,
|
|||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *widget;
|
|
||||||
gchar *filename;
|
|
||||||
gchar *value;
|
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
||||||
g_return_val_if_fail (property_name != NULL, NULL);
|
g_return_val_if_fail (property_name != NULL, NULL);
|
||||||
@ -1967,15 +1968,79 @@ gimp_prop_file_chooser_button_new (GObject *config,
|
|||||||
if (! param_spec)
|
if (! param_spec)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
button = gtk_file_chooser_button_new (title, action);
|
||||||
|
|
||||||
|
return gimp_prop_file_chooser_button_setup (button, config, param_spec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_prop_file_chooser_button_new_with_dialog:
|
||||||
|
* @config: object to which property is attached.
|
||||||
|
* @property_name: name of path property.
|
||||||
|
* @dialog: the #GtkFileChooserDialog widget to use.
|
||||||
|
*
|
||||||
|
* Creates a #GtkFileChooserButton to edit the specified path property.
|
||||||
|
*
|
||||||
|
* The button uses @dialog as it's file-picking window. Note that @dialog
|
||||||
|
* must be a #GtkFileChooserDialog (or subclass) and must not have
|
||||||
|
* %GTK_DIALOG_DESTROY_WITH_PARENT set.
|
||||||
|
*
|
||||||
|
* Note that #GtkFileChooserButton implements the #GtkFileChooser
|
||||||
|
* interface; you can use the #GtkFileChooser API with it.
|
||||||
|
*
|
||||||
|
* Return value: A new #GtkFileChooserButton.
|
||||||
|
*
|
||||||
|
* Since GIMP 2.4
|
||||||
|
*/
|
||||||
|
GtkWidget *
|
||||||
|
gimp_prop_file_chooser_button_new_with_dialog (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
GtkWidget *dialog)
|
||||||
|
{
|
||||||
|
GParamSpec *param_spec;
|
||||||
|
GtkWidget *button;
|
||||||
|
gchar *title;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
|
||||||
|
g_return_val_if_fail (property_name != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GTK_IS_FILE_CHOOSER_DIALOG (dialog), NULL);
|
||||||
|
|
||||||
|
param_spec = check_param_spec (config, property_name,
|
||||||
|
GIMP_TYPE_PARAM_CONFIG_PATH, G_STRFUNC);
|
||||||
|
if (! param_spec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* work around bug in GtkFileChooserButton */
|
||||||
|
title = g_strdup (gtk_window_get_title (GTK_WINDOW (dialog)));
|
||||||
|
|
||||||
|
button = gtk_file_chooser_button_new_with_dialog (dialog);
|
||||||
|
|
||||||
|
if (title)
|
||||||
|
{
|
||||||
|
gtk_file_chooser_button_set_title (GTK_FILE_CHOOSER_BUTTON (button),
|
||||||
|
title);
|
||||||
|
g_free (title);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gimp_prop_file_chooser_button_setup (button, config, param_spec);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GtkWidget *
|
||||||
|
gimp_prop_file_chooser_button_setup (GtkWidget *button,
|
||||||
|
GObject *config,
|
||||||
|
GParamSpec *param_spec)
|
||||||
|
{
|
||||||
|
GtkWidget *widget;
|
||||||
|
gchar *value;
|
||||||
|
gchar *filename;
|
||||||
|
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
property_name, &value,
|
param_spec->name, &value,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
filename = value ? gimp_config_path_expand (value, TRUE, NULL) : NULL;
|
filename = value ? gimp_config_path_expand (value, TRUE, NULL) : NULL;
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
|
||||||
button = gtk_file_chooser_button_new (title, action);
|
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (button), filename);
|
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (button), filename);
|
||||||
@ -2000,7 +2065,7 @@ gimp_prop_file_chooser_button_new (GObject *config,
|
|||||||
G_CALLBACK (gimp_prop_file_chooser_button_callback),
|
G_CALLBACK (gimp_prop_file_chooser_button_callback),
|
||||||
config);
|
config);
|
||||||
|
|
||||||
connect_notify (config, property_name,
|
connect_notify (config, param_spec->name,
|
||||||
G_CALLBACK (gimp_prop_file_chooser_button_notify),
|
G_CALLBACK (gimp_prop_file_chooser_button_notify),
|
||||||
button);
|
button);
|
||||||
|
|
||||||
|
@ -144,6 +144,10 @@ GtkWidget * gimp_prop_file_chooser_button_new (GObject *config,
|
|||||||
const gchar *property_name,
|
const gchar *property_name,
|
||||||
const gchar *title,
|
const gchar *title,
|
||||||
GtkFileChooserAction action);
|
GtkFileChooserAction action);
|
||||||
|
GtkWidget * gimp_prop_file_chooser_button_new_with_dialog (GObject *config,
|
||||||
|
const gchar *property_name,
|
||||||
|
|
||||||
|
GtkWidget *dialog);
|
||||||
GtkWidget * gimp_prop_path_editor_new (GObject *config,
|
GtkWidget * gimp_prop_path_editor_new (GObject *config,
|
||||||
const gchar *path_property_name,
|
const gchar *path_property_name,
|
||||||
const gchar *writable_property_name,
|
const gchar *writable_property_name,
|
||||||
|
@ -243,6 +243,7 @@ EXPORTS
|
|||||||
gimp_prop_enum_stock_box_new
|
gimp_prop_enum_stock_box_new
|
||||||
gimp_prop_expander_new
|
gimp_prop_expander_new
|
||||||
gimp_prop_file_chooser_button_new
|
gimp_prop_file_chooser_button_new
|
||||||
|
gimp_prop_file_chooser_button_new_with_dialog
|
||||||
gimp_prop_hscale_new
|
gimp_prop_hscale_new
|
||||||
gimp_prop_int_combo_box_new
|
gimp_prop_int_combo_box_new
|
||||||
gimp_prop_label_new
|
gimp_prop_label_new
|
||||||
|
Reference in New Issue
Block a user