file-chooser: move pathbar into preview pane

https://bugzilla.gnome.org/show_bug.cgi?id=722211
This commit is contained in:
William Jon McCann 2014-04-07 15:16:21 -04:00 committed by Matthias Clasen
parent 5a73757cdb
commit 256a3a51da
2 changed files with 137 additions and 183 deletions

View File

@ -205,6 +205,7 @@ struct _GtkFileChooserWidgetPrivate {
GtkWidget *browse_widgets_box;
GtkWidget *browse_widgets_hpaned;
GtkWidget *browse_header_box;
GtkWidget *browse_files_box;
GtkWidget *browse_files_tree_view;
GtkWidget *browse_files_popup_menu;
GtkWidget *browse_files_popup_menu_add_shortcut_item;
@ -2463,51 +2464,6 @@ unset_file_system_backend (GtkFileChooserWidget *impl)
priv->file_system = NULL;
}
/* Saves the widgets around the pathbar so they can be reparented later
* in the correct place. This function must be called paired with
* restore_path_bar().
*/
static void
save_path_bar (GtkFileChooserWidget *impl)
{
GtkFileChooserWidgetPrivate *priv = impl->priv;
GtkWidget *parent;
g_object_ref (priv->browse_path_bar_hbox);
parent = gtk_widget_get_parent (priv->browse_path_bar_hbox);
if (parent)
gtk_container_remove (GTK_CONTAINER (parent), priv->browse_path_bar_hbox);
}
/* Reparents the path bar and the "Create folder" button to the right place:
* Above the file list in Open mode, or to the right of the Save in folder:
* label in Save mode. The save_path_bar() function must be called before this
* one.
*/
static void
restore_path_bar (GtkFileChooserWidget *impl)
{
GtkFileChooserWidgetPrivate *priv = impl->priv;
if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
|| priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
gtk_box_pack_start (GTK_BOX (priv->browse_header_box), priv->browse_path_bar_hbox, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (priv->browse_header_box), priv->browse_path_bar_hbox, 0);
}
else if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
|| priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
gtk_widget_set_hexpand (priv->browse_path_bar_hbox, TRUE);
gtk_grid_attach (GTK_GRID (priv->save_widgets_table), priv->browse_path_bar_hbox, 1, 1, 1, 1);
}
else
g_assert_not_reached ();
g_object_unref (priv->browse_path_bar_hbox);
}
/* Takes the folder stored in a row in the recent_model, and puts it in the pathbar */
static void
put_recent_folder_in_pathbar (GtkFileChooserWidget *impl, GtkTreeIter *iter)
@ -2707,8 +2663,6 @@ update_appearance (GtkFileChooserWidget *impl)
{
GtkFileChooserWidgetPrivate *priv = impl->priv;
save_path_bar (impl);
if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
@ -2742,7 +2696,6 @@ update_appearance (GtkFileChooserWidget *impl)
if (priv->location_entry)
_gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->action);
restore_path_bar (impl);
path_bar_update (impl);
/* This *is* needed; we need to redraw the file list because the "sensitivity"
@ -7577,6 +7530,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_widgets_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_widgets_hpaned);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_header_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_widgets_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, places_sidebar);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_tree_view);

View File

@ -50,139 +50,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="browse_path_bar_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkToggleButton" id="location_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Type a file name</property>
<property name="image">location_button_image</property>
<child internal-child="accessible">
<object class="AtkObject" id="location_button-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Type a file name</property>
</object>
</child>
<signal name="toggled" handler="location_button_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkPathBar" id="browse_path_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="path-clicked" handler="path_bar_clicked" after="yes" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkInfoBar" id="browse_select_a_folder_info_bar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<child internal-child="content_area">
<object class="GtkBox" id="infobar-content_area1">
<property name="can_focus">False</property>
<property name="border_width">8</property>
<property name="spacing">16</property>
<child>
<object class="GtkImage" id="browse_select_a_folder_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">folder</property>
<property name="icon_size">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="browse_select_a_folder_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">message</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="infobar-action_area1">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="browse_special_mode_icon">
<property name="can_focus">False</property>
<property name="icon_name">image-missing</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="browse_special_mode_label">
<property name="can_focus">False</property>
<property name="label">special</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse_new_folder_button">
<property name="label" translatable="yes">Create Fo_lder</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="new_folder_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -215,6 +82,139 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="browse_path_bar_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkToggleButton" id="location_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Type a file name</property>
<property name="image">location_button_image</property>
<child internal-child="accessible">
<object class="AtkObject" id="location_button-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Type a file name</property>
</object>
</child>
<signal name="toggled" handler="location_button_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkPathBar" id="browse_path_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="path-clicked" handler="path_bar_clicked" after="yes" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkInfoBar" id="browse_select_a_folder_info_bar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<child internal-child="content_area">
<object class="GtkBox" id="infobar-content_area1">
<property name="can_focus">False</property>
<property name="border_width">8</property>
<property name="spacing">16</property>
<child>
<object class="GtkImage" id="browse_select_a_folder_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">folder</property>
<property name="icon_size">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="browse_select_a_folder_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">message</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="infobar-action_area1">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="browse_special_mode_icon">
<property name="can_focus">False</property>
<property name="icon_name">image-missing</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="browse_special_mode_label">
<property name="can_focus">False</property>
<property name="label">special</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse_new_folder_button">
<property name="label" translatable="yes">Create Fo_lder</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="new_folder_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="list_and_preview_box">
<property name="visible">True</property>
@ -319,7 +319,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
@ -351,7 +351,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>