Commit 1382f3bf authored by Adrien Plazas's avatar Adrien Plazas
Browse files

gtkfilechooserdialog: Drop the custom save entry

This avoids overloading the headebar, and lets the save entry be
populated just below it, where there is room.

Fixes Librem5/Apps_Issues#99.
parent d7b15246
......@@ -244,8 +244,6 @@ static void file_chooser_widget_selection_changed (GtkWidget *wid
static void response_cb (GtkDialog *dialog,
gint response_id);
static void setup_save_entry (GtkFileChooserDialog *dialog);
G_DEFINE_TYPE_WITH_CODE (GtkFileChooserDialog, gtk_file_chooser_dialog, GTK_TYPE_DIALOG,
G_ADD_PRIVATE (GtkFileChooserDialog)
......@@ -454,9 +452,6 @@ static void
gtk_file_chooser_dialog_notify (GObject *object,
GParamSpec *pspec)
if (strcmp (pspec->name, "action") == 0)
setup_save_entry (GTK_FILE_CHOOSER_DIALOG (object));
if (G_OBJECT_CLASS (gtk_file_chooser_dialog_parent_class)->notify)
G_OBJECT_CLASS (gtk_file_chooser_dialog_parent_class)->notify (object, pspec);
......@@ -511,55 +506,6 @@ setup_search (GtkFileChooserDialog *dialog)
static void
setup_save_entry (GtkFileChooserDialog *dialog)
gboolean use_header;
GtkFileChooserAction action;
gboolean need_entry;
GtkWidget *header;
g_object_get (dialog,
"use-header-bar", &use_header,
"action", &action,
if (!use_header)
header = gtk_dialog_get_header_bar (GTK_DIALOG (dialog));
need_entry = action == GTK_FILE_CHOOSER_ACTION_SAVE ||
if (need_entry && !dialog->priv->has_entry)
GtkWidget *box;
GtkWidget *label;
GtkWidget *entry;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
label = gtk_label_new_with_mnemonic (_("_Name"));
entry = _gtk_file_chooser_entry_new (FALSE, FALSE);
g_object_set (label, "margin-start", 6, "margin-end", 6, NULL);
g_object_set (entry, "margin-start", 6, "margin-end", 6, NULL);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_container_add (GTK_CONTAINER (box), entry);
gtk_widget_show_all (box);
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header), box);
gtk_file_chooser_widget_set_save_entry (GTK_FILE_CHOOSER_WIDGET (dialog->priv->widget), entry);
else if (!need_entry && dialog->priv->has_entry)
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (header), NULL);
gtk_file_chooser_widget_set_save_entry (GTK_FILE_CHOOSER_WIDGET (dialog->priv->widget), NULL);
dialog->priv->has_entry = need_entry;
static void
ensure_default_response (GtkFileChooserDialog *dialog)
......@@ -577,7 +523,6 @@ gtk_file_chooser_dialog_map (GtkWidget *widget)
GtkFileChooserDialogPrivate *priv = dialog->priv;
setup_search (dialog);
setup_save_entry (dialog);
ensure_default_response (dialog);
_gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment