forked from AuroraMiddleware/gtk
Create the location_entry in a single function
We had duplicated code to create the entry in two cases, for Open and for Save modes. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
9ed65c5620
commit
fa2e287687
@ -4394,6 +4394,20 @@ file_pane_create (GtkFileChooserDefault *impl,
|
|||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
location_entry_create (GtkFileChooserDefault *impl)
|
||||||
|
{
|
||||||
|
if (!impl->location_entry)
|
||||||
|
impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
|
||||||
|
|
||||||
|
_gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
|
||||||
|
impl->file_system);
|
||||||
|
_gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
|
||||||
|
_gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
|
||||||
|
gtk_entry_set_width_chars (GTK_ENTRY (impl->location_entry), 45);
|
||||||
|
gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Creates the widgets specific to Save mode */
|
/* Creates the widgets specific to Save mode */
|
||||||
static void
|
static void
|
||||||
save_widgets_create (GtkFileChooserDefault *impl)
|
save_widgets_create (GtkFileChooserDefault *impl)
|
||||||
@ -4427,12 +4441,7 @@ save_widgets_create (GtkFileChooserDefault *impl)
|
|||||||
|
|
||||||
/* Location entry */
|
/* Location entry */
|
||||||
|
|
||||||
impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
|
location_entry_create (impl);
|
||||||
_gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
|
|
||||||
impl->file_system);
|
|
||||||
_gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
|
|
||||||
gtk_entry_set_width_chars (GTK_ENTRY (impl->location_entry), 45);
|
|
||||||
gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
|
|
||||||
gtk_table_attach (GTK_TABLE (impl->save_widgets_table), impl->location_entry,
|
gtk_table_attach (GTK_TABLE (impl->save_widgets_table), impl->location_entry,
|
||||||
1, 2, 0, 1,
|
1, 2, 0, 1,
|
||||||
GTK_EXPAND | GTK_FILL, 0,
|
GTK_EXPAND | GTK_FILL, 0,
|
||||||
@ -4547,7 +4556,10 @@ location_switch_to_filename_entry (GtkFileChooserDefault *impl)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (impl->location_entry)
|
if (impl->location_entry)
|
||||||
|
{
|
||||||
gtk_widget_destroy (impl->location_entry);
|
gtk_widget_destroy (impl->location_entry);
|
||||||
|
impl->location_entry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Box */
|
/* Box */
|
||||||
|
|
||||||
@ -4555,19 +4567,13 @@ location_switch_to_filename_entry (GtkFileChooserDefault *impl)
|
|||||||
|
|
||||||
/* Entry */
|
/* Entry */
|
||||||
|
|
||||||
impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
|
location_entry_create (impl);
|
||||||
_gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
|
|
||||||
impl->file_system);
|
|
||||||
gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
|
|
||||||
_gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
|
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_entry, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_entry, TRUE, TRUE, 0);
|
||||||
gtk_label_set_mnemonic_widget (GTK_LABEL (impl->location_label), impl->location_entry);
|
gtk_label_set_mnemonic_widget (GTK_LABEL (impl->location_label), impl->location_entry);
|
||||||
|
|
||||||
/* Configure the entry */
|
/* Configure the entry */
|
||||||
|
|
||||||
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder);
|
_gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder);
|
||||||
_gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
|
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user