diff --git a/ChangeLog b/ChangeLog index 67e39debe8..fbb8242d9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-06-09 Sven Neumann + + * libgimpwidgets/gimpfileentry.[ch]: deprecate the GimpFileEntry + widget, use GtkFileChooserButton instead. + + * libgimpwidgets/gimppatheditor.c: undef GIMP_DISABLE_DEPRECATED + as long as we are still using GimpFileEntry here. + + * libgimpwidgets/gimppropwidgets.[ch]: removed + gimp_prop_file_entry_new(); use gimp_prop_file_chooser_button_new() + instead. + 2006-06-09 Sven Neumann * app/batch.c (batch_run_cmd): formatting. diff --git a/libgimpwidgets/gimpfileentry.c b/libgimpwidgets/gimpfileentry.c index d2a805c18f..05a9de0e41 100644 --- a/libgimpwidgets/gimpfileentry.c +++ b/libgimpwidgets/gimpfileentry.c @@ -28,7 +28,9 @@ #include "gimpwidgetstypes.h" +#undef GIMP_DISABLE_DEPRECATED #include "gimpfileentry.h" + #include "gimphelpui.h" #include "libgimp/libgimp-intl.h" @@ -149,7 +151,7 @@ gimp_file_entry_destroy (GtkObject *object) * @check_valid: %TRUE if the widget should check if the entered file * really exists. * - * Creates a new #GimpFileEntry widget. + * You should use #GtkFileChooserButton instead. * * Returns: A pointer to the new #GimpFileEntry widget. **/ diff --git a/libgimpwidgets/gimpfileentry.h b/libgimpwidgets/gimpfileentry.h index fcf7a93635..b1a2506dc3 100644 --- a/libgimpwidgets/gimpfileentry.h +++ b/libgimpwidgets/gimpfileentry.h @@ -20,6 +20,8 @@ * Boston, MA 02111-1307, USA. */ +#ifndef GIMP_DISABLE_DEPRECATED + #ifndef __GIMP_FILE_ENTRY_H__ #define __GIMP_FILE_ENTRY_H__ @@ -82,3 +84,5 @@ void gimp_file_entry_set_filename (GimpFileEntry *entry, G_END_DECLS #endif /* __GIMP_FILE_ENTRY_H__ */ + +#endif /* GIMP_DISABLE_DEPRECATED */ diff --git a/libgimpwidgets/gimppatheditor.c b/libgimpwidgets/gimppatheditor.c index d9335daef2..75dd735b7d 100644 --- a/libgimpwidgets/gimppatheditor.c +++ b/libgimpwidgets/gimppatheditor.c @@ -30,9 +30,11 @@ #include "gimpwidgetstypes.h" -#include "gimppatheditor.h" +#undef GIMP_DISABLE_DEPRECATED #include "gimpfileentry.h" +#include "gimppatheditor.h" + #include "libgimp/libgimp-intl.h" diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c index e265412c1d..cb54d725e6 100644 --- a/libgimpwidgets/gimppropwidgets.c +++ b/libgimpwidgets/gimppropwidgets.c @@ -1920,140 +1920,9 @@ gimp_prop_text_buffer_notify (GObject *config, } -/****************/ -/* file entry */ -/****************/ - - -static void gimp_prop_file_entry_callback (GimpFileEntry *entry, - GObject *config); -static void gimp_prop_file_entry_notify (GObject *config, - GParamSpec *param_spec, - GimpFileEntry *entry); - -/** - * gimp_prop_file_entry_new: - * @config: Object to which property is attached. - * @property_name: Name of Path property. - * @filesel_title: Label for the file selector. - * @dir_only: %TRUE if the file entry should accept directories only. - * @check_valid: %TRUE if the widget should check if the entered file - * really exists. - * - * Creates a #GimpFileEntry to set and display the specified Path property. - * - * Return value: A new #GimpFileEntry widget. - * - * Since GIMP 2.4 - */ -GtkWidget * -gimp_prop_file_entry_new (GObject *config, - const gchar *property_name, - const gchar *filesel_title, - gboolean dir_only, - gboolean check_valid) -{ - GParamSpec *param_spec; - GtkWidget *entry; - gchar *filename; - gchar *value; - - g_return_val_if_fail (G_IS_OBJECT (config), NULL); - g_return_val_if_fail (property_name != NULL, NULL); - - param_spec = check_param_spec (config, property_name, - GIMP_TYPE_PARAM_CONFIG_PATH, G_STRFUNC); - if (! param_spec) - return NULL; - - g_object_get (config, - property_name, &value, - NULL); - - filename = value ? gimp_config_path_expand (value, TRUE, NULL) : NULL; - g_free (value); - - entry = gimp_file_entry_new (filesel_title, filename, dir_only, check_valid); - g_free (filename); - - set_param_spec (G_OBJECT (entry), - GIMP_FILE_ENTRY (entry)->entry, - param_spec); - - g_signal_connect (entry, "filename-changed", - G_CALLBACK (gimp_prop_file_entry_callback), - config); - - connect_notify (config, property_name, - G_CALLBACK (gimp_prop_file_entry_notify), - entry); - - return entry; -} - -static void -gimp_prop_file_entry_callback (GimpFileEntry *entry, - GObject *config) -{ - GParamSpec *param_spec; - gchar *value; - gchar *utf8; - - param_spec = get_param_spec (G_OBJECT (entry)); - if (! param_spec) - return; - - value = gimp_file_entry_get_filename (entry); - utf8 = g_filename_to_utf8 (value, -1, NULL, NULL, NULL); - g_free (value); - - g_signal_handlers_block_by_func (config, - gimp_prop_file_entry_notify, - entry); - - g_object_set (config, - param_spec->name, utf8, - NULL); - - g_signal_handlers_block_by_func (config, - gimp_prop_file_entry_notify, - entry); - - g_free (utf8); -} - -static void -gimp_prop_file_entry_notify (GObject *config, - GParamSpec *param_spec, - GimpFileEntry *entry) -{ - gchar *value; - gchar *filename; - - g_object_get (config, - param_spec->name, &value, - NULL); - - filename = value ? gimp_config_path_expand (value, TRUE, NULL) : NULL; - g_free (value); - - g_signal_handlers_block_by_func (entry, - gimp_prop_file_entry_callback, - config); - - gimp_file_entry_set_filename (entry, filename); - - g_signal_handlers_unblock_by_func (entry, - gimp_prop_file_entry_callback, - config); - - g_free (filename); -} - - -/*****************/ -/* file button */ -/*****************/ +/*************************/ +/* file chooser button */ +/*************************/ static void gimp_prop_file_chooser_button_callback (GtkFileChooser *button, diff --git a/libgimpwidgets/gimppropwidgets.h b/libgimpwidgets/gimppropwidgets.h index 7c697a8dc3..a4228eb7f6 100644 --- a/libgimpwidgets/gimppropwidgets.h +++ b/libgimpwidgets/gimppropwidgets.h @@ -140,20 +140,14 @@ GtkTextBuffer * gimp_prop_text_buffer_new (GObject *config, /* GimpParamPath */ -GtkWidget * gimp_prop_file_entry_new (GObject *config, - const gchar *property_name, - const gchar *filesel_title, - gboolean dir_only, - gboolean check_valid); -GtkWidget * gimp_prop_path_editor_new (GObject *config, - const gchar *path_property_name, - const gchar *writable_property_name, - const gchar *filesel_title); - GtkWidget * gimp_prop_file_chooser_button_new (GObject *config, const gchar *property_name, const gchar *title, GtkFileChooserAction action); +GtkWidget * gimp_prop_path_editor_new (GObject *config, + const gchar *path_property_name, + const gchar *writable_property_name, + const gchar *filesel_title); /* GParamInt, GParamUInt, GParamDouble unit: GimpParamUnit */