[gtk/matthiasc/for-master] filechooserdialog: Stop using the embed interface



commit b8e44ae821de197c404e13a0f59607885217a253
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jul 12 10:34:27 2020 -0400

    filechooserdialog: Stop using the embed interface
    
    Just call private GtkFileChooserWidget api. There
    is no real justification for diverting this through
    an extra interface.

 gtk/gtkfilechooserdialog.c        |  5 ++---
 gtk/gtkfilechooserwidget.c        | 27 +++++----------------------
 gtk/gtkfilechooserwidgetprivate.h |  6 ++++++
 3 files changed, 13 insertions(+), 25 deletions(-)
---
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index a7bc1dd15f..794d6de29c 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -25,7 +25,6 @@
 #include "gtkfilechooserwidget.h"
 #include "gtkfilechooserwidgetprivate.h"
 #include "gtkfilechooserutils.h"
-#include "gtkfilechooserembed.h"
 #include "gtkfilesystem.h"
 #include "gtksizerequest.h"
 #include "gtktypebuiltins.h"
@@ -607,7 +606,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);
 }
@@ -671,7 +670,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");
     }
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 904ac0129a..4f304766df 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -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"
@@ -391,7 +390,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);
@@ -445,9 +443,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,
@@ -551,9 +546,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)
@@ -580,13 +573,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)
 {
@@ -6131,10 +6117,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;
@@ -6376,11 +6361,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 ||
diff --git a/gtk/gtkfilechooserwidgetprivate.h b/gtk/gtkfilechooserwidgetprivate.h
index 2c00f6ff8a..07b0ce3897 100644
--- a/gtk/gtkfilechooserwidgetprivate.h
+++ b/gtk/gtkfilechooserwidgetprivate.h
@@ -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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]