Commit 8c34c1aa authored by Adrien Plazas's avatar Adrien Plazas
Browse files

GtkFileChooserWidget: Port to phones

parent 57d73dd3
......@@ -217,7 +217,6 @@ struct _GtkFileChooserWidgetPrivate {
GtkWidget *save_widgets_table;
/* The file browsing widgets */
GtkWidget *browse_widgets_hpaned;
GtkWidget *browse_header_revealer;
GtkWidget *browse_header_stack;
GtkWidget *browse_files_stack;
......@@ -258,6 +257,7 @@ struct _GtkFileChooserWidgetPrivate {
GtkWidget *places_sidebar;
GtkWidget *places_view;
GtkWidget *reveal_sidebar_button;
StartupMode startup_mode;
/* OPERATION_MODE_SEARCH */
......@@ -1269,6 +1269,8 @@ places_sidebar_open_location_cb (GtkPlacesSidebar *sidebar,
operation_mode_set (impl, OPERATION_MODE_RECENT);
else
change_folder_and_display_error (impl, location, clear_entry);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->reveal_sidebar_button), FALSE);
}
/* Callback used when the places sidebar needs us to display an error message */
......@@ -2809,6 +2811,8 @@ places_sidebar_show_other_locations_with_flags_cb (GtkPlacesSidebar *sidebar
update_preview_widget_visibility (impl);
operation_mode_set (impl, OPERATION_MODE_OTHER_LOCATIONS);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->reveal_sidebar_button), FALSE);
}
static void
......@@ -2866,14 +2870,6 @@ gtk_file_chooser_widget_constructed (GObject *object)
profile_end ("end", NULL);
}
static void
update_extra_and_filters (GtkFileChooserWidget *impl)
{
gtk_widget_set_visible (impl->priv->extra_and_filters,
gtk_widget_get_visible (impl->priv->extra_align) ||
gtk_widget_get_visible (impl->priv->filter_combo_hbox));
}
/* Sets the extra_widget by packing it in the appropriate place */
static void
set_extra_widget (GtkFileChooserWidget *impl,
......@@ -2898,12 +2894,10 @@ set_extra_widget (GtkFileChooserWidget *impl,
if (priv->extra_widget)
{
gtk_container_add (GTK_CONTAINER (priv->extra_align), priv->extra_widget);
gtk_widget_show (priv->extra_align);
}
else
gtk_widget_hide (priv->extra_align);
/* Calls update_extra_and_filters */
show_filters (impl, priv->filters != NULL);
}
......@@ -3817,7 +3811,6 @@ settings_load (GtkFileChooserWidget *impl)
gint sort_column;
GtkSortType sort_order;
StartupMode startup_mode;
gint sidebar_width;
GSettings *settings;
settings = _gtk_file_chooser_get_settings_for_widget (GTK_WIDGET (impl));
......@@ -3826,7 +3819,6 @@ settings_load (GtkFileChooserWidget *impl)
show_size_column = g_settings_get_boolean (settings, SETTINGS_KEY_SHOW_SIZE_COLUMN);
sort_column = g_settings_get_enum (settings, SETTINGS_KEY_SORT_COLUMN);
sort_order = g_settings_get_enum (settings, SETTINGS_KEY_SORT_ORDER);
sidebar_width = g_settings_get_int (settings, SETTINGS_KEY_SIDEBAR_WIDTH);
startup_mode = g_settings_get_enum (settings, SETTINGS_KEY_STARTUP_MODE);
sort_directories_first = g_settings_get_boolean (settings, SETTINGS_KEY_SORT_DIRECTORIES_FIRST);
date_format = g_settings_get_enum (settings, SETTINGS_KEY_DATE_FORMAT);
......@@ -3848,7 +3840,6 @@ settings_load (GtkFileChooserWidget *impl)
*/
update_time_renderer_visible (impl);
gtk_paned_set_position (GTK_PANED (priv->browse_widgets_hpaned), sidebar_width);
}
static void
......@@ -3868,8 +3859,6 @@ settings_save (GtkFileChooserWidget *impl)
g_settings_set_boolean (settings, SETTINGS_KEY_SORT_DIRECTORIES_FIRST, priv->sort_directories_first);
g_settings_set_enum (settings, SETTINGS_KEY_SORT_COLUMN, priv->sort_column);
g_settings_set_enum (settings, SETTINGS_KEY_SORT_ORDER, priv->sort_order);
g_settings_set_int (settings, SETTINGS_KEY_SIDEBAR_WIDTH,
gtk_paned_get_position (GTK_PANED (priv->browse_widgets_hpaned)));
g_settings_set_enum (settings, SETTINGS_KEY_DATE_FORMAT, priv->show_time ? DATE_FORMAT_WITH_TIME : DATE_FORMAT_REGULAR);
/* Now apply the settings */
......@@ -6010,7 +5999,6 @@ show_filters (GtkFileChooserWidget *impl,
GtkFileChooserWidgetPrivate *priv = impl->priv;
gtk_widget_set_visible (priv->filter_combo_hbox, show);
update_extra_and_filters (impl);
}
static void
......@@ -8430,7 +8418,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
"/org/gtk/libgtk/ui/gtkfilechooserwidget.ui");
/* A *lot* of widgets that we need to handle .... */
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_widgets_hpaned);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, browse_files_stack);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, places_sidebar);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, places_view);
......@@ -8447,6 +8434,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, extra_align);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, extra_and_filters);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, location_entry_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, reveal_sidebar_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, search_entry);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, search_spinner);
gtk_widget_class_bind_template_child_private (widget_class, GtkFileChooserWidget, list_name_column);
......
......@@ -9,30 +9,36 @@
<property name="visible">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkPaned" id="browse_widgets_hpaned">
<object class="GtkOverlay">
<property name="visible">1</property>
<child>
<object class="GtkPlacesSidebar" id="places_sidebar">
<child type="overlay">
<object class="GtkRevealer" id="sidebar_revealer">
<property name="visible">1</property>
<property name="hscrollbar-policy">never</property>
<property name="local-only">1</property>
<property name="show-other-locations">1</property>
<style>
<class name="sidebar"/>
</style>
<signal name="open-location" handler="places_sidebar_open_location_cb" swapped="no"/>
<signal name="show-error-message" handler="places_sidebar_show_error_message_cb" swapped="no"/>
<signal name="show-other-locations-with-flags" handler="places_sidebar_show_other_locations_with_flags_cb" swapped="no"/>
<property name="halign">start</property>
<property name="transition-type">slide-right</property>
<property name="reveal-child" bind-source="reveal_sidebar_button" bind-property="active" bind-flags="sync-create|bidirectional"/>
<property name="sensitive" bind-source="reveal_sidebar_button" bind-property="active" bind-flags="sync-create|bidirectional"/>
<child>
<object class="GtkPlacesSidebar" id="places_sidebar">
<property name="visible">1</property>
<property name="hscrollbar-policy">never</property>
<property name="local-only">1</property>
<property name="show-other-locations">1</property>
<style>
<class name="sidebar"/>
</style>
<signal name="open-location" handler="places_sidebar_open_location_cb" swapped="no"/>
<signal name="show-error-message" handler="places_sidebar_show_error_message_cb" swapped="no"/>
<signal name="show-other-locations-with-flags" handler="places_sidebar_show_other_locations_with_flags_cb" swapped="no"/>
</object>
</child>
</object>
<packing>
<property name="resize">0</property>
<property name="shrink">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="sensitive" bind-source="reveal_sidebar_button" bind-property="active" bind-flags="sync-create|bidirectional|invert-boolean"/>
<child>
<object class="GtkRevealer" id="browse_header_revealer">
<property name="visible">1</property>
......@@ -109,7 +115,7 @@
<child type="center">
<object class="GtkSearchEntry" id="search_entry">
<property name="visible">1</property>
<property name="width-chars">45</property>
<property name="width-chars">30</property>
<signal name="search-changed" handler="search_entry_activate_cb" swapped="yes"/>
<signal name="stop-search" handler="search_entry_stop_cb" swapped="yes"/>
</object>
......@@ -187,7 +193,6 @@
<child>
<object class="GtkTreeViewColumn" id="list_name_column">
<property name="title" translatable="yes">Name</property>
<property name="resizable">1</property>
<property name="expand">1</property>
<child>
<object class="GtkCellRendererPixbuf" id="list_pixbuf_renderer">
......@@ -205,7 +210,6 @@
<child>
<object class="GtkTreeViewColumn" id="list_location_column">
<property name="title" translatable="yes">Location</property>
<property name="resizable">1</property>
<property name="visible">0</property>
<property name="expand">1</property>
<child>
......@@ -308,6 +312,8 @@
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label" translatable="yes">No Results Found</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.44"/>
......@@ -322,6 +328,8 @@
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label" translatable="yes">Try a different search</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<style>
<class name="dim-label"/>
</style>
......@@ -375,10 +383,25 @@
</child>
<child>
<object class="GtkActionBar" id="extra_and_filters">
<property name="visible">1</property>
<property name="no-show-all">1</property>
<child>
<object class="GtkBox" id="extra_align">
<object class="GtkToggleButton" id="reveal_sidebar_button">
<property name="visible">1</property>
<property name="tooltip-text" translatable="yes">Show locations</property>
<property name="use-underline">1</property>
<property name="can-default">1</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name= "icon-name">view-sidebar-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="extra_align">
<property name="spacing">12</property>
</object>
</child>
......
......@@ -299,34 +299,6 @@
<style>
<class name="background"/>
</style>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Connect to _Server</property>
<property name="mnemonic-widget">address_entry</property>
<property name="use-underline">1</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkButton" id="connect_button">
<property name="label" translatable="yes">Con_nect</property>
<property name="use-underline">1</property>
<property name="visible">1</property>
<property name="can-focus">1</property>
<property name="sensitive">0</property>
<property name="receives-default">1</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_connect_button_clicked" object="GtkPlacesView" swapped="yes"/>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
......@@ -336,7 +308,6 @@
<property name="visible">1</property>
<property name="can-focus">1</property>
<property name="hexpand">1</property>
<property name="width-chars">20</property>
<property name="placeholder-text" translatable="yes">Enter server address…</property>
<property name="secondary-icon-name">dialog-question-symbolic</property>
<property name="completion">address_entry_completion</property>
......@@ -367,6 +338,18 @@
<class name="linked"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="connect_button">
<property name="label" translatable="yes">Con_nect</property>
<property name="use-underline">1</property>
<property name="visible">1</property>
<property name="can-focus">1</property>
<property name="sensitive">0</property>
<property name="receives-default">1</property>
<property name="valign">center</property>
<signal name="clicked" handler="on_connect_button_clicked" object="GtkPlacesView" swapped="yes"/>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
......
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