forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!2231
This commit is contained in:
commit
78a59c95fe
@ -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"
|
||||
@ -264,8 +263,9 @@ static void gtk_file_chooser_dialog_size_allocate (GtkWidget *wid
|
||||
int width,
|
||||
int height,
|
||||
int baseline);
|
||||
static void file_chooser_widget_response_requested (GtkWidget *widget,
|
||||
GtkFileChooserDialog *dialog);
|
||||
static void gtk_file_chooser_dialog_activate_response (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
GVariant *parameters);
|
||||
|
||||
static void response_cb (GtkDialog *dialog,
|
||||
gint response_id);
|
||||
@ -305,7 +305,8 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserDialog, widget);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserDialog, buttons);
|
||||
gtk_widget_class_bind_template_callback (widget_class, response_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, file_chooser_widget_response_requested);
|
||||
|
||||
gtk_widget_class_install_action (widget_class, "response.activate", NULL, gtk_file_chooser_dialog_activate_response);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -361,9 +362,11 @@ is_accept_response_id (gint response_id)
|
||||
}
|
||||
|
||||
static void
|
||||
file_chooser_widget_response_requested (GtkWidget *widget,
|
||||
GtkFileChooserDialog *dialog)
|
||||
gtk_file_chooser_dialog_activate_response (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
GVariant *parameters)
|
||||
{
|
||||
GtkFileChooserDialog *dialog = GTK_FILE_CHOOSER_DIALOG (widget);
|
||||
GtkFileChooserDialogPrivate *priv = gtk_file_chooser_dialog_get_instance_private (dialog);
|
||||
GtkWidget *button;
|
||||
|
||||
@ -606,7 +609,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 +673,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");
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* gtkfilechooserembed.h: Abstract sizing interface for file selector implementations
|
||||
* Copyright (C) 2004, Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gtkfilechooserembed.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
static void gtk_file_chooser_embed_class_init (gpointer g_iface);
|
||||
static gboolean delegate_should_respond (GtkFileChooserEmbed *chooser_embed);
|
||||
static void delegate_initial_focus (GtkFileChooserEmbed *chooser_embed);
|
||||
static void delegate_response_requested (GtkFileChooserEmbed *chooser_embed,
|
||||
gpointer data);
|
||||
|
||||
static GtkFileChooserEmbed *
|
||||
get_delegate (GtkFileChooserEmbed *receiver)
|
||||
{
|
||||
return g_object_get_data (G_OBJECT (receiver), "gtk-file-chooser-embed-delegate");
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_file_chooser_embed_delegate_iface_init:
|
||||
* @iface: a #GtkFileChoserEmbedIface structure
|
||||
*
|
||||
* An interface-initialization function for use in cases where an object is
|
||||
* simply delegating the methods, signals of the #GtkFileChooserEmbed interface
|
||||
* to another object. _gtk_file_chooser_embed_set_delegate() must be called on
|
||||
* each instance of the object so that the delegate object can be found.
|
||||
**/
|
||||
void
|
||||
_gtk_file_chooser_embed_delegate_iface_init (GtkFileChooserEmbedIface *iface)
|
||||
{
|
||||
iface->should_respond = delegate_should_respond;
|
||||
iface->initial_focus = delegate_initial_focus;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_file_chooser_embed_set_delegate:
|
||||
* @receiver: a GOobject implementing #GtkFileChooserEmbed
|
||||
* @delegate: another GObject implementing #GtkFileChooserEmbed
|
||||
*
|
||||
* Establishes that calls on @receiver for #GtkFileChooser methods should be
|
||||
* delegated to @delegate, and that #GtkFileChooser signals emitted on @delegate
|
||||
* should be forwarded to @receiver. Must be used in conjunction with
|
||||
* _gtk_file_chooser_embed_delegate_iface_init().
|
||||
**/
|
||||
void
|
||||
_gtk_file_chooser_embed_set_delegate (GtkFileChooserEmbed *receiver,
|
||||
GtkFileChooserEmbed *delegate)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (receiver));
|
||||
g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (delegate));
|
||||
|
||||
g_object_set_data (G_OBJECT (receiver), I_("gtk-file-chooser-embed-delegate"), delegate);
|
||||
|
||||
g_signal_connect (delegate, "response-requested",
|
||||
G_CALLBACK (delegate_response_requested), receiver);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static gboolean
|
||||
delegate_should_respond (GtkFileChooserEmbed *chooser_embed)
|
||||
{
|
||||
return _gtk_file_chooser_embed_should_respond (get_delegate (chooser_embed));
|
||||
}
|
||||
|
||||
static void
|
||||
delegate_initial_focus (GtkFileChooserEmbed *chooser_embed)
|
||||
{
|
||||
_gtk_file_chooser_embed_initial_focus (get_delegate (chooser_embed));
|
||||
}
|
||||
|
||||
static void
|
||||
delegate_response_requested (GtkFileChooserEmbed *chooser_embed,
|
||||
gpointer data)
|
||||
{
|
||||
g_signal_emit_by_name (data, "response-requested");
|
||||
}
|
||||
|
||||
|
||||
/* publicly callable functions */
|
||||
|
||||
GType
|
||||
_gtk_file_chooser_embed_get_type (void)
|
||||
{
|
||||
static GType file_chooser_embed_type = 0;
|
||||
|
||||
if (!file_chooser_embed_type)
|
||||
{
|
||||
const GTypeInfo file_chooser_embed_info =
|
||||
{
|
||||
sizeof (GtkFileChooserEmbedIface), /* class_size */
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc)gtk_file_chooser_embed_class_init, /* class_init */
|
||||
};
|
||||
|
||||
file_chooser_embed_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
I_("GtkFileChooserEmbed"),
|
||||
&file_chooser_embed_info, 0);
|
||||
|
||||
g_type_interface_add_prerequisite (file_chooser_embed_type, GTK_TYPE_WIDGET);
|
||||
}
|
||||
|
||||
return file_chooser_embed_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_embed_class_init (gpointer g_iface)
|
||||
{
|
||||
GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
|
||||
|
||||
g_signal_new (I_("response-requested"),
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkFileChooserEmbedIface, response_requested),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_file_chooser_embed_should_respond (GtkFileChooserEmbed *chooser_embed)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed), FALSE);
|
||||
|
||||
return GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->should_respond (chooser_embed);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed));
|
||||
|
||||
GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->initial_focus (chooser_embed);
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* gtkfilechooserembed.h: Abstract sizing interface for file selector implementations
|
||||
* Copyright (C) 2004, Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_FILE_CHOOSER_EMBED_H__
|
||||
#define __GTK_FILE_CHOOSER_EMBED_H__
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_FILE_CHOOSER_EMBED (_gtk_file_chooser_embed_get_type ())
|
||||
#define GTK_FILE_CHOOSER_EMBED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FILE_CHOOSER_EMBED, GtkFileChooserEmbed))
|
||||
#define GTK_IS_FILE_CHOOSER_EMBED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FILE_CHOOSER_EMBED))
|
||||
#define GTK_FILE_CHOOSER_EMBED_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_FILE_CHOOSER_EMBED, GtkFileChooserEmbedIface))
|
||||
|
||||
typedef struct _GtkFileChooserEmbed GtkFileChooserEmbed;
|
||||
typedef struct _GtkFileChooserEmbedIface GtkFileChooserEmbedIface;
|
||||
|
||||
|
||||
struct _GtkFileChooserEmbedIface
|
||||
{
|
||||
GTypeInterface base_iface;
|
||||
|
||||
/* Methods
|
||||
*/
|
||||
gboolean (*should_respond) (GtkFileChooserEmbed *chooser_embed);
|
||||
|
||||
void (*initial_focus) (GtkFileChooserEmbed *chooser_embed);
|
||||
/* Signals
|
||||
*/
|
||||
void (*response_requested) (GtkFileChooserEmbed *chooser_embed);
|
||||
};
|
||||
|
||||
GType _gtk_file_chooser_embed_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gboolean _gtk_file_chooser_embed_should_respond (GtkFileChooserEmbed *chooser_embed);
|
||||
|
||||
void _gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed);
|
||||
|
||||
void _gtk_file_chooser_embed_delegate_iface_init (GtkFileChooserEmbedIface *iface);
|
||||
void _gtk_file_chooser_embed_set_delegate (GtkFileChooserEmbed *receiver,
|
||||
GtkFileChooserEmbed *delegate);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_FILE_CHOOSER_EMBED_H__ */
|
@ -148,7 +148,7 @@ void
|
||||
gtk_file_chooser_error_stack_set_custom_error (GtkFileChooserErrorStack *self,
|
||||
const char *label_text)
|
||||
{
|
||||
GtkWidget *label = gtk_stack_get_child_by_name (GTK_STACK (self->stack), "cutsom");
|
||||
GtkWidget *label = gtk_stack_get_child_by_name (GTK_STACK (self->stack), "custom");
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (label), label_text);
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "gtkfilechooserwidget.h"
|
||||
#include "gtkfilechooserwidgetprivate.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtkfilechooserembed.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkintl.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "gtkfilechooserwidget.h"
|
||||
#include "gtkfilechooserwidgetprivate.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtkfilechooserembed.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkintl.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "gtkfilechooserwidget.h"
|
||||
#include "gtkfilechooserwidgetprivate.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtkfilechooserembed.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkintl.h"
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "gtkfilechooserwidget.h"
|
||||
#include "gtkfilechooserwidgetprivate.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtkfilechooserembed.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkintl.h"
|
||||
|
@ -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"
|
||||
@ -88,6 +87,7 @@
|
||||
#include "gtkshortcuttrigger.h"
|
||||
#include "gtkshortcutaction.h"
|
||||
#include "gtkshortcut.h"
|
||||
#include "gtkstringlist.h"
|
||||
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
@ -117,56 +117,6 @@
|
||||
/* 150 mseconds of delay */
|
||||
#define LOCATION_CHANGED_TIMEOUT 150
|
||||
|
||||
/* Profiling stuff */
|
||||
#undef PROFILE_FILE_CHOOSER
|
||||
#ifdef PROFILE_FILE_CHOOSER
|
||||
|
||||
|
||||
#ifndef F_OK
|
||||
#define F_OK 0
|
||||
#endif
|
||||
|
||||
#define PROFILE_INDENT 4
|
||||
|
||||
static int profile_indent;
|
||||
|
||||
static void
|
||||
profile_add_indent (int indent)
|
||||
{
|
||||
profile_indent += indent;
|
||||
if (profile_indent < 0)
|
||||
g_error ("You screwed up your indentation");
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_file_chooser_profile_log (const char *func, int indent, const char *msg1, const char *msg2)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (indent < 0)
|
||||
profile_add_indent (indent);
|
||||
|
||||
if (profile_indent == 0)
|
||||
str = g_strdup_printf ("MARK: %s %s %s", func ? func : "", msg1 ? msg1 : "", msg2 ? msg2 : "");
|
||||
else
|
||||
str = g_strdup_printf ("MARK: %*c %s %s %s", profile_indent - 1, ' ', func ? func : "", msg1 ? msg1 : "", msg2 ? msg2 : "");
|
||||
|
||||
access (str, F_OK);
|
||||
g_free (str);
|
||||
|
||||
if (indent > 0)
|
||||
profile_add_indent (indent);
|
||||
}
|
||||
|
||||
#define profile_start(x, y) _gtk_file_chooser_profile_log (G_STRFUNC, PROFILE_INDENT, x, y)
|
||||
#define profile_end(x, y) _gtk_file_chooser_profile_log (G_STRFUNC, -PROFILE_INDENT, x, y)
|
||||
#define profile_msg(x, y) _gtk_file_chooser_profile_log (NULL, 0, x, y)
|
||||
#else
|
||||
#define profile_start(x, y)
|
||||
#define profile_end(x, y)
|
||||
#define profile_msg(x, y)
|
||||
#endif
|
||||
|
||||
enum {
|
||||
PROP_SEARCH_MODE = 1,
|
||||
PROP_SUBTITLE
|
||||
@ -437,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);
|
||||
@ -490,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,
|
||||
@ -596,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)
|
||||
@ -624,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)
|
||||
{
|
||||
@ -2582,13 +2519,9 @@ gtk_file_chooser_widget_constructed (GObject *object)
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (object);
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->constructed (object);
|
||||
|
||||
update_appearance (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3244,15 +3177,11 @@ gtk_file_chooser_widget_unroot (GtkWidget *widget)
|
||||
static void
|
||||
change_icon_theme (GtkFileChooserWidget *impl)
|
||||
{
|
||||
profile_start ("start", NULL);
|
||||
|
||||
/* the first cell in the first column is the icon column, and we have a fixed size there */
|
||||
set_icon_cell_renderer_fixed_size (impl);
|
||||
|
||||
clear_model_cache (impl, MODEL_COL_ICON);
|
||||
gtk_widget_queue_resize (impl->browse_files_tree_view);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
/* Callback used when a GtkSettings value changes */
|
||||
@ -3263,14 +3192,10 @@ settings_notify_cb (GObject *object,
|
||||
{
|
||||
const char *name;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
name = g_param_spec_get_name (pspec);
|
||||
|
||||
if (strcmp (name, "gtk-icon-theme-name") == 0)
|
||||
change_icon_theme (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
/* Installs a signal handler for GtkSettings so that we can monitor changes in
|
||||
@ -3281,21 +3206,14 @@ check_icon_theme (GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
if (impl->settings_signal_id)
|
||||
{
|
||||
profile_end ("end", NULL);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
settings = gtk_widget_get_settings (GTK_WIDGET (impl));
|
||||
impl->settings_signal_id = g_signal_connect (settings, "notify",
|
||||
G_CALLBACK (settings_notify_cb), impl);
|
||||
|
||||
change_icon_theme (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3304,17 +3222,11 @@ gtk_file_chooser_widget_css_changed (GtkWidget *widget,
|
||||
{
|
||||
GtkFileChooserWidget *impl;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
impl = GTK_FILE_CHOOSER_WIDGET (widget);
|
||||
|
||||
profile_msg (" parent class css_changed start", NULL);
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->css_changed (widget, change);
|
||||
profile_msg (" parent class css_changed end", NULL);
|
||||
|
||||
change_icon_theme (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3550,8 +3462,6 @@ gtk_file_chooser_widget_map (GtkWidget *widget)
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
impl->browse_files_interaction_frozen = FALSE;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->map (widget);
|
||||
@ -3578,8 +3488,6 @@ gtk_file_chooser_widget_map (GtkWidget *widget)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
/* GtkWidget::unmap method */
|
||||
@ -3879,22 +3787,16 @@ update_columns (GtkFileChooserWidget *impl,
|
||||
static void
|
||||
load_set_model (GtkFileChooserWidget *impl)
|
||||
{
|
||||
profile_start ("start", NULL);
|
||||
|
||||
g_assert (impl->browse_files_model != NULL);
|
||||
|
||||
profile_msg (" gtk_tree_view_set_model start", NULL);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
|
||||
GTK_TREE_MODEL (impl->browse_files_model));
|
||||
update_columns (impl, FALSE, _("Modified"));
|
||||
file_list_set_sort_column_ids (impl);
|
||||
set_sort_column (impl);
|
||||
profile_msg (" gtk_tree_view_set_model end", NULL);
|
||||
impl->list_sort_ascending = TRUE;
|
||||
|
||||
g_set_object (&impl->model_for_search, impl->browse_files_model);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
/* Timeout callback used when the loading timer expires */
|
||||
@ -3903,8 +3805,6 @@ load_timeout_cb (gpointer data)
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (data);
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
g_assert (impl->load_state == LOAD_PRELOAD);
|
||||
g_assert (impl->load_timeout_id != 0);
|
||||
g_assert (impl->browse_files_model != NULL);
|
||||
@ -3914,8 +3814,6 @@ load_timeout_cb (gpointer data)
|
||||
|
||||
load_set_model (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -4168,8 +4066,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
|
||||
GError *error,
|
||||
GtkFileChooserWidget *impl)
|
||||
{
|
||||
profile_start ("start", NULL);
|
||||
|
||||
if (error)
|
||||
{
|
||||
set_busy_cursor (impl, FALSE);
|
||||
@ -4190,7 +4086,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
|
||||
/* We can't g_assert_not_reached(), as something other than us may have
|
||||
* initiated a folder reload. See #165556.
|
||||
*/
|
||||
profile_end ("end", NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4200,11 +4095,6 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
|
||||
|
||||
pending_select_files_process (impl);
|
||||
set_busy_cursor (impl, FALSE);
|
||||
#ifdef PROFILE_FILE_CHOOSER
|
||||
access ("MARK: *** FINISHED LOADING", F_OK);
|
||||
#endif
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
/* Callback used when file system model adds or updates a file.
|
||||
@ -4721,8 +4611,6 @@ set_list_model (GtkFileChooserWidget *impl,
|
||||
_gtk_file_system_model_get_directory (impl->browse_files_model) == impl->current_folder)
|
||||
return TRUE;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
stop_loading_and_clear_list_model (impl, TRUE);
|
||||
|
||||
set_busy_cursor (impl, TRUE);
|
||||
@ -4736,7 +4624,6 @@ set_list_model (GtkFileChooserWidget *impl,
|
||||
|
||||
_gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
|
||||
|
||||
profile_msg (" set sort function", NULL);
|
||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_NAME, name_sort_func, impl, NULL);
|
||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_SIZE, size_sort_func, impl, NULL);
|
||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_TYPE, type_sort_func, impl, NULL);
|
||||
@ -4757,8 +4644,6 @@ set_list_model (GtkFileChooserWidget *impl,
|
||||
|
||||
_gtk_file_system_model_set_filter (impl->browse_files_model, impl->current_filter);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -5152,8 +5037,6 @@ gtk_file_chooser_widget_update_current_folder (GtkFileChooser *chooser,
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser);
|
||||
struct UpdateCurrentFolderData *data;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
g_object_ref (file);
|
||||
|
||||
operation_mode_set (impl, OPERATION_MODE_BROWSE);
|
||||
@ -5183,7 +5066,6 @@ gtk_file_chooser_widget_update_current_folder (GtkFileChooser *chooser,
|
||||
set_busy_cursor (impl, TRUE);
|
||||
g_object_unref (file);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -5818,6 +5700,7 @@ add_custom_button_to_dialog (GtkDialog *dialog,
|
||||
static void
|
||||
request_response_and_add_to_recent_list (GtkFileChooserWidget *impl)
|
||||
{
|
||||
gtk_widget_activate_action (GTK_WIDGET (impl), "response.activate", NULL);
|
||||
g_signal_emit_by_name (impl, "response-requested");
|
||||
add_selection_to_recent_list (impl);
|
||||
}
|
||||
@ -6221,10 +6104,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;
|
||||
@ -6470,11 +6352,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 ||
|
||||
@ -7947,11 +7827,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkExpression *expression;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
#ifdef PROFILE_FILE_CHOOSER
|
||||
access ("MARK: *** CREATE FILE CHOOSER", F_OK);
|
||||
#endif
|
||||
|
||||
impl->select_multiple = FALSE;
|
||||
impl->show_hidden = FALSE;
|
||||
impl->show_size_column = TRUE;
|
||||
@ -7998,8 +7873,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
* which cannot be done with GtkBuilder
|
||||
*/
|
||||
post_process_ui (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -8046,6 +7919,7 @@ gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser,
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *combo;
|
||||
GListModel *model;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new (label));
|
||||
@ -8054,8 +7928,9 @@ gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser,
|
||||
g_hash_table_insert (impl->choices, g_strdup (id), combo);
|
||||
gtk_box_append (GTK_BOX (box), combo);
|
||||
|
||||
gtk_drop_down_set_from_strings (GTK_DROP_DOWN (combo), option_labels);
|
||||
g_object_set_data_full (G_OBJECT (combo), "options", g_strdupv ((char **)options), (GDestroyNotify)g_strfreev);
|
||||
model = G_LIST_MODEL (gtk_string_list_new ((const char * const *)options));
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (combo), model);
|
||||
g_object_unref (model);
|
||||
|
||||
widget = box;
|
||||
}
|
||||
@ -8110,11 +7985,15 @@ gtk_file_chooser_widget_set_choice (GtkFileChooser *chooser,
|
||||
|
||||
if (GTK_IS_DROP_DOWN (widget))
|
||||
{
|
||||
guint i;
|
||||
const char **options = (const char **)g_object_get_data (G_OBJECT (widget), "options");
|
||||
for (i = 0; options[i]; i++)
|
||||
guint i, n;
|
||||
GListModel *model;
|
||||
|
||||
model = gtk_drop_down_get_model (GTK_DROP_DOWN (widget));
|
||||
n = g_list_model_get_n_items (model);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (strcmp (options[i], option) == 0)
|
||||
const char *string = gtk_string_list_get_string (GTK_STRING_LIST (model), i);
|
||||
if (strcmp (string, option) == 0)
|
||||
{
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (widget), i);
|
||||
break;
|
||||
@ -8138,11 +8017,10 @@ gtk_file_chooser_widget_get_choice (GtkFileChooser *chooser,
|
||||
widget = (GtkWidget *)g_hash_table_lookup (impl->choices, id);
|
||||
if (GTK_IS_DROP_DOWN (widget))
|
||||
{
|
||||
const char **options = (const char **)g_object_get_data (G_OBJECT (widget), "options");
|
||||
guint selected = gtk_drop_down_get_selected (GTK_DROP_DOWN (widget));
|
||||
if (selected == GTK_INVALID_LIST_POSITION)
|
||||
return NULL;
|
||||
return options[selected];
|
||||
gpointer selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (widget));
|
||||
if (GTK_IS_STRING_OBJECT (selected))
|
||||
return gtk_string_object_get_string (GTK_STRING_OBJECT (selected));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
else if (GTK_IS_TOGGLE_BUTTON (widget))
|
||||
|
@ -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__ */
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "gtkfilechooserwidget.h"
|
||||
#include "gtkfilechooserwidgetprivate.h"
|
||||
#include "gtkfilechooserutils.h"
|
||||
#include "gtkfilechooserembed.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkintl.h"
|
||||
|
@ -100,7 +100,6 @@ gtk_private_sources = files([
|
||||
'gtkcssvalue.c',
|
||||
'gtkcsswidgetnode.c',
|
||||
'gtkdrop.c',
|
||||
'gtkfilechooserembed.c',
|
||||
'gtkfilechooserentry.c',
|
||||
'gtkfilechoosererrorstack.c',
|
||||
'gtkfilechoosernativeportal.c',
|
||||
|
@ -20,7 +20,6 @@
|
||||
<object class="GtkFileChooserWidget" id="widget">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<signal name="response-requested" handler="file_chooser_widget_response_requested" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user