diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index dfa5dd17f8..59c45962a7 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -1158,8 +1158,6 @@ gtk_file_chooser_get_preview_widget_active gtk_file_chooser_set_use_preview_label gtk_file_chooser_get_use_preview_label gtk_file_chooser_get_preview_file -gtk_file_chooser_set_extra_widget -gtk_file_chooser_get_extra_widget gtk_file_chooser_add_filter gtk_file_chooser_remove_filter diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c index 25ea82ff36..bf1544509f 100644 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@ -117,32 +117,15 @@ * } * ]| * - * # Adding Extra Widgets + * # Adding options * * You can add extra widgets to a file chooser to provide options - * that are not present in the default design. For example, you - * can add a toggle button to give the user the option to open a - * file in read-only mode. You can use - * gtk_file_chooser_set_extra_widget() to insert additional - * widgets in a file chooser. - * - * An example for adding extra widgets: - * |[ - * - * GtkWidget *toggle; - * - * ... - * - * toggle = gtk_check_button_new_with_label ("Open file read-only"); - * gtk_widget_show (toggle); - * gtk_file_chooser_set_extra_widget (my_file_chooser, toggle); - * } - * ]| - * - * If you want to set more than one extra widget in the file - * chooser, you can a container such as a #GtkBox or a #GtkGrid - * and include your widgets in it. Then, set the container as - * the whole extra widget. + * that are not present in the default design, by using + * gtk_file_chooser_add_choice(). Each choice has an identifier and + * a user visible label; additionally, each choice can have multiple + * options. If a choice has no option, it will be rendered as a + * check button with the given label; if a choice has options, it will + * be rendered as a combo box. */ @@ -385,12 +368,6 @@ gtk_file_chooser_default_init (GtkFileChooserInterface *iface) P_("Whether to display a label with the name of the previewed file."), TRUE, GTK_PARAM_READWRITE)); - g_object_interface_install_property (iface, - g_param_spec_object ("extra-widget", - P_("Extra widget"), - P_("Application supplied widget for extra options."), - GTK_TYPE_WIDGET, - GTK_PARAM_READWRITE)); g_object_interface_install_property (iface, g_param_spec_boolean ("select-multiple", P_("Select Multiple"), @@ -650,10 +627,7 @@ gtk_file_chooser_set_current_name (GtkFileChooser *chooser, * text entry for “Name”. * * This is meant to be used in save dialogs, to get the currently typed filename - * when the file itself does not exist yet. For example, an application that - * adds a custom extra widget to the file chooser for “file format” may want to - * change the extension of the typed filename based on the chosen format, say, - * from “.jpg” to “.png”. + * when the file itself does not exist yet. * * Returns: The raw text from the file chooser’s “Name” entry. Free this with * g_free(). Note that this string is not a full pathname or URI; it is @@ -1107,50 +1081,6 @@ gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser, return GTK_FILE_CHOOSER_GET_IFACE (chooser)->remove_shortcut_folder (chooser, folder, error); } -/** - * gtk_file_chooser_set_extra_widget: - * @chooser: a #GtkFileChooser - * @extra_widget: widget for extra options - * - * Sets an application-supplied widget to provide extra options to the user. - **/ -void -gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser, - GtkWidget *extra_widget) -{ - g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser)); - - g_object_set (chooser, "extra-widget", extra_widget, NULL); -} - -/** - * gtk_file_chooser_get_extra_widget: - * @chooser: a #GtkFileChooser - * - * Gets the current extra widget; see - * gtk_file_chooser_set_extra_widget(). - * - * Returns: (nullable) (transfer none): the current extra widget, or %NULL - **/ -GtkWidget * -gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser) -{ - GtkWidget *extra_widget; - - g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), NULL); - - g_object_get (chooser, "extra-widget", &extra_widget, NULL); - - /* Horrid hack; g_object_get() refs returned objects but - * that contradicts the memory management conventions - * for accessors. - */ - if (extra_widget) - g_object_unref (extra_widget); - - return extra_widget; -} - /** * gtk_file_chooser_add_filter: * @chooser: a #GtkFileChooser @@ -1372,8 +1302,6 @@ gtk_file_chooser_get_do_overwrite_confirmation (GtkFileChooser *chooser) * a value using gtk_file_chooser_set_choice() before the dialog is shown, * and you can obtain the user-selected value in the ::response signal handler * using gtk_file_chooser_get_choice(). - * - * Compare gtk_file_chooser_set_extra_widget(). */ void gtk_file_chooser_add_choice (GtkFileChooser *chooser, diff --git a/gtk/gtkfilechooser.h b/gtk/gtkfilechooser.h index 98cb71545a..ea684d6715 100644 --- a/gtk/gtkfilechooser.h +++ b/gtk/gtkfilechooser.h @@ -205,14 +205,6 @@ gboolean gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser); GDK_AVAILABLE_IN_ALL GFile *gtk_file_chooser_get_preview_file (GtkFileChooser *chooser); -/* Extra widget - */ -GDK_AVAILABLE_IN_ALL -void gtk_file_chooser_set_extra_widget (GtkFileChooser *chooser, - GtkWidget *extra_widget); -GDK_AVAILABLE_IN_ALL -GtkWidget *gtk_file_chooser_get_extra_widget (GtkFileChooser *chooser); - /* List of user selectable filters */ GDK_AVAILABLE_IN_ALL diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index c14d01ead9..03e46ab791 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -925,7 +925,6 @@ gtk_file_chooser_button_set_property (GObject *object, case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE: case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL: - case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN: case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION: case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS: @@ -971,7 +970,6 @@ gtk_file_chooser_button_get_property (GObject *object, case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE: case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL: - case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE: case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN: case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION: diff --git a/gtk/gtkfilechoosernative.c b/gtk/gtkfilechoosernative.c index a722587efb..c08c84fd54 100644 --- a/gtk/gtkfilechoosernative.c +++ b/gtk/gtkfilechoosernative.c @@ -165,8 +165,6 @@ * used. It supports many of the features that #GtkFileChooserDialog * does, but there are some things it does not handle: * - * * Extra widgets added with gtk_file_chooser_set_extra_widget(). - * * * Use of custom previews by connecting to #GtkFileChooser::update-preview. * * * Any #GtkFileFilter added using a mimetype or custom filter. @@ -182,8 +180,6 @@ * be a GTK+ file chooser. In this situation, the following things are not * supported and will be silently ignored: * - * * Extra widgets added with gtk_file_chooser_set_extra_widget(). - * * * Use of custom previews by connecting to #GtkFileChooser::update-preview. * * * Any #GtkFileFilter added with a custom filter. @@ -194,10 +190,6 @@ * file chooser dialogs. Some features provided by #GtkFileChooserDialog are * not supported: * - * * Extra widgets added with gtk_file_chooser_set_extra_widget(), unless the - * widget is an instance of GtkLabel, in which case the label text will be used - * to set the NSSavePanel message instance property. - * * * Use of custom previews by connecting to #GtkFileChooser::update-preview. * * * Any #GtkFileFilter added with a custom filter. diff --git a/gtk/gtkfilechoosernativequartz.c b/gtk/gtkfilechoosernativequartz.c index 89fad7b3af..cb2e071a26 100644 --- a/gtk/gtkfilechoosernativequartz.c +++ b/gtk/gtkfilechoosernativequartz.c @@ -448,19 +448,8 @@ gtk_file_chooser_native_quartz_show (GtkFileChooserNative *self) guint update_preview_signal; GSList *filters, *l; int n_filters, i; - GtkWidget *extra_widget = NULL; char *message = NULL; - extra_widget = gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (self)); - // if the extra_widget is a GtkLabel, then use its text to set the dialog message - if (extra_widget != NULL) - { - if (!GTK_IS_LABEL (extra_widget)) - return FALSE; - else - message = g_strdup (gtk_label_get_text (GTK_LABEL (extra_widget))); - } - update_preview_signal = g_signal_lookup ("update-preview", GTK_TYPE_FILE_CHOOSER); if (g_signal_has_handler_pending (self, update_preview_signal, 0, TRUE)) return FALSE; diff --git a/gtk/gtkfilechoosernativewin32.c b/gtk/gtkfilechoosernativewin32.c index e1534a5696..c368f84269 100644 --- a/gtk/gtkfilechoosernativewin32.c +++ b/gtk/gtkfilechoosernativewin32.c @@ -877,10 +877,6 @@ gtk_file_chooser_native_win32_show (GtkFileChooserNative *self) GSList *filters, *l; int n_filters, i; - if (gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (self)) != NULL && - self->choices == NULL) - return FALSE; - update_preview_signal = g_signal_lookup ("update-preview", GTK_TYPE_FILE_CHOOSER); if (g_signal_has_handler_pending (self, update_preview_signal, 0, TRUE)) return FALSE; diff --git a/gtk/gtkfilechooserutils.c b/gtk/gtkfilechooserutils.c index fe71729933..7d39368729 100644 --- a/gtk/gtkfilechooserutils.c +++ b/gtk/gtkfilechooserutils.c @@ -99,9 +99,6 @@ _gtk_file_chooser_install_properties (GObjectClass *klass) g_object_class_override_property (klass, GTK_FILE_CHOOSER_PROP_ACTION, "action"); - g_object_class_override_property (klass, - GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET, - "extra-widget"); g_object_class_override_property (klass, GTK_FILE_CHOOSER_PROP_FILTER, "filter"); diff --git a/gtk/gtkfilechooserutils.h b/gtk/gtkfilechooserutils.h index 6938791515..9a4e4cbb14 100644 --- a/gtk/gtkfilechooserutils.h +++ b/gtk/gtkfilechooserutils.h @@ -34,7 +34,6 @@ typedef enum { GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET, GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE, GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL, - GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET, GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE, GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN, GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION, diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 832f9d04c2..225c502ba3 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -3315,10 +3315,6 @@ gtk_file_chooser_widget_set_property (GObject *object, update_preview_widget_visibility (impl); break; - case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: - set_extra_widget (impl, g_value_get_object (value)); - break; - case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE: { gboolean select_multiple = g_value_get_boolean (value); @@ -3405,10 +3401,6 @@ gtk_file_chooser_widget_get_property (GObject *object, g_value_set_boolean (value, priv->use_preview_label); break; - case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: - g_value_set_object (value, priv->extra_widget); - break; - case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE: g_value_set_boolean (value, priv->select_multiple); break; diff --git a/tests/testgtk.c b/tests/testgtk.c index 6c65009cfc..98ee51798c 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -5786,25 +5786,6 @@ native_overwrite_confirmation_toggle (GtkWidget *checkbutton, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(checkbutton))); } -static void -native_extra_widget_toggle (GtkWidget *checkbutton, - GtkFileChooserNative *native) -{ - gboolean extra_widget = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(checkbutton)); - - if (extra_widget) - { - GtkWidget *extra = gtk_check_button_new_with_label ("Extra toggle"); - gtk_widget_show (extra); - gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (native), extra); - } - else - { - gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (native), NULL); - } -} - - static void native_visible_notify_show (GObject *object, GParamSpec *pspec, @@ -6028,11 +6009,6 @@ create_native_dialogs (GtkWidget *widget) G_CALLBACK (native_overwrite_confirmation_toggle), native); gtk_container_add (GTK_CONTAINER (box), check_button); - check_button = gtk_check_button_new_with_label ("Extra widget"); - g_signal_connect (check_button, "toggled", - G_CALLBACK (native_extra_widget_toggle), native); - gtk_container_add (GTK_CONTAINER (box), check_button); - show_button = gtk_button_new_with_label ("Show"); hide_button = gtk_button_new_with_label ("Hide"); gtk_widget_set_sensitive (hide_button, FALSE);