forked from AuroraMiddleware/gtk
Remove the GError from the shortcut-related functions
See https://bugzilla.gnome.org/show_bug.cgi?id=650363#c8 and the next comment; this argument just makes the API harder to use without real benefit. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
72ce506cfc
commit
c4f40a92ca
@ -5587,7 +5587,8 @@ gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
|
||||
{
|
||||
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
|
||||
|
||||
return gtk_places_sidebar_add_shortcut (GTK_PLACES_SIDEBAR (impl->places_sidebar), file, error);
|
||||
gtk_places_sidebar_add_shortcut (GTK_PLACES_SIDEBAR (impl->places_sidebar), file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -5597,7 +5598,8 @@ gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
|
||||
{
|
||||
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
|
||||
|
||||
return gtk_places_sidebar_remove_shortcut (GTK_PLACES_SIDEBAR (impl->places_sidebar), file, error);
|
||||
gtk_places_sidebar_remove_shortcut (GTK_PLACES_SIDEBAR (impl->places_sidebar), file);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
|
@ -4093,67 +4093,36 @@ find_shortcut_link (GtkPlacesSidebar *sidebar, GFile *location)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_places_sidebar_add_shortcut (GtkPlacesSidebar *sidebar, GFile *location, GError **error)
|
||||
void
|
||||
gtk_places_sidebar_add_shortcut (GtkPlacesSidebar *sidebar, GFile *location)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar), FALSE);
|
||||
g_return_val_if_fail (G_IS_FILE (location), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (find_shortcut_link (sidebar, location)) {
|
||||
char *uri;
|
||||
|
||||
uri = g_file_get_uri (location);
|
||||
g_set_error (error,
|
||||
GTK_FILE_CHOOSER_ERROR,
|
||||
GTK_FILE_CHOOSER_ERROR_ALREADY_EXISTS,
|
||||
_("Shortcut %s already exists"),
|
||||
uri);
|
||||
g_free (uri);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
g_return_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar));
|
||||
g_return_if_fail (G_IS_FILE (location));
|
||||
|
||||
g_object_ref (location);
|
||||
sidebar->shortcuts = g_slist_append (sidebar->shortcuts, location);
|
||||
|
||||
update_places (sidebar);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_places_sidebar_remove_shortcut (GtkPlacesSidebar *sidebar, GFile *location, GError **error)
|
||||
void
|
||||
gtk_places_sidebar_remove_shortcut (GtkPlacesSidebar *sidebar, GFile *location)
|
||||
{
|
||||
GSList *link;
|
||||
GFile *shortcut;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar), FALSE);
|
||||
g_return_val_if_fail (G_IS_FILE (location), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
g_return_if_fail (GTK_IS_PLACES_SIDEBAR (sidebar));
|
||||
g_return_if_fail (G_IS_FILE (location));
|
||||
|
||||
link = find_shortcut_link (sidebar, location);
|
||||
if (!link) {
|
||||
char *uri;
|
||||
|
||||
uri = g_file_get_uri (location);
|
||||
g_set_error (error,
|
||||
GTK_FILE_CHOOSER_ERROR,
|
||||
GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
|
||||
_("Shortcut %s does not exist"),
|
||||
uri);
|
||||
g_free (uri);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
if (!link)
|
||||
return;
|
||||
|
||||
shortcut = G_FILE (link->data);
|
||||
g_object_unref (shortcut);
|
||||
|
||||
sidebar->shortcuts = g_slist_delete_link (sidebar->shortcuts, link);
|
||||
update_places (sidebar);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GSList *
|
||||
|
@ -72,8 +72,8 @@ void gtk_places_sidebar_set_show_cwd (GtkPlacesSidebar *sidebar, gboolean show_c
|
||||
|
||||
void gtk_places_sidebar_set_accept_uri_drops (GtkPlacesSidebar *sidebar, gboolean accept_uri_drops);
|
||||
|
||||
gboolean gtk_places_sidebar_add_shortcut (GtkPlacesSidebar *sidebar, GFile *location, GError **error);
|
||||
gboolean gtk_places_sidebar_remove_shortcut (GtkPlacesSidebar *sidebar, GFile *location, GError **error);
|
||||
void gtk_places_sidebar_add_shortcut (GtkPlacesSidebar *sidebar, GFile *location);
|
||||
void gtk_places_sidebar_remove_shortcut (GtkPlacesSidebar *sidebar, GFile *location);
|
||||
GSList *gtk_places_sidebar_list_shortcuts (GtkPlacesSidebar *sidebar);
|
||||
|
||||
GFile *gtk_places_sidebar_get_nth_bookmark (GtkPlacesSidebar *sidebar, int n);
|
||||
|
Loading…
Reference in New Issue
Block a user