filechooser: Drop the ::file-activated signal

This signal does not work on native file choosers,
and it exposes internals of the widget that should
not be public. And it is just not very interesting.
This commit is contained in:
Matthias Clasen 2020-07-09 01:40:08 -04:00
parent 89bf8af878
commit 99a0b35705
7 changed files with 1 additions and 69 deletions

View File

@ -126,28 +126,6 @@ gtk_file_chooser_default_init (GtkFileChooserInterface *iface)
NULL,
G_TYPE_NONE, 0);
/**
* GtkFileChooser::file-activated:
* @chooser: the object which received the signal.
*
* This signal is emitted when the user "activates" a file in the file
* chooser. This can happen by double-clicking on a file in the file list, or
* by pressing `Enter`.
*
* Normally you do not need to connect to this signal. It is used internally
* by #GtkFileChooserDialog to know when to activate the default button in the
* dialog.
*
* See also: gtk_file_chooser_get_file(), gtk_file_chooser_get_files()
*/
g_signal_new (I_("file-activated"),
iface_type,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkFileChooserIface, file_activated),
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
g_object_interface_install_property (iface,
g_param_spec_enum ("action",
P_("Action"),

View File

@ -265,8 +265,6 @@ static void gtk_file_chooser_dialog_size_allocate (GtkWidget *wid
int width,
int height,
int baseline);
static void file_chooser_widget_file_activated (GtkFileChooser *chooser,
GtkFileChooserDialog *dialog);
static void file_chooser_widget_response_requested (GtkWidget *widget,
GtkFileChooserDialog *dialog);
static void file_chooser_widget_selection_changed (GtkWidget *widget,
@ -310,7 +308,6 @@ 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_file_activated);
gtk_widget_class_bind_template_callback (widget_class, file_chooser_widget_response_requested);
gtk_widget_class_bind_template_callback (widget_class, file_chooser_widget_selection_changed);
}
@ -367,14 +364,6 @@ is_accept_response_id (gint response_id)
response_id == GTK_RESPONSE_APPLY);
}
/* Callback used when the user activates a file in the file chooser widget */
static void
file_chooser_widget_file_activated (GtkFileChooser *chooser,
GtkFileChooserDialog *dialog)
{
gtk_widget_activate_default (GTK_WIDGET (chooser));
}
static void
file_chooser_widget_selection_changed (GtkWidget *widget,
GtkFileChooserDialog *dialog)

View File

@ -162,7 +162,6 @@
* navigates in the dialog, including:
* * #GtkFileChooser::current-folder-changed
* * #GtkFileChooser::selection-changed
* * #GtkFileChooser::file-activated
*
* You can also not use the methods that directly control user navigation:
* * gtk_file_chooser_unselect_filename()

View File

@ -60,8 +60,6 @@ static void delegate_current_folder_changed (GtkFileChooser *choose
gpointer data);
static void delegate_selection_changed (GtkFileChooser *chooser,
gpointer data);
static void delegate_file_activated (GtkFileChooser *chooser,
gpointer data);
static void delegate_add_choice (GtkFileChooser *chooser,
const char *id,
@ -172,8 +170,6 @@ _gtk_file_chooser_set_delegate (GtkFileChooser *receiver,
G_CALLBACK (delegate_current_folder_changed), receiver);
g_signal_connect (delegate, "selection-changed",
G_CALLBACK (delegate_selection_changed), receiver);
g_signal_connect (delegate, "file-activated",
G_CALLBACK (delegate_file_activated), receiver);
}
GQuark
@ -329,13 +325,6 @@ delegate_current_folder_changed (GtkFileChooser *chooser,
g_signal_emit_by_name (data, "current-folder-changed");
}
static void
delegate_file_activated (GtkFileChooser *chooser,
gpointer data)
{
g_signal_emit_by_name (data, "file-activated");
}
GSettings *
_gtk_file_chooser_get_settings_for_widget (GtkWidget *widget)
{

View File

@ -7059,7 +7059,7 @@ list_row_activated (GtkTreeView *tree_view,
if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
g_signal_emit_by_name (impl, "file-activated");
gtk_widget_activate_default (GTK_WIDGET (impl));
out:

View File

@ -20,7 +20,6 @@
<object class="GtkFileChooserWidget" id="widget">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<signal name="file-activated" handler="file_chooser_widget_file_activated" swapped="no"/>
<signal name="response-requested" handler="file_chooser_widget_response_requested" swapped="no"/>
<signal name="selection-changed" handler="file_chooser_widget_selection_changed" swapped="no"/>
</object>

View File

@ -185,27 +185,6 @@ chooser_selection_changed_cb (GtkFileChooser *chooser,
g_object_unref (filename);
}
static void
chooser_file_activated_cb (GtkFileChooser *chooser,
gpointer user_data)
{
GFile *folder, *filename;
char *folder_uri, *filename_uri;
folder = gtk_file_chooser_get_current_folder (chooser);
filename = gtk_file_chooser_get_file (chooser);
folder_uri = g_file_get_uri (folder);
filename_uri = g_file_get_uri (filename);
g_message ("%s::file-activated\n\tFolder: `%s'\n\tFilename: `%s'\nDone.\n",
G_OBJECT_TYPE_NAME (chooser), folder_uri, filename_uri);
g_free (folder_uri);
g_free (filename_uri);
g_object_unref (folder);
g_object_unref (filename);
}
static void
add_new_filechooser_button (const gchar *mnemonic,
const gchar *chooser_title,
@ -238,7 +217,6 @@ add_new_filechooser_button (const gchar *mnemonic,
g_signal_connect (chooser, "current-folder-changed",
G_CALLBACK (chooser_current_folder_changed_cb), NULL);
g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL);
g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL);
gtk_box_append (GTK_BOX (hbox), chooser);
button = gtk_button_new_with_label ("Tests");