mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
placessidebar: Simplify some code
Use existing functions, instead of open-coding manipulation of string arrays.
This commit is contained in:
parent
5984bc78ee
commit
4de444ca61
@ -565,11 +565,7 @@ recent_files_setting_is_enabled (GtkPlacesSidebar *sidebar)
|
||||
GtkSettings *settings;
|
||||
gboolean enabled;
|
||||
|
||||
if (gtk_widget_has_screen (GTK_WIDGET (sidebar)))
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (sidebar)));
|
||||
else
|
||||
settings = gtk_settings_get_default ();
|
||||
|
||||
settings = gtk_widget_get_settings (GTK_WIDGET (sidebar));
|
||||
g_object_get (settings, "gtk-recent-files-enabled", &enabled, NULL);
|
||||
|
||||
return enabled;
|
||||
@ -579,17 +575,10 @@ static gboolean
|
||||
recent_scheme_is_supported (void)
|
||||
{
|
||||
const gchar * const *supported;
|
||||
gint i;
|
||||
|
||||
supported = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
|
||||
if (supported == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; supported[i] != NULL; i++)
|
||||
{
|
||||
if (strcmp ("recent", supported[i]) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
if (supported != NULL)
|
||||
return g_strv_contains (supported, "recent");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user