filechooserdialog: Stop using the embed interface

Just call private GtkFileChooserWidget api. There
is no real justification for diverting this through
an extra interface.
This commit is contained in:
Matthias Clasen 2020-07-12 10:34:27 -04:00
parent d8abcdb5a1
commit 2e6b8810c0
3 changed files with 13 additions and 25 deletions

View File

@ -25,7 +25,6 @@
#include "gtkfilechooserwidget.h"
#include "gtkfilechooserwidgetprivate.h"
#include "gtkfilechooserutils.h"
#include "gtkfilechooserembed.h"
#include "gtksizerequest.h"
#include "gtktypebuiltins.h"
#include "gtkintl.h"
@ -606,7 +605,7 @@ gtk_file_chooser_dialog_map (GtkWidget *widget)
setup_save_entry (dialog);
ensure_default_response (dialog);
_gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
gtk_file_chooser_widget_initial_focus (GTK_FILE_CHOOSER_WIDGET (priv->widget));
GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->map (widget);
}
@ -670,7 +669,7 @@ response_cb (GtkDialog *dialog,
/* Act only on response IDs we recognize */
if (is_accept_response_id (response_id) &&
!priv->response_requested &&
!_gtk_file_chooser_embed_should_respond (GTK_FILE_CHOOSER_EMBED (priv->widget)))
!gtk_file_chooser_widget_should_respond (GTK_FILE_CHOOSER_WIDGET (priv->widget)))
{
g_signal_stop_emission_by_name (dialog, "response");
}

View File

@ -34,7 +34,6 @@
#include "gtkentry.h"
#include "gtkfilechooserprivate.h"
#include "gtkfilechooserdialog.h"
#include "gtkfilechooserembed.h"
#include "gtkfilechooserentry.h"
#include "gtkfilechooserutils.h"
#include "gtkfilechooser.h"
@ -388,7 +387,6 @@ enum {
#define ICON_SIZE 16
static void gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface);
static void gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface);
static void gtk_file_chooser_widget_constructed (GObject *object);
static void gtk_file_chooser_widget_finalize (GObject *object);
@ -441,9 +439,6 @@ static gboolean gtk_file_chooser_widget_remove_shortcut_folder (GtkFileCho
GError **error);
static GListModel * gtk_file_chooser_widget_get_shortcut_folders (GtkFileChooser *chooser);
static gboolean gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed);
static void gtk_file_chooser_widget_initial_focus (GtkFileChooserEmbed *chooser_embed);
static void gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser,
const char *id,
const char *label,
@ -547,9 +542,7 @@ static void set_show_hidden (GtkFileChooserWidget *impl,
G_DEFINE_TYPE_WITH_CODE (GtkFileChooserWidget, gtk_file_chooser_widget, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER,
gtk_file_chooser_widget_iface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER_EMBED,
gtk_file_chooser_embed_default_iface_init));
gtk_file_chooser_widget_iface_init))
static void
gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface)
@ -575,13 +568,6 @@ gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface)
iface->get_choice = gtk_file_chooser_widget_get_choice;
}
static void
gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface)
{
iface->should_respond = gtk_file_chooser_widget_should_respond;
iface->initial_focus = gtk_file_chooser_widget_initial_focus;
}
static void
pending_select_files_free (GtkFileChooserWidget *impl)
{
@ -6117,10 +6103,9 @@ add_selection_to_recent_list (GtkFileChooserWidget *impl)
g_object_unref (files);
}
static gboolean
gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
gboolean
gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *impl)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed);
GtkWidget *toplevel;
GtkWidget *current_focus;
gboolean retval;
@ -6366,11 +6351,9 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed)
return retval;
}
/* Implementation for GtkFileChooserEmbed::initial_focus() */
static void
gtk_file_chooser_widget_initial_focus (GtkFileChooserEmbed *chooser_embed)
void
gtk_file_chooser_widget_initial_focus (GtkFileChooserWidget *impl)
{
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed);
GtkWidget *widget;
if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||

View File

@ -30,6 +30,12 @@ void
gtk_file_chooser_widget_set_save_entry (GtkFileChooserWidget *chooser,
GtkWidget *entry);
gboolean
gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *chooser);
void
gtk_file_chooser_widget_initial_focus (GtkFileChooserWidget *chooser);
G_END_DECLS
#endif /* __GTK_FILE_CHOOSER_WIDGET_PRIVATE_H__ */