summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserwidget.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-07-14 23:48:09 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-07-14 23:50:40 -0400
commiteb67d14551a5d77dc3519689923e788c21050800 (patch)
tree7acd22c7c26a1af3cbe216aa39eae9163493e1a1 /gtk/gtkfilechooserwidget.c
parenta00a5ed2104b516200c13c40be3ffa174d87fd91 (diff)
downloadgtk+-eb67d14551a5d77dc3519689923e788c21050800.tar.gz
file chooser: Be more careful with subtitles
We were showing things like "Searching in (null)" if the current folder is not in the sidebar. Avoid that by falling back to using current_folder. Pointed out by Carlos Soriano.
Diffstat (limited to 'gtk/gtkfilechooserwidget.c')
-rw-r--r--gtk/gtkfilechooserwidget.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index ca414ada4f..6d8dfe4fd3 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -3160,9 +3160,29 @@ gtk_file_chooser_widget_get_subtitle (GtkFileChooserWidget *impl)
{
gchar *location;
+ subtitle = _("Searching");
+
location = gtk_places_sidebar_get_location_title (GTK_PLACES_SIDEBAR (priv->places_sidebar));
- subtitle = g_strdup_printf (_("Searching in %s"), location);
- g_free (location);
+ if (location)
+ {
+ subtitle = g_strdup_printf (_("Searching in %s"), location);
+ g_free (location);
+ }
+ else if (priv->current_folder)
+ {
+ GFileInfo *info;
+
+ info = g_file_query_info (priv->current_folder,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+ if (info)
+ {
+ subtitle = g_strdup_printf (_("Searching in %s"), g_file_info_get_display_name (info));
+ g_object_unref (info);
+ }
+ }
}
else if (priv->operation_mode == OPERATION_MODE_ENTER_LOCATION ||
(priv->operation_mode == OPERATION_MODE_BROWSE &&