deprecate the GimpFileEntry widget, use GtkFileChooserButton instead.

2006-06-09  Sven Neumann  <sven@gimp.org>

	* 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.
This commit is contained in:
Sven Neumann 2006-06-09 07:12:33 +00:00 committed by Sven Neumann
parent 303150eee5
commit 99f979e118
6 changed files with 29 additions and 146 deletions

View File

@ -1,3 +1,15 @@
2006-06-09 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org>
* app/batch.c (batch_run_cmd): formatting.

View File

@ -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.
**/

View File

@ -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 */

View File

@ -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"

View File

@ -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,

View File

@ -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 */