libgimpwidgets: GimpFileEntry is not public anymore.

The whole widget was made deprecated in 2006 (commit 99f979e118) but it
is still being used by another widget. Since we can break API, I at
least hide the functions and type by making these private.

This will give us time to think if we really need this widget (or a
nicer implementation for this widget) or if we just want to get rid of
it.
This commit is contained in:
Jehan 2024-10-31 19:51:15 +01:00
parent 173d7640b7
commit 724e317272
6 changed files with 48 additions and 45 deletions

View file

@ -55,7 +55,7 @@
* case the filename listbox of the #GtkFileChooser dialog will be
* set to directory mode.
*
* If you specify @check_valid as %TRUE in gimp_file_entry_new() the
* If you specify @check_valid as %TRUE in _gimp_file_entry_new() the
* entered filename will be checked for validity and a pixmap will be
* shown which indicates if the file exists or not.
*
@ -102,15 +102,15 @@ static void gimp_file_entry_browse_clicked (GtkWidget *widget,
static void gimp_file_entry_check_filename (GimpFileEntry *entry);
G_DEFINE_TYPE (GimpFileEntry, gimp_file_entry, GTK_TYPE_BOX)
G_DEFINE_TYPE (GimpFileEntry, _gimp_file_entry, GTK_TYPE_BOX)
#define parent_class gimp_file_entry_parent_class
#define parent_class _gimp_file_entry_parent_class
static guint gimp_file_entry_signals[LAST_SIGNAL] = { 0 };
static void
gimp_file_entry_class_init (GimpFileEntryClass *klass)
_gimp_file_entry_class_init (GimpFileEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@ -131,7 +131,7 @@ gimp_file_entry_class_init (GimpFileEntryClass *klass)
}
static void
gimp_file_entry_init (GimpFileEntry *entry)
_gimp_file_entry_init (GimpFileEntry *entry)
{
GtkWidget *image;
GtkWidget *button;
@ -207,7 +207,7 @@ gimp_file_entry_dispose (GObject *object)
}
/**
* gimp_file_entry_new:
* _gimp_file_entry_new:
* @title: The title of the #GimpFileEntry dialog.
* @filename: The initial filename.
* @dir_only: %TRUE if the file entry should accept directories only.
@ -219,10 +219,10 @@ gimp_file_entry_dispose (GObject *object)
* Returns: A pointer to the new #GimpFileEntry widget.
**/
GtkWidget *
gimp_file_entry_new (const gchar *title,
const gchar *filename,
gboolean dir_only,
gboolean check_valid)
_gimp_file_entry_new (const gchar *title,
const gchar *filename,
gboolean dir_only,
gboolean check_valid)
{
GimpFileEntry *entry;
@ -252,13 +252,13 @@ gimp_file_entry_new (const gchar *title,
NULL);
}
gimp_file_entry_set_filename (entry, filename);
_gimp_file_entry_set_filename (entry, filename);
return GTK_WIDGET (entry);
}
/**
* gimp_file_entry_get_filename:
* _gimp_file_entry_get_filename:
* @entry: The file entry you want to know the filename from.
*
* Note that you have to g_free() the returned string.
@ -266,7 +266,7 @@ gimp_file_entry_new (const gchar *title,
* Returns: The file or directory the user has entered.
**/
gchar *
gimp_file_entry_get_filename (GimpFileEntry *entry)
_gimp_file_entry_get_filename (GimpFileEntry *entry)
{
gchar *utf8;
gchar *filename;
@ -283,17 +283,17 @@ gimp_file_entry_get_filename (GimpFileEntry *entry)
}
/**
* gimp_file_entry_set_filename:
* _gimp_file_entry_set_filename:
* @entry: The file entry you want to set the filename for.
* @filename: The new filename.
*
* If you specified @check_valid as %TRUE in gimp_file_entry_new()
* If you specified @check_valid as %TRUE in _gimp_file_entry_new()
* the #GimpFileEntry will immediately check the validity of the file
* name.
**/
void
gimp_file_entry_set_filename (GimpFileEntry *entry,
const gchar *filename)
_gimp_file_entry_set_filename (GimpFileEntry *entry,
const gchar *filename)
{
gchar *utf8;
@ -313,7 +313,7 @@ gimp_file_entry_set_filename (GimpFileEntry *entry,
}
/**
* gimp_file_entry_get_entry:
* _gimp_file_entry_get_entry:
* @entry: The #GimpFileEntry.
*
* Returns: (transfer none): the #GtkEntry internally used by the
@ -321,7 +321,7 @@ gimp_file_entry_set_filename (GimpFileEntry *entry,
* freed.
**/
GtkWidget *
gimp_file_entry_get_entry (GimpFileEntry *entry)
_gimp_file_entry_get_entry (GimpFileEntry *entry)
{
return entry->entry;
}
@ -403,7 +403,7 @@ gimp_file_entry_chooser_response (GtkWidget *dialog,
gchar *filename;
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
gimp_file_entry_set_filename (entry, filename);
_gimp_file_entry_set_filename (entry, filename);
g_free (filename);
}

View file

@ -32,21 +32,31 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
/* The whole GimpFileEntry widget was deprecated in 2006 (commit
* 99f979e1189) apparently to be replaced by GtkFileChooserButton, yet
* it is still used in the GimpPathEditor. For GIMP 3.0, we removed the
* header from installed headers and made the class and all functions
* internal, though we still use it.
*
* TODO: eventually we want either this widget fully removed and
* replaced by a generic GTK widget or reimplemented and made public
* again.
*/
#define GIMP_TYPE_FILE_ENTRY (gimp_file_entry_get_type ())
G_DECLARE_FINAL_TYPE (GimpFileEntry, gimp_file_entry, GIMP, FILE_ENTRY, GtkBox)
#define GIMP_TYPE_FILE_ENTRY (_gimp_file_entry_get_type ())
G_DECLARE_FINAL_TYPE (GimpFileEntry, _gimp_file_entry, GIMP, FILE_ENTRY, GtkBox)
GtkWidget * gimp_file_entry_new (const gchar *title,
const gchar *filename,
gboolean dir_only,
gboolean check_valid);
G_GNUC_INTERNAL GtkWidget * _gimp_file_entry_new (const gchar *title,
const gchar *filename,
gboolean dir_only,
gboolean check_valid);
gchar * gimp_file_entry_get_filename (GimpFileEntry *entry);
void gimp_file_entry_set_filename (GimpFileEntry *entry,
const gchar *filename);
G_GNUC_INTERNAL gchar * _gimp_file_entry_get_filename (GimpFileEntry *entry);
G_GNUC_INTERNAL void _gimp_file_entry_set_filename (GimpFileEntry *entry,
const gchar *filename);
GtkWidget * gimp_file_entry_get_entry (GimpFileEntry *entry);
G_GNUC_INTERNAL GtkWidget * _gimp_file_entry_get_entry (GimpFileEntry *entry);
G_END_DECLS

View file

@ -323,7 +323,7 @@ gimp_path_editor_new (const gchar *title,
editor = g_object_new (GIMP_TYPE_PATH_EDITOR, NULL);
editor->file_entry = gimp_file_entry_new (title, "", TRUE, TRUE);
editor->file_entry = _gimp_file_entry_new (title, "", TRUE, TRUE);
gtk_widget_set_sensitive (editor->file_entry, FALSE);
gtk_box_pack_start (GTK_BOX (editor->upper_hbox), editor->file_entry,
TRUE, TRUE, 0);
@ -643,9 +643,9 @@ gimp_path_editor_new_clicked (GtkWidget *widget,
gtk_widget_set_sensitive (editor->file_entry, TRUE);
gtk_editable_set_position
(GTK_EDITABLE (gimp_file_entry_get_entry (GIMP_FILE_ENTRY (editor->file_entry))), -1);
(GTK_EDITABLE (_gimp_file_entry_get_entry (GIMP_FILE_ENTRY (editor->file_entry))), -1);
gtk_widget_grab_focus
(gimp_file_entry_get_entry (GIMP_FILE_ENTRY (editor->file_entry)));
(_gimp_file_entry_get_entry (GIMP_FILE_ENTRY (editor->file_entry)));
}
static void
@ -737,7 +737,7 @@ gimp_path_editor_delete_clicked (GtkWidget *widget,
gimp_path_editor_file_entry_changed,
editor);
gimp_file_entry_set_filename (GIMP_FILE_ENTRY (editor->file_entry), "");
_gimp_file_entry_set_filename (GIMP_FILE_ENTRY (editor->file_entry), "");
g_signal_handlers_unblock_by_func (editor->file_entry,
gimp_path_editor_file_entry_changed,
@ -773,7 +773,7 @@ gimp_path_editor_file_entry_changed (GtkWidget *widget,
gchar *utf8;
GtkTreeIter iter;
dir = gimp_file_entry_get_filename (GIMP_FILE_ENTRY (widget));
dir = _gimp_file_entry_get_filename (GIMP_FILE_ENTRY (widget));
if (strcmp (dir, "") == 0)
{
g_free (dir);
@ -828,8 +828,8 @@ gimp_path_editor_selection_changed (GtkTreeSelection *sel,
gimp_path_editor_file_entry_changed,
editor);
gimp_file_entry_set_filename (GIMP_FILE_ENTRY (editor->file_entry),
directory);
_gimp_file_entry_set_filename (GIMP_FILE_ENTRY (editor->file_entry),
directory);
g_signal_handlers_unblock_by_func (editor->file_entry,
gimp_path_editor_file_entry_changed,

View file

@ -194,11 +194,6 @@ EXPORTS
gimp_enum_store_new_with_values_valist
gimp_enum_store_set_icon_prefix
gimp_event_triggers_context_menu
gimp_file_entry_get_entry
gimp_file_entry_get_filename
gimp_file_entry_get_type
gimp_file_entry_new
gimp_file_entry_set_filename
gimp_float_adjustment_update
gimp_frame_get_type
gimp_frame_new

View file

@ -54,7 +54,6 @@
#include <libgimpwidgets/gimpenumlabel.h>
#include <libgimpwidgets/gimpenumstore.h>
#include <libgimpwidgets/gimpenumwidgets.h>
#include <libgimpwidgets/gimpfileentry.h>
#include <libgimpwidgets/gimpframe.h>
#include <libgimpwidgets/gimphelpui.h>
#include <libgimpwidgets/gimphintbox.h>

View file

@ -51,7 +51,6 @@ libgimpwidgets_sources_introspectable = files(
'gimpenumlabel.c',
'gimpenumstore.c',
'gimpenumwidgets.c',
'gimpfileentry.c',
'gimpframe.c',
'gimphelpui.c',
'gimphintbox.c',
@ -96,6 +95,7 @@ libgimpwidgets_sources = [
'gimpcolorselect.c',
'gimpcontroller.c',
'gimpeevl.c',
'gimpfileentry.c',
'gimpwidgets-private.c',
'gimpwidgetsenums.c',
@ -134,7 +134,6 @@ libgimpwidgets_headers_introspectable = files(
'gimpenumlabel.h',
'gimpenumstore.h',
'gimpenumwidgets.h',
'gimpfileentry.h',
'gimpframe.h',
'gimphelpui.h',
'gimphintbox.h',