mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
general: Rename from 'favorite' to 'starred'
It was a mix of both terms, given that tracker uses 'favorite' but we use 'starred' in the UI. Since the part that interact with tracker is minimal, is better to be consistent with the UI. This renames 'favorite' to 'starred' except the tracker queries.
This commit is contained in:
parent
275512d574
commit
27b039b37c
|
@ -244,11 +244,11 @@
|
|||
<summary>Default list view zoom level</summary>
|
||||
</key>
|
||||
<key type="as" name="default-visible-columns">
|
||||
<default>[ 'name', 'size', 'date_modified', 'favorite' ]</default>
|
||||
<default>[ 'name', 'size', 'date_modified', 'starred' ]</default>
|
||||
<summary>Columns visible in list view</summary>
|
||||
</key>
|
||||
<key type="as" name="default-column-order">
|
||||
<default>[ 'name', 'size', 'type', 'owner', 'group', 'permissions', 'mime_type', 'where', 'date_modified', 'date_modified_with_time', 'date_accessed', 'recency', 'favorite' ]</default>
|
||||
<default>[ 'name', 'size', 'type', 'owner', 'group', 'permissions', 'mime_type', 'where', 'date_modified', 'date_modified_with_time', 'date_accessed', 'recency', 'starred' ]</default>
|
||||
<summary>Column order in list view</summary>
|
||||
</key>
|
||||
<key type="b" name="use-tree-view">
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
gboolean
|
||||
eel_uri_is_favorites (const gchar *uri)
|
||||
eel_uri_is_starred (const gchar *uri)
|
||||
{
|
||||
return g_str_has_prefix (uri, "favorites:");
|
||||
return g_str_has_prefix (uri, "starred:");
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -34,7 +34,7 @@ G_BEGIN_DECLS
|
|||
#define EEL_TRASH_URI "trash:"
|
||||
#define EEL_SEARCH_URI "x-nautilus-search:"
|
||||
|
||||
gboolean eel_uri_is_favorites (const char *uri);
|
||||
gboolean eel_uri_is_starred (const char *uri);
|
||||
gboolean eel_uri_is_trash (const char *uri);
|
||||
gboolean eel_uri_is_search (const char *uri);
|
||||
gboolean eel_uri_is_other_locations (const char *uri);
|
||||
|
|
|
@ -261,8 +261,8 @@ libnautilus_sources = [
|
|||
'nautilus-search-engine-tracker.h',
|
||||
'nautilus-tag-manager.c',
|
||||
'nautilus-tag-manager.h',
|
||||
'nautilus-favorite-directory.c',
|
||||
'nautilus-favorite-directory.h'
|
||||
'nautilus-starred-directory.c',
|
||||
'nautilus-starred-directory.h'
|
||||
]
|
||||
|
||||
nautilus_deps = [
|
||||
|
|
|
@ -635,7 +635,7 @@ nautilus_bookmark_list_can_bookmark_location (NautilusBookmarkList *list,
|
|||
}
|
||||
|
||||
if (nautilus_is_recent_directory (location) ||
|
||||
nautilus_is_favorite_directory (location) ||
|
||||
nautilus_is_starred_directory (location) ||
|
||||
nautilus_is_home_directory (location) ||
|
||||
nautilus_is_trash_directory (location) ||
|
||||
nautilus_is_other_locations_directory (location))
|
||||
|
|
|
@ -42,7 +42,7 @@ static const char *default_column_order[] =
|
|||
"date_modified",
|
||||
"date_accessed",
|
||||
"recency",
|
||||
"favorite",
|
||||
"starred",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -152,10 +152,10 @@ get_builtin_columns (void)
|
|||
|
||||
columns = g_list_append (columns,
|
||||
g_object_new (NAUTILUS_TYPE_COLUMN,
|
||||
"name", "favorite",
|
||||
"attribute", "favorite",
|
||||
"name", "starred",
|
||||
"attribute", "starred",
|
||||
"label", _("Star"),
|
||||
"description", _("Shows if file is favorite."),
|
||||
"description", _("Shows if file is starred."),
|
||||
"default-sort-order", GTK_SORT_DESCENDING,
|
||||
"xalign", 0.5,
|
||||
NULL));
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "nautilus-file-private.h"
|
||||
#include "nautilus-file-utilities.h"
|
||||
#include "nautilus-search-directory.h"
|
||||
#include "nautilus-favorite-directory.h"
|
||||
#include "nautilus-starred-directory.h"
|
||||
#include "nautilus-search-directory-file.h"
|
||||
#include "nautilus-vfs-file.h"
|
||||
#include "nautilus-global-preferences.h"
|
||||
|
@ -817,7 +817,7 @@ nautilus_directory_is_in_starred (NautilusDirectory *directory)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
return g_file_has_uri_scheme (directory->details->location, "favorites");
|
||||
return g_file_has_uri_scheme (directory->details->location, "starred");
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -1300,8 +1300,8 @@ nautilus_file_undo_info_batch_rename_set_data_post (NautilusFileUndoInfoBatchRen
|
|||
self->priv->new_display_names = g_list_reverse (self->priv->new_display_names);
|
||||
}
|
||||
|
||||
/* favorite files */
|
||||
G_DEFINE_TYPE (NautilusFileUndoInfoFavorites, nautilus_file_undo_info_favorites, NAUTILUS_TYPE_FILE_UNDO_INFO);
|
||||
/* starred files */
|
||||
G_DEFINE_TYPE (NautilusFileUndoInfoFavorites, nautilus_file_undo_info_starred, NAUTILUS_TYPE_FILE_UNDO_INFO);
|
||||
|
||||
struct _NautilusFileUndoInfoFavoritesDetails
|
||||
{
|
||||
|
@ -1318,13 +1318,13 @@ enum
|
|||
};
|
||||
|
||||
static void
|
||||
favorites_strings_func (NautilusFileUndoInfo *info,
|
||||
starred_strings_func (NautilusFileUndoInfo *info,
|
||||
gchar **undo_label,
|
||||
gchar **undo_description,
|
||||
gchar **redo_label,
|
||||
gchar **redo_description)
|
||||
{
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_FAVORITES (info);
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_STARRED (info);
|
||||
|
||||
if (self->priv->starred)
|
||||
{
|
||||
|
@ -1355,7 +1355,7 @@ favorites_strings_func (NautilusFileUndoInfo *info,
|
|||
}
|
||||
|
||||
static void
|
||||
on_undo_favorite_tags_updated (GObject *object,
|
||||
on_undo_starred_tags_updated (GObject *object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -1371,10 +1371,10 @@ on_undo_favorite_tags_updated (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
favorites_redo_func (NautilusFileUndoInfo *info,
|
||||
starred_redo_func (NautilusFileUndoInfo *info,
|
||||
GtkWindow *parent_window)
|
||||
{
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_FAVORITES (info);
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_STARRED (info);
|
||||
NautilusTagManager *tag_manager;
|
||||
|
||||
tag_manager = nautilus_tag_manager_get ();
|
||||
|
@ -1384,7 +1384,7 @@ favorites_redo_func (NautilusFileUndoInfo *info,
|
|||
nautilus_tag_manager_star_files (tag_manager,
|
||||
G_OBJECT (info),
|
||||
self->priv->files,
|
||||
on_undo_favorite_tags_updated,
|
||||
on_undo_starred_tags_updated,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
|
@ -1393,16 +1393,16 @@ favorites_redo_func (NautilusFileUndoInfo *info,
|
|||
nautilus_tag_manager_unstar_files (tag_manager,
|
||||
G_OBJECT (info),
|
||||
self->priv->files,
|
||||
on_undo_favorite_tags_updated,
|
||||
on_undo_starred_tags_updated,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
favorites_undo_func (NautilusFileUndoInfo *info,
|
||||
starred_undo_func (NautilusFileUndoInfo *info,
|
||||
GtkWindow *parent_window)
|
||||
{
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_FAVORITES (info);
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_STARRED (info);
|
||||
NautilusTagManager *tag_manager;
|
||||
|
||||
tag_manager = nautilus_tag_manager_get ();
|
||||
|
@ -1412,7 +1412,7 @@ favorites_undo_func (NautilusFileUndoInfo *info,
|
|||
nautilus_tag_manager_unstar_files (tag_manager,
|
||||
G_OBJECT (info),
|
||||
self->priv->files,
|
||||
on_undo_favorite_tags_updated,
|
||||
on_undo_starred_tags_updated,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
|
@ -1420,18 +1420,18 @@ favorites_undo_func (NautilusFileUndoInfo *info,
|
|||
nautilus_tag_manager_star_files (tag_manager,
|
||||
G_OBJECT (info),
|
||||
self->priv->files,
|
||||
on_undo_favorite_tags_updated,
|
||||
on_undo_starred_tags_updated,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_file_undo_info_favorites_set_property (GObject *object,
|
||||
nautilus_file_undo_info_starred_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_FAVORITES (object);
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_STARRED (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -1455,34 +1455,34 @@ nautilus_file_undo_info_favorites_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
nautilus_file_undo_info_favorites_init (NautilusFileUndoInfoFavorites *self)
|
||||
nautilus_file_undo_info_starred_init (NautilusFileUndoInfoFavorites *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, nautilus_file_undo_info_favorites_get_type (),
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, nautilus_file_undo_info_starred_get_type (),
|
||||
NautilusFileUndoInfoFavoritesDetails);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_file_undo_info_favorites_finalize (GObject *obj)
|
||||
nautilus_file_undo_info_starred_finalize (GObject *obj)
|
||||
{
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_FAVORITES (obj);
|
||||
NautilusFileUndoInfoFavorites *self = NAUTILUS_FILE_UNDO_INFO_STARRED (obj);
|
||||
|
||||
nautilus_file_list_free (self->priv->files);
|
||||
|
||||
G_OBJECT_CLASS (nautilus_file_undo_info_favorites_parent_class)->finalize (obj);
|
||||
G_OBJECT_CLASS (nautilus_file_undo_info_starred_parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_file_undo_info_favorites_class_init (NautilusFileUndoInfoFavoritesClass *klass)
|
||||
nautilus_file_undo_info_starred_class_init (NautilusFileUndoInfoFavoritesClass *klass)
|
||||
{
|
||||
GObjectClass *oclass = G_OBJECT_CLASS (klass);
|
||||
NautilusFileUndoInfoClass *iclass = NAUTILUS_FILE_UNDO_INFO_CLASS (klass);
|
||||
|
||||
oclass->finalize = nautilus_file_undo_info_favorites_finalize;
|
||||
oclass->set_property = nautilus_file_undo_info_favorites_set_property;
|
||||
oclass->finalize = nautilus_file_undo_info_starred_finalize;
|
||||
oclass->set_property = nautilus_file_undo_info_starred_set_property;
|
||||
|
||||
iclass->undo_func = favorites_undo_func;
|
||||
iclass->redo_func = favorites_redo_func;
|
||||
iclass->strings_func = favorites_strings_func;
|
||||
iclass->undo_func = starred_undo_func;
|
||||
iclass->redo_func = starred_redo_func;
|
||||
iclass->strings_func = starred_strings_func;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (NautilusFileUndoInfoFavoritesDetails));
|
||||
|
||||
|
@ -1505,25 +1505,25 @@ nautilus_file_undo_info_favorites_class_init (NautilusFileUndoInfoFavoritesClass
|
|||
}
|
||||
|
||||
GList *
|
||||
nautilus_file_undo_info_favorites_get_files (NautilusFileUndoInfoFavorites *self)
|
||||
nautilus_file_undo_info_starred_get_files (NautilusFileUndoInfoFavorites *self)
|
||||
{
|
||||
return self->priv->files;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_file_undo_info_favorites_is_favorited (NautilusFileUndoInfoFavorites *self)
|
||||
nautilus_file_undo_info_starred_is_starred (NautilusFileUndoInfoFavorites *self)
|
||||
{
|
||||
return self->priv->starred;
|
||||
}
|
||||
|
||||
NautilusFileUndoInfo *
|
||||
nautilus_file_undo_info_favorites_new (GList *files,
|
||||
nautilus_file_undo_info_starred_new (GList *files,
|
||||
gboolean starred)
|
||||
{
|
||||
NautilusFileUndoInfoFavorites *self;
|
||||
|
||||
self = g_object_new (NAUTILUS_TYPE_FILE_UNDO_INFO_FAVORITES,
|
||||
"op-type", NAUTILUS_FILE_UNDO_OP_FAVORITES,
|
||||
self = g_object_new (NAUTILUS_TYPE_FILE_UNDO_INFO_STARRED,
|
||||
"op-type", NAUTILUS_FILE_UNDO_OP_STARRED,
|
||||
"item-count", g_list_length (files),
|
||||
"files", files,
|
||||
"starred", starred,
|
||||
|
|
|
@ -35,7 +35,7 @@ typedef enum {
|
|||
NAUTILUS_FILE_UNDO_OP_MOVE,
|
||||
NAUTILUS_FILE_UNDO_OP_RENAME,
|
||||
NAUTILUS_FILE_UNDO_OP_BATCH_RENAME,
|
||||
NAUTILUS_FILE_UNDO_OP_FAVORITES,
|
||||
NAUTILUS_FILE_UNDO_OP_STARRED,
|
||||
NAUTILUS_FILE_UNDO_OP_CREATE_EMPTY_FILE,
|
||||
NAUTILUS_FILE_UNDO_OP_CREATE_FILE_FROM_TEMPLATE,
|
||||
NAUTILUS_FILE_UNDO_OP_CREATE_FOLDER,
|
||||
|
@ -218,13 +218,13 @@ void nautilus_file_undo_info_batch_rename_set_data_pre (NautilusFileUndoInfoBatc
|
|||
void nautilus_file_undo_info_batch_rename_set_data_post (NautilusFileUndoInfoBatchRename *self,
|
||||
GList *new_files);
|
||||
|
||||
/* favorite files */
|
||||
#define NAUTILUS_TYPE_FILE_UNDO_INFO_FAVORITES (nautilus_file_undo_info_favorites_get_type ())
|
||||
#define NAUTILUS_FILE_UNDO_INFO_FAVORITES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_TYPE_FILE_UNDO_INFO_FAVORITES, NautilusFileUndoInfoFavorites))
|
||||
#define NAUTILUS_FILE_UNDO_INFO_FAVORITES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_FILE_UNDO_INFO_FAVORITES, NautilusFileUndoInfoFavoritesClass))
|
||||
#define NAUTILUS_IS_FILE_UNDO_INFO_FAVORITES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NAUTILUS_TYPE_FILE_UNDO_INFO_FAVORITES))
|
||||
#define NAUTILUS_IS_FILE_UNDO_INFO_FAVORITES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_FILE_UNDO_INFO_FAVORITES))
|
||||
#define NAUTILUS_FILE_UNDO_INFO_FAVORITES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_FILE_UNDO_INFO_FAVORITES, NautilusFileUndoInfoFavoritesClass))
|
||||
/* starred files */
|
||||
#define NAUTILUS_TYPE_FILE_UNDO_INFO_STARRED (nautilus_file_undo_info_starred_get_type ())
|
||||
#define NAUTILUS_FILE_UNDO_INFO_STARRED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_TYPE_FILE_UNDO_INFO_STARRED, NautilusFileUndoInfoFavorites))
|
||||
#define NAUTILUS_FILE_UNDO_INFO_STARRED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_FILE_UNDO_INFO_STARRED, NautilusFileUndoInfoFavoritesClass))
|
||||
#define NAUTILUS_IS_FILE_UNDO_INFO_STARRED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NAUTILUS_TYPE_FILE_UNDO_INFO_STARRED))
|
||||
#define NAUTILUS_IS_FILE_UNDO_INFO_STARRED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_FILE_UNDO_INFO_STARRED))
|
||||
#define NAUTILUS_FILE_UNDO_INFO_STARRED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_FILE_UNDO_INFO_STARRED, NautilusFileUndoInfoFavoritesClass))
|
||||
|
||||
typedef struct _NautilusFileUndoInfoFavorites NautilusFileUndoInfoFavorites;
|
||||
typedef struct _NautilusFileUndoInfoFavoritesClass NautilusFileUndoInfoFavoritesClass;
|
||||
|
@ -239,11 +239,11 @@ struct _NautilusFileUndoInfoFavoritesClass {
|
|||
NautilusFileUndoInfoClass parent_class;
|
||||
};
|
||||
|
||||
GType nautilus_file_undo_info_favorites_get_type (void) G_GNUC_CONST;
|
||||
NautilusFileUndoInfo *nautilus_file_undo_info_favorites_new (GList *files,
|
||||
GType nautilus_file_undo_info_starred_get_type (void) G_GNUC_CONST;
|
||||
NautilusFileUndoInfo *nautilus_file_undo_info_starred_new (GList *files,
|
||||
gboolean starred);
|
||||
GList *nautilus_file_undo_info_favorites_get_files (NautilusFileUndoInfoFavorites *self);
|
||||
gboolean nautilus_file_undo_info_favorites_is_favorited (NautilusFileUndoInfoFavorites *self);
|
||||
GList *nautilus_file_undo_info_starred_get_files (NautilusFileUndoInfoFavorites *self);
|
||||
gboolean nautilus_file_undo_info_starred_is_starred (NautilusFileUndoInfoFavorites *self);
|
||||
|
||||
/* trash */
|
||||
#define NAUTILUS_TYPE_FILE_UNDO_INFO_TRASH (nautilus_file_undo_info_trash_get_type ())
|
||||
|
|
|
@ -322,7 +322,7 @@ nautilus_compute_title_for_location (GFile *location)
|
|||
{
|
||||
title = g_strdup (_("Other Locations"));
|
||||
}
|
||||
else if (nautilus_file_is_favorite_location (file))
|
||||
else if (nautilus_file_is_starred_location (file))
|
||||
{
|
||||
title = g_strdup (_("Starred"));
|
||||
}
|
||||
|
@ -550,13 +550,13 @@ nautilus_is_recent_directory (GFile *dir)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nautilus_is_favorite_directory (GFile *dir)
|
||||
nautilus_is_starred_directory (GFile *dir)
|
||||
{
|
||||
g_autofree gchar *uri = NULL;
|
||||
|
||||
uri = g_file_get_uri (dir);
|
||||
|
||||
if (eel_uri_is_favorites (uri))
|
||||
if (eel_uri_is_starred (uri))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -44,7 +44,7 @@ gboolean nautilus_is_home_directory_file (GFile *dir,
|
|||
gboolean nautilus_is_in_system_dir (GFile *location);
|
||||
gboolean nautilus_is_search_directory (GFile *dir);
|
||||
gboolean nautilus_is_recent_directory (GFile *dir);
|
||||
gboolean nautilus_is_favorite_directory (GFile *dir);
|
||||
gboolean nautilus_is_starred_directory (GFile *dir);
|
||||
gboolean nautilus_is_trash_directory (GFile *dir);
|
||||
gboolean nautilus_is_other_locations_directory (GFile *dir);
|
||||
GMount * nautilus_get_mounted_mount_for_root (GFile *location);
|
||||
|
|
|
@ -159,7 +159,7 @@ static GQuark attribute_name_q,
|
|||
attribute_link_target_q,
|
||||
attribute_volume_q,
|
||||
attribute_free_space_q,
|
||||
attribute_favorite_q;
|
||||
attribute_starred_q;
|
||||
|
||||
static void nautilus_file_info_iface_init (NautilusFileInfoInterface *iface);
|
||||
static char *nautilus_file_get_owner_as_string (NautilusFile *file,
|
||||
|
@ -3571,29 +3571,29 @@ compare_by_type (NautilusFile *file_1,
|
|||
}
|
||||
|
||||
static int
|
||||
compare_by_favorite (NautilusFile *file_1,
|
||||
compare_by_starred (NautilusFile *file_1,
|
||||
NautilusFile *file_2)
|
||||
{
|
||||
NautilusTagManager *tag_manager;
|
||||
g_autofree gchar *uri_1 = NULL;
|
||||
g_autofree gchar *uri_2 = NULL;
|
||||
gboolean file_1_is_favorite;
|
||||
gboolean file_2_is_favorite;
|
||||
gboolean file_1_is_starred;
|
||||
gboolean file_2_is_starred;
|
||||
|
||||
tag_manager = nautilus_tag_manager_get ();
|
||||
|
||||
uri_1 = nautilus_file_get_uri (file_1);
|
||||
uri_2 = nautilus_file_get_uri (file_2);
|
||||
|
||||
file_1_is_favorite = nautilus_tag_manager_file_is_favorite (tag_manager,
|
||||
file_1_is_starred = nautilus_tag_manager_file_is_starred (tag_manager,
|
||||
uri_1);
|
||||
file_2_is_favorite = nautilus_tag_manager_file_is_favorite (tag_manager,
|
||||
file_2_is_starred = nautilus_tag_manager_file_is_starred (tag_manager,
|
||||
uri_2);
|
||||
if (!!file_1_is_favorite == !!file_2_is_favorite)
|
||||
if (!!file_1_is_starred == !!file_2_is_starred)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (file_1_is_favorite && !file_2_is_favorite)
|
||||
else if (file_1_is_starred && !file_2_is_starred)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -3806,9 +3806,9 @@ nautilus_file_compare_for_sort (NautilusFile *file_1,
|
|||
}
|
||||
break;
|
||||
|
||||
case NAUTILUS_FILE_SORT_BY_FAVORITE:
|
||||
case NAUTILUS_FILE_SORT_BY_STARRED:
|
||||
{
|
||||
result = compare_by_favorite (file_1, file_2);
|
||||
result = compare_by_starred (file_1, file_2);
|
||||
if (result == 0)
|
||||
{
|
||||
result = compare_by_full_path (file_1, file_2);
|
||||
|
@ -3920,10 +3920,10 @@ nautilus_file_compare_for_sort_by_attribute_q (NautilusFile *file_1,
|
|||
directories_first,
|
||||
reversed);
|
||||
}
|
||||
else if (attribute == attribute_favorite_q)
|
||||
else if (attribute == attribute_starred_q)
|
||||
{
|
||||
return nautilus_file_compare_for_sort (file_1, file_2,
|
||||
NAUTILUS_FILE_SORT_BY_FAVORITE,
|
||||
NAUTILUS_FILE_SORT_BY_STARRED,
|
||||
directories_first,
|
||||
reversed);
|
||||
}
|
||||
|
@ -4530,7 +4530,7 @@ nautilus_file_get_display_name (NautilusFile *file)
|
|||
{
|
||||
if (nautilus_file_is_other_locations (file))
|
||||
return g_strdup (_("Other Locations"));
|
||||
if (nautilus_file_is_favorite_location (file))
|
||||
if (nautilus_file_is_starred_location (file))
|
||||
return g_strdup (_("Starred"));
|
||||
|
||||
return g_strdup (nautilus_file_peek_display_name (file));
|
||||
|
@ -7552,7 +7552,7 @@ nautilus_file_get_string_attribute_with_default_q (NautilusFile *file,
|
|||
/* If n/a */
|
||||
return g_strdup ("");
|
||||
}
|
||||
if (attribute_q == attribute_favorite_q)
|
||||
if (attribute_q == attribute_starred_q)
|
||||
{
|
||||
/* If n/a */
|
||||
return g_strdup ("");
|
||||
|
@ -8297,7 +8297,7 @@ nautilus_file_is_other_locations (NautilusFile *file)
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_file_is_favorite_location
|
||||
* nautilus_file_is_starred_location
|
||||
*
|
||||
* Check if this file is the Favorite location.
|
||||
* @file: NautilusFile representing the file in question.
|
||||
|
@ -8306,7 +8306,7 @@ nautilus_file_is_other_locations (NautilusFile *file)
|
|||
*
|
||||
**/
|
||||
gboolean
|
||||
nautilus_file_is_favorite_location (NautilusFile *file)
|
||||
nautilus_file_is_starred_location (NautilusFile *file)
|
||||
{
|
||||
g_autofree gchar *uri = NULL;
|
||||
|
||||
|
@ -8314,7 +8314,7 @@ nautilus_file_is_favorite_location (NautilusFile *file)
|
|||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
return eel_uri_is_favorites (uri);
|
||||
return eel_uri_is_starred (uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9403,7 +9403,7 @@ nautilus_file_class_init (NautilusFileClass *class)
|
|||
attribute_link_target_q = g_quark_from_static_string ("link_target");
|
||||
attribute_volume_q = g_quark_from_static_string ("volume");
|
||||
attribute_free_space_q = g_quark_from_static_string ("free_space");
|
||||
attribute_favorite_q = g_quark_from_static_string ("favorite");
|
||||
attribute_starred_q = g_quark_from_static_string ("starred");
|
||||
|
||||
G_OBJECT_CLASS (class)->finalize = finalize;
|
||||
G_OBJECT_CLASS (class)->constructor = nautilus_file_constructor;
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef enum {
|
|||
NAUTILUS_FILE_SORT_BY_DISPLAY_NAME,
|
||||
NAUTILUS_FILE_SORT_BY_SIZE,
|
||||
NAUTILUS_FILE_SORT_BY_TYPE,
|
||||
NAUTILUS_FILE_SORT_BY_FAVORITE,
|
||||
NAUTILUS_FILE_SORT_BY_STARRED,
|
||||
NAUTILUS_FILE_SORT_BY_MTIME,
|
||||
NAUTILUS_FILE_SORT_BY_ATIME,
|
||||
NAUTILUS_FILE_SORT_BY_TRASHED_TIME,
|
||||
|
@ -216,7 +216,7 @@ gboolean nautilus_file_is_in_starred (Nautilu
|
|||
gboolean nautilus_file_is_in_admin (NautilusFile *file);
|
||||
gboolean nautilus_file_is_remote (NautilusFile *file);
|
||||
gboolean nautilus_file_is_other_locations (NautilusFile *file);
|
||||
gboolean nautilus_file_is_favorite_location (NautilusFile *file);
|
||||
gboolean nautilus_file_is_starred_location (NautilusFile *file);
|
||||
gboolean nautilus_file_is_home (NautilusFile *file);
|
||||
gboolean nautilus_file_is_desktop_directory (NautilusFile *file);
|
||||
GError * nautilus_file_get_file_info_error (NautilusFile *file);
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
#include <nautilus-extension.h>
|
||||
#include "nautilus-clipboard.h"
|
||||
#include "nautilus-search-directory.h"
|
||||
#include "nautilus-favorite-directory.h"
|
||||
#include "nautilus-starred-directory.h"
|
||||
#include "nautilus-directory.h"
|
||||
#include "nautilus-dnd.h"
|
||||
#include "nautilus-file-attributes.h"
|
||||
|
@ -268,7 +268,7 @@ typedef struct
|
|||
gulong stop_signal_handler;
|
||||
gulong reload_signal_handler;
|
||||
|
||||
GCancellable *favorite_cancellable;
|
||||
GCancellable *starred_cancellable;
|
||||
NautilusTagManager *tag_manager;
|
||||
} NautilusFilesViewPrivate;
|
||||
|
||||
|
@ -1564,7 +1564,7 @@ action_star (GSimpleAction *action,
|
|||
G_OBJECT (view),
|
||||
selection,
|
||||
NULL,
|
||||
priv->favorite_cancellable);
|
||||
priv->starred_cancellable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1584,7 +1584,7 @@ action_unstar (GSimpleAction *action,
|
|||
G_OBJECT (view),
|
||||
selection,
|
||||
NULL,
|
||||
priv->favorite_cancellable);
|
||||
priv->starred_cancellable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3183,8 +3183,8 @@ nautilus_files_view_finalize (GObject *object)
|
|||
g_hash_table_destroy (priv->non_ready_files);
|
||||
g_hash_table_destroy (priv->pending_reveal);
|
||||
|
||||
g_cancellable_cancel (priv->favorite_cancellable);
|
||||
g_clear_object (&priv->favorite_cancellable);
|
||||
g_cancellable_cancel (priv->starred_cancellable);
|
||||
g_clear_object (&priv->starred_cancellable);
|
||||
|
||||
G_OBJECT_CLASS (nautilus_files_view_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -3434,7 +3434,7 @@ nautilus_files_view_set_location (NautilusView *view,
|
|||
set_search_query_internal (files_view, previous_query, base_model);
|
||||
g_object_unref (previous_query);
|
||||
}
|
||||
else if (NAUTILUS_IS_FAVORITE_DIRECTORY (directory))
|
||||
else if (NAUTILUS_IS_STARRED_DIRECTORY (directory))
|
||||
{
|
||||
load_directory (NAUTILUS_FILES_VIEW (view), directory);
|
||||
}
|
||||
|
@ -3493,7 +3493,7 @@ real_check_empty_states (NautilusFilesView *view)
|
|||
{
|
||||
gtk_widget_show (priv->trash_is_empty_widget);
|
||||
}
|
||||
else if (eel_uri_is_favorites (uri))
|
||||
else if (eel_uri_is_starred (uri))
|
||||
{
|
||||
gtk_widget_show (priv->starred_is_empty_widget);
|
||||
}
|
||||
|
@ -7652,7 +7652,7 @@ real_update_actions_state (NautilusFilesView *view)
|
|||
break;
|
||||
}
|
||||
|
||||
if (nautilus_tag_manager_file_is_favorite (priv->tag_manager, uri))
|
||||
if (nautilus_tag_manager_file_is_starred (priv->tag_manager, uri))
|
||||
{
|
||||
show_star = FALSE;
|
||||
}
|
||||
|
@ -9703,7 +9703,7 @@ nautilus_files_view_init (NautilusFilesView *view)
|
|||
* changed */
|
||||
nautilus_application_set_accelerator (app, "view.show-move-to-trash-shortcut-changed-dialog", "<control>Delete");
|
||||
|
||||
priv->favorite_cancellable = g_cancellable_new ();
|
||||
priv->starred_cancellable = g_cancellable_new ();
|
||||
priv->tag_manager = nautilus_tag_manager_get ();
|
||||
|
||||
nautilus_profile_end (NULL);
|
||||
|
|
|
@ -69,6 +69,6 @@ struct NautilusListViewDetails {
|
|||
GRegex *regex;
|
||||
|
||||
NautilusTagManager *tag_manager;
|
||||
GCancellable *favorite_cancellable;
|
||||
GCancellable *starred_cancellable;
|
||||
};
|
||||
|
||||
|
|
|
@ -442,7 +442,7 @@ check_starred_status (GtkTreeModel *model,
|
|||
}
|
||||
|
||||
static void
|
||||
on_favorites_files_changed (NautilusTagManager *tag_manager,
|
||||
on_starred_files_changed (NautilusTagManager *tag_manager,
|
||||
GList *changed_files,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -477,13 +477,13 @@ on_star_cell_renderer_clicked (GtkTreePath *path,
|
|||
uri = nautilus_file_get_uri (file);
|
||||
selection = g_list_prepend (NULL, file);
|
||||
|
||||
if (nautilus_tag_manager_file_is_favorite (list_view->details->tag_manager, uri))
|
||||
if (nautilus_tag_manager_file_is_starred (list_view->details->tag_manager, uri))
|
||||
{
|
||||
nautilus_tag_manager_unstar_files (list_view->details->tag_manager,
|
||||
G_OBJECT (list_view),
|
||||
selection,
|
||||
NULL,
|
||||
list_view->details->favorite_cancellable);
|
||||
list_view->details->starred_cancellable);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -491,7 +491,7 @@ on_star_cell_renderer_clicked (GtkTreePath *path,
|
|||
G_OBJECT (list_view),
|
||||
selection,
|
||||
NULL,
|
||||
list_view->details->favorite_cancellable);
|
||||
list_view->details->starred_cancellable);
|
||||
}
|
||||
|
||||
nautilus_file_list_free (selection);
|
||||
|
@ -1590,7 +1590,7 @@ apply_columns_settings (NautilusListView *list_view,
|
|||
}
|
||||
|
||||
static void
|
||||
favorite_cell_data_func (GtkTreeViewColumn *column,
|
||||
starred_cell_data_func (GtkTreeViewColumn *column,
|
||||
GtkCellRenderer *renderer,
|
||||
GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
|
@ -1621,7 +1621,7 @@ favorite_cell_data_func (GtkTreeViewColumn *column,
|
|||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
if (nautilus_tag_manager_file_is_favorite (view->details->tag_manager, uri))
|
||||
if (nautilus_tag_manager_file_is_starred (view->details->tag_manager, uri))
|
||||
{
|
||||
g_object_set (renderer,
|
||||
"icon-name", "starred-symbolic",
|
||||
|
@ -2175,7 +2175,7 @@ create_and_set_up_tree_view (NautilusListView *view)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (g_strcmp0 (name, "favorite") == 0)
|
||||
if (g_strcmp0 (name, "starred") == 0)
|
||||
{
|
||||
cell = gtk_cell_renderer_pixbuf_new ();
|
||||
g_object_set (cell,
|
||||
|
@ -2242,10 +2242,10 @@ create_and_set_up_tree_view (NautilusListView *view)
|
|||
(GtkTreeCellDataFunc) trash_orig_path_cell_data_func,
|
||||
view, NULL);
|
||||
}
|
||||
else if (!strcmp (name, "favorite"))
|
||||
else if (!strcmp (name, "starred"))
|
||||
{
|
||||
gtk_tree_view_column_set_cell_data_func (column, cell,
|
||||
(GtkTreeCellDataFunc) favorite_cell_data_func,
|
||||
(GtkTreeCellDataFunc) starred_cell_data_func,
|
||||
view, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -2350,7 +2350,7 @@ get_visible_columns (NautilusListView *list_view)
|
|||
GList *l;
|
||||
g_autofree gchar* uri = NULL;
|
||||
gboolean in_xdg_dirs;
|
||||
gboolean is_favorite;
|
||||
gboolean is_starred;
|
||||
|
||||
file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (list_view));
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
@ -2360,7 +2360,7 @@ get_visible_columns (NautilusListView *list_view)
|
|||
* See https://gitlab.gnome.org/GNOME/nautilus/issues/243
|
||||
*/
|
||||
in_xdg_dirs = eel_uri_is_in_xdg_dirs (uri);
|
||||
is_favorite = eel_uri_is_favorites (uri);
|
||||
is_starred = eel_uri_is_starred (uri);
|
||||
|
||||
visible_columns = nautilus_file_get_metadata_list (file,
|
||||
NAUTILUS_METADATA_KEY_LIST_VIEW_VISIBLE_COLUMNS);
|
||||
|
@ -2372,8 +2372,8 @@ get_visible_columns (NautilusListView *list_view)
|
|||
res = g_ptr_array_new ();
|
||||
for (l = visible_columns; l != NULL; l = l->next)
|
||||
{
|
||||
if (g_strcmp0 (l->data, "favorite") != 0 ||
|
||||
(g_strcmp0 (l->data, "favorite") == 0 && (in_xdg_dirs || is_favorite)))
|
||||
if (g_strcmp0 (l->data, "starred") != 0 ||
|
||||
(g_strcmp0 (l->data, "starred") == 0 && (in_xdg_dirs || is_starred)))
|
||||
{
|
||||
g_ptr_array_add (res, l->data);
|
||||
}
|
||||
|
@ -3554,11 +3554,11 @@ nautilus_list_view_finalize (GObject *object)
|
|||
|
||||
g_regex_unref (list_view->details->regex);
|
||||
|
||||
g_cancellable_cancel (list_view->details->favorite_cancellable);
|
||||
g_clear_object (&list_view->details->favorite_cancellable);
|
||||
g_cancellable_cancel (list_view->details->starred_cancellable);
|
||||
g_clear_object (&list_view->details->starred_cancellable);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (list_view->details->tag_manager,
|
||||
on_favorites_files_changed,
|
||||
on_starred_files_changed,
|
||||
list_view);
|
||||
|
||||
g_free (list_view->details);
|
||||
|
@ -3914,11 +3914,11 @@ nautilus_list_view_init (NautilusListView *list_view)
|
|||
list_view->details->regex = g_regex_new ("\\R+", 0, G_REGEX_MATCH_NEWLINE_ANY, NULL);
|
||||
|
||||
list_view->details->tag_manager = nautilus_tag_manager_get ();
|
||||
list_view->details->favorite_cancellable = g_cancellable_new ();
|
||||
list_view->details->starred_cancellable = g_cancellable_new ();
|
||||
|
||||
g_signal_connect (list_view->details->tag_manager,
|
||||
"favorites-changed",
|
||||
(GCallback) on_favorites_files_changed,
|
||||
"starred-changed",
|
||||
(GCallback) on_starred_files_changed,
|
||||
list_view);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef enum
|
|||
ROOT_BUTTON,
|
||||
HOME_BUTTON,
|
||||
MOUNT_BUTTON,
|
||||
FAVORITE_LOCATION_BUTTON
|
||||
STARRED_LOCATION_BUTTON
|
||||
} ButtonType;
|
||||
|
||||
#define BUTTON_DATA(x) ((ButtonData *) (x))
|
||||
|
@ -455,7 +455,7 @@ get_dir_name (ButtonData *button_data)
|
|||
return _("Other Locations");
|
||||
}
|
||||
|
||||
case FAVORITE_LOCATION_BUTTON:
|
||||
case STARRED_LOCATION_BUTTON:
|
||||
{
|
||||
return _("Starred");
|
||||
}
|
||||
|
@ -1930,9 +1930,9 @@ setup_button_type (ButtonData *button_data,
|
|||
|
||||
g_object_unref (mount);
|
||||
}
|
||||
else if (nautilus_is_favorite_directory (location))
|
||||
else if (nautilus_is_starred_directory (location))
|
||||
{
|
||||
button_data->type = FAVORITE_LOCATION_BUTTON;
|
||||
button_data->type = STARRED_LOCATION_BUTTON;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ struct _NautilusQuery
|
|||
GPtrArray *date_range;
|
||||
NautilusQuerySearchType search_type;
|
||||
NautilusQuerySearchContent search_content;
|
||||
gboolean search_favorite;
|
||||
gboolean search_starred;
|
||||
|
||||
gboolean searching;
|
||||
gboolean recursive;
|
||||
|
@ -344,7 +344,7 @@ nautilus_query_init (NautilusQuery *query)
|
|||
query->location = g_file_new_for_path (g_get_home_dir ());
|
||||
query->search_type = g_settings_get_enum (nautilus_preferences, "search-filter-time-type");
|
||||
query->search_content = NAUTILUS_QUERY_SEARCH_CONTENT_SIMPLE;
|
||||
query->search_favorite = FALSE;
|
||||
query->search_starred = FALSE;
|
||||
g_mutex_init (&query->prepared_words_mutex);
|
||||
}
|
||||
|
||||
|
@ -553,20 +553,20 @@ nautilus_query_set_search_content (NautilusQuery *query,
|
|||
}
|
||||
|
||||
gboolean
|
||||
nautilus_query_get_search_favorite (NautilusQuery *query)
|
||||
nautilus_query_get_search_starred (NautilusQuery *query)
|
||||
{
|
||||
g_return_val_if_fail (NAUTILUS_IS_QUERY (query), FALSE);
|
||||
|
||||
return query->search_favorite;
|
||||
return query->search_starred;
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_query_set_search_favorite (NautilusQuery *query,
|
||||
gboolean search_favorite)
|
||||
nautilus_query_set_search_starred (NautilusQuery *query,
|
||||
gboolean search_starred)
|
||||
{
|
||||
g_return_if_fail (NAUTILUS_IS_QUERY (query));
|
||||
|
||||
query->search_favorite = search_favorite;
|
||||
query->search_starred = search_starred;
|
||||
}
|
||||
|
||||
NautilusQuerySearchType
|
||||
|
|
|
@ -59,9 +59,9 @@ NautilusQuerySearchContent nautilus_query_get_search_content (NautilusQuery *que
|
|||
void nautilus_query_set_search_content (NautilusQuery *query,
|
||||
NautilusQuerySearchContent content);
|
||||
|
||||
gboolean nautilus_query_get_search_favorite (NautilusQuery *query);
|
||||
void nautilus_query_set_search_favorite (NautilusQuery *query,
|
||||
gboolean search_favorite);
|
||||
gboolean nautilus_query_get_search_starred (NautilusQuery *query);
|
||||
void nautilus_query_set_search_starred (NautilusQuery *query,
|
||||
gboolean search_starred);
|
||||
|
||||
NautilusQuerySearchType nautilus_query_get_search_type (NautilusQuery *query);
|
||||
void nautilus_query_set_search_type (NautilusQuery *query,
|
||||
|
|
|
@ -193,13 +193,13 @@ model_directory_ready_cb (NautilusDirectory *directory,
|
|||
g_ptr_array_unref (date_range);
|
||||
}
|
||||
|
||||
if (nautilus_query_get_search_favorite (model->query))
|
||||
if (nautilus_query_get_search_starred (model->query))
|
||||
{
|
||||
tag_manager = nautilus_tag_manager_get ();
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
if (!nautilus_tag_manager_file_is_favorite (tag_manager, uri))
|
||||
if (!nautilus_tag_manager_file_is_starred (tag_manager, uri))
|
||||
{
|
||||
found = FALSE;
|
||||
}
|
||||
|
|
|
@ -301,13 +301,13 @@ visit_directory (GFile *dir,
|
|||
g_ptr_array_unref (date_range);
|
||||
}
|
||||
|
||||
if (nautilus_query_get_search_favorite (data->query))
|
||||
if (nautilus_query_get_search_starred (data->query))
|
||||
{
|
||||
tag_manager = nautilus_tag_manager_get ();
|
||||
|
||||
uri = g_file_get_uri (child);
|
||||
|
||||
if (!nautilus_tag_manager_file_is_favorite (tag_manager, uri))
|
||||
if (!nautilus_tag_manager_file_is_starred (tag_manager, uri))
|
||||
{
|
||||
found = FALSE;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ nautilus_search_engine_tracker_start (NautilusSearchProvider *provider)
|
|||
g_string_append_printf (sparql, "; fts:match '\"%s\"*'", search_text);
|
||||
}
|
||||
|
||||
if (nautilus_query_get_search_favorite (tracker->query))
|
||||
if (nautilus_query_get_search_starred (tracker->query))
|
||||
{
|
||||
g_string_append_printf (sparql, "; nao:hasTag nao:predefined-tag-favorite");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* nautilus-favorite-directory.c
|
||||
/* nautilus-starred-directory.c
|
||||
*
|
||||
* Copyright (C) 2017 Alexandru Pandelea <alexandru.pandelea@gmail.com>
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "nautilus-favorite-directory.h"
|
||||
#include "nautilus-starred-directory.h"
|
||||
#include "nautilus-tag-manager.h"
|
||||
#include "nautilus-file-utilities.h"
|
||||
#include "nautilus-directory-private.h"
|
||||
|
@ -43,7 +43,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
NautilusFavoriteDirectory *favorite_directory;
|
||||
NautilusFavoriteDirectory *starred_directory;
|
||||
|
||||
NautilusDirectoryCallback callback;
|
||||
gpointer callback_data;
|
||||
|
@ -53,31 +53,31 @@ typedef struct
|
|||
GList *file_list;
|
||||
} FavoriteCallback;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (NautilusFavoriteDirectory, nautilus_favorite_directory, NAUTILUS_TYPE_DIRECTORY,
|
||||
G_DEFINE_TYPE_WITH_CODE (NautilusFavoriteDirectory, nautilus_starred_directory, NAUTILUS_TYPE_DIRECTORY,
|
||||
nautilus_ensure_extension_points ();
|
||||
g_io_extension_point_implement (NAUTILUS_DIRECTORY_PROVIDER_EXTENSION_POINT_NAME,
|
||||
g_define_type_id,
|
||||
NAUTILUS_FAVORITE_DIRECTORY_PROVIDER_NAME,
|
||||
NAUTILUS_STARRED_DIRECTORY_PROVIDER_NAME,
|
||||
0));
|
||||
|
||||
static void
|
||||
file_changed (NautilusFile *file,
|
||||
NautilusFavoriteDirectory *favorite)
|
||||
NautilusFavoriteDirectory *starred)
|
||||
{
|
||||
GList list;
|
||||
|
||||
list.data = file;
|
||||
list.next = NULL;
|
||||
|
||||
nautilus_directory_emit_files_changed (NAUTILUS_DIRECTORY (favorite), &list);
|
||||
nautilus_directory_emit_files_changed (NAUTILUS_DIRECTORY (starred), &list);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_favorite_directory_update_files (NautilusFavoriteDirectory *self)
|
||||
nautilus_starred_directory_update_files (NautilusFavoriteDirectory *self)
|
||||
{
|
||||
GList *l;
|
||||
GList *tmp_l;
|
||||
GList *new_favorite_files;
|
||||
GList *new_starred_files;
|
||||
GList *monitor_list;
|
||||
FavoriteMonitor *monitor;
|
||||
NautilusFile *file;
|
||||
|
@ -99,9 +99,9 @@ nautilus_favorite_directory_update_files (NautilusFavoriteDirectory *self)
|
|||
g_hash_table_add (uri_table, nautilus_file_get_uri (NAUTILUS_FILE (l->data)));
|
||||
}
|
||||
|
||||
new_favorite_files = nautilus_tag_manager_get_favorite_files (self->tag_manager);
|
||||
new_starred_files = nautilus_tag_manager_get_starred_files (self->tag_manager);
|
||||
|
||||
for (l = new_favorite_files; l != NULL; l = l->next)
|
||||
for (l = new_starred_files; l != NULL; l = l->next)
|
||||
{
|
||||
if (!g_hash_table_contains (uri_table, l->data))
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ nautilus_favorite_directory_update_files (NautilusFavoriteDirectory *self)
|
|||
{
|
||||
uri = nautilus_file_get_uri (NAUTILUS_FILE (l->data));
|
||||
|
||||
if (!nautilus_tag_manager_file_is_favorite (self->tag_manager, uri))
|
||||
if (!nautilus_tag_manager_file_is_starred (self->tag_manager, uri))
|
||||
{
|
||||
files_removed = g_list_prepend (files_removed,
|
||||
nautilus_file_ref (NAUTILUS_FILE (l->data)));
|
||||
|
@ -184,15 +184,15 @@ nautilus_favorite_directory_update_files (NautilusFavoriteDirectory *self)
|
|||
}
|
||||
|
||||
static void
|
||||
on_favorites_files_changed (NautilusTagManager *tag_manager,
|
||||
on_starred_files_changed (NautilusTagManager *tag_manager,
|
||||
GList *changed_files,
|
||||
gpointer user_data)
|
||||
{
|
||||
NautilusFavoriteDirectory *self;
|
||||
|
||||
self = NAUTILUS_FAVORITE_DIRECTORY (user_data);
|
||||
self = NAUTILUS_STARRED_DIRECTORY (user_data);
|
||||
|
||||
nautilus_favorite_directory_update_files (self);
|
||||
nautilus_starred_directory_update_files (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -202,11 +202,11 @@ real_contains_file (NautilusDirectory *directory,
|
|||
NautilusFavoriteDirectory *self;
|
||||
g_autofree gchar *uri = NULL;
|
||||
|
||||
self = NAUTILUS_FAVORITE_DIRECTORY (directory);
|
||||
self = NAUTILUS_STARRED_DIRECTORY (directory);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
return nautilus_tag_manager_file_is_favorite (self->tag_manager, uri);
|
||||
return nautilus_tag_manager_file_is_starred (self->tag_manager, uri);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -218,7 +218,7 @@ real_is_editable (NautilusDirectory *directory)
|
|||
static void
|
||||
real_force_reload (NautilusDirectory *directory)
|
||||
{
|
||||
nautilus_favorite_directory_update_files (NAUTILUS_FAVORITE_DIRECTORY (directory));
|
||||
nautilus_starred_directory_update_files (NAUTILUS_STARRED_DIRECTORY (directory));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -229,11 +229,11 @@ real_call_when_ready (NautilusDirectory *directory,
|
|||
gpointer callback_data)
|
||||
{
|
||||
GList *file_list;
|
||||
NautilusFavoriteDirectory *favorite;
|
||||
NautilusFavoriteDirectory *starred;
|
||||
|
||||
favorite = NAUTILUS_FAVORITE_DIRECTORY (directory);
|
||||
starred = NAUTILUS_STARRED_DIRECTORY (directory);
|
||||
|
||||
file_list = nautilus_file_list_copy (favorite->files);
|
||||
file_list = nautilus_file_list_copy (starred->files);
|
||||
|
||||
callback (NAUTILUS_DIRECTORY (directory),
|
||||
file_list,
|
||||
|
@ -256,24 +256,24 @@ real_file_monitor_add (NautilusDirectory *directory,
|
|||
{
|
||||
GList *list;
|
||||
FavoriteMonitor *monitor;
|
||||
NautilusFavoriteDirectory *favorite;
|
||||
NautilusFavoriteDirectory *starred;
|
||||
NautilusFile *file;
|
||||
|
||||
favorite = NAUTILUS_FAVORITE_DIRECTORY (directory);
|
||||
starred = NAUTILUS_STARRED_DIRECTORY (directory);
|
||||
|
||||
monitor = g_new0 (FavoriteMonitor, 1);
|
||||
monitor->monitor_hidden_files = monitor_hidden_files;
|
||||
monitor->monitor_attributes = file_attributes;
|
||||
monitor->client = client;
|
||||
|
||||
favorite->monitor_list = g_list_prepend (favorite->monitor_list, monitor);
|
||||
starred->monitor_list = g_list_prepend (starred->monitor_list, monitor);
|
||||
|
||||
if (callback != NULL)
|
||||
{
|
||||
(*callback) (directory, favorite->files, callback_data);
|
||||
(*callback) (directory, starred->files, callback_data);
|
||||
}
|
||||
|
||||
for (list = favorite->files; list != NULL; list = list->next)
|
||||
for (list = starred->files; list != NULL; list = list->next)
|
||||
{
|
||||
file = list->data;
|
||||
|
||||
|
@ -283,13 +283,13 @@ real_file_monitor_add (NautilusDirectory *directory,
|
|||
}
|
||||
|
||||
static void
|
||||
favorite_monitor_destroy (FavoriteMonitor *monitor,
|
||||
NautilusFavoriteDirectory *favorite)
|
||||
starred_monitor_destroy (FavoriteMonitor *monitor,
|
||||
NautilusFavoriteDirectory *starred)
|
||||
{
|
||||
GList *l;
|
||||
NautilusFile *file;
|
||||
|
||||
for (l = favorite->files; l != NULL; l = l->next)
|
||||
for (l = starred->files; l != NULL; l = l->next)
|
||||
{
|
||||
file = l->data;
|
||||
|
||||
|
@ -303,22 +303,22 @@ static void
|
|||
real_monitor_remove (NautilusDirectory *directory,
|
||||
gconstpointer client)
|
||||
{
|
||||
NautilusFavoriteDirectory *favorite;
|
||||
NautilusFavoriteDirectory *starred;
|
||||
FavoriteMonitor *monitor;
|
||||
GList *list;
|
||||
|
||||
favorite = NAUTILUS_FAVORITE_DIRECTORY (directory);
|
||||
starred = NAUTILUS_STARRED_DIRECTORY (directory);
|
||||
|
||||
for (list = favorite->monitor_list; list != NULL; list = list->next)
|
||||
for (list = starred->monitor_list; list != NULL; list = list->next)
|
||||
{
|
||||
monitor = list->data;
|
||||
|
||||
if (monitor->client != client)
|
||||
continue;
|
||||
|
||||
favorite->monitor_list = g_list_delete_link (favorite->monitor_list, list);
|
||||
starred->monitor_list = g_list_delete_link (starred->monitor_list, list);
|
||||
|
||||
favorite_monitor_destroy (monitor, favorite);
|
||||
starred_monitor_destroy (monitor, starred);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ real_handles_location (GFile *location)
|
|||
|
||||
uri = g_file_get_uri (location);
|
||||
|
||||
if (eel_uri_is_favorites (uri))
|
||||
if (eel_uri_is_starred (uri))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -340,21 +340,21 @@ real_handles_location (GFile *location)
|
|||
}
|
||||
|
||||
static FavoriteCallback*
|
||||
favorite_callback_find_pending (NautilusFavoriteDirectory *favorite,
|
||||
starred_callback_find_pending (NautilusFavoriteDirectory *starred,
|
||||
NautilusDirectoryCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
FavoriteCallback *favorite_callback;
|
||||
FavoriteCallback *starred_callback;
|
||||
GList *list;
|
||||
|
||||
for (list = favorite->pending_callback_list; list != NULL; list = list->next)
|
||||
for (list = starred->pending_callback_list; list != NULL; list = list->next)
|
||||
{
|
||||
favorite_callback = list->data;
|
||||
starred_callback = list->data;
|
||||
|
||||
if (favorite_callback->callback == callback &&
|
||||
favorite_callback->callback_data == callback_data)
|
||||
if (starred_callback->callback == callback &&
|
||||
starred_callback->callback_data == callback_data)
|
||||
{
|
||||
return favorite_callback;
|
||||
return starred_callback;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,21 +362,21 @@ favorite_callback_find_pending (NautilusFavoriteDirectory *favorite,
|
|||
}
|
||||
|
||||
static FavoriteCallback*
|
||||
favorite_callback_find (NautilusFavoriteDirectory *favorite,
|
||||
starred_callback_find (NautilusFavoriteDirectory *starred,
|
||||
NautilusDirectoryCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
FavoriteCallback *favorite_callback;
|
||||
FavoriteCallback *starred_callback;
|
||||
GList *list;
|
||||
|
||||
for (list = favorite->callback_list; list != NULL; list = list->next)
|
||||
for (list = starred->callback_list; list != NULL; list = list->next)
|
||||
{
|
||||
favorite_callback = list->data;
|
||||
starred_callback = list->data;
|
||||
|
||||
if (favorite_callback->callback == callback &&
|
||||
favorite_callback->callback_data == callback_data)
|
||||
if (starred_callback->callback == callback &&
|
||||
starred_callback->callback_data == callback_data)
|
||||
{
|
||||
return favorite_callback;
|
||||
return starred_callback;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,11 +384,11 @@ favorite_callback_find (NautilusFavoriteDirectory *favorite,
|
|||
}
|
||||
|
||||
static void
|
||||
favorite_callback_destroy (FavoriteCallback *favorite_callback)
|
||||
starred_callback_destroy (FavoriteCallback *starred_callback)
|
||||
{
|
||||
nautilus_file_list_free (favorite_callback->file_list);
|
||||
nautilus_file_list_free (starred_callback->file_list);
|
||||
|
||||
g_free (favorite_callback);
|
||||
g_free (starred_callback);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -396,46 +396,46 @@ real_cancel_callback (NautilusDirectory *directory,
|
|||
NautilusDirectoryCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
NautilusFavoriteDirectory *favorite;
|
||||
FavoriteCallback *favorite_callback;
|
||||
NautilusFavoriteDirectory *starred;
|
||||
FavoriteCallback *starred_callback;
|
||||
|
||||
favorite = NAUTILUS_FAVORITE_DIRECTORY (directory);
|
||||
favorite_callback = favorite_callback_find (favorite, callback, callback_data);
|
||||
starred = NAUTILUS_STARRED_DIRECTORY (directory);
|
||||
starred_callback = starred_callback_find (starred, callback, callback_data);
|
||||
|
||||
if (favorite_callback)
|
||||
if (starred_callback)
|
||||
{
|
||||
favorite->callback_list = g_list_remove (favorite->callback_list, favorite_callback);
|
||||
starred->callback_list = g_list_remove (starred->callback_list, starred_callback);
|
||||
|
||||
favorite_callback_destroy (favorite_callback);
|
||||
starred_callback_destroy (starred_callback);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check for a pending callback */
|
||||
favorite_callback = favorite_callback_find_pending (favorite, callback, callback_data);
|
||||
starred_callback = starred_callback_find_pending (starred, callback, callback_data);
|
||||
|
||||
if (favorite_callback)
|
||||
if (starred_callback)
|
||||
{
|
||||
favorite->pending_callback_list = g_list_remove (favorite->pending_callback_list, favorite_callback);
|
||||
starred->pending_callback_list = g_list_remove (starred->pending_callback_list, starred_callback);
|
||||
|
||||
favorite_callback_destroy (favorite_callback);
|
||||
starred_callback_destroy (starred_callback);
|
||||
}
|
||||
}
|
||||
|
||||
static GList*
|
||||
real_get_file_list (NautilusDirectory *directory)
|
||||
{
|
||||
NautilusFavoriteDirectory *favorite;
|
||||
NautilusFavoriteDirectory *starred;
|
||||
|
||||
favorite = NAUTILUS_FAVORITE_DIRECTORY (directory);
|
||||
starred = NAUTILUS_STARRED_DIRECTORY (directory);
|
||||
|
||||
return nautilus_file_list_copy (favorite->files);
|
||||
return nautilus_file_list_copy (starred->files);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_favorite_directory_set_files (NautilusFavoriteDirectory *self)
|
||||
nautilus_starred_directory_set_files (NautilusFavoriteDirectory *self)
|
||||
{
|
||||
GList *favorite_files;
|
||||
GList *starred_files;
|
||||
NautilusFile *file;
|
||||
GList *l;
|
||||
GList *file_list;
|
||||
|
@ -444,9 +444,9 @@ nautilus_favorite_directory_set_files (NautilusFavoriteDirectory *self)
|
|||
|
||||
file_list = NULL;
|
||||
|
||||
favorite_files = nautilus_tag_manager_get_favorite_files (self->tag_manager);
|
||||
starred_files = nautilus_tag_manager_get_starred_files (self->tag_manager);
|
||||
|
||||
for (l = favorite_files; l != NULL; l = l->next)
|
||||
for (l = starred_files; l != NULL; l = l->next)
|
||||
{
|
||||
file = nautilus_file_get_by_uri ((gchar*) l->data);
|
||||
|
||||
|
@ -469,43 +469,43 @@ nautilus_favorite_directory_set_files (NautilusFavoriteDirectory *self)
|
|||
}
|
||||
|
||||
static void
|
||||
nautilus_favorite_directory_finalize (GObject *object)
|
||||
nautilus_starred_directory_finalize (GObject *object)
|
||||
{
|
||||
NautilusFavoriteDirectory *self;
|
||||
|
||||
self = NAUTILUS_FAVORITE_DIRECTORY (object);
|
||||
self = NAUTILUS_STARRED_DIRECTORY (object);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (self->tag_manager,
|
||||
on_favorites_files_changed,
|
||||
on_starred_files_changed,
|
||||
self);
|
||||
|
||||
g_object_unref (self->tag_manager);
|
||||
nautilus_file_list_free (self->files);
|
||||
|
||||
G_OBJECT_CLASS (nautilus_favorite_directory_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (nautilus_starred_directory_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_favorite_directory_dispose (GObject *object)
|
||||
nautilus_starred_directory_dispose (GObject *object)
|
||||
{
|
||||
NautilusFavoriteDirectory *favorite;
|
||||
NautilusFavoriteDirectory *starred;
|
||||
GList *l;
|
||||
GList *monitor_list;
|
||||
FavoriteMonitor *monitor;
|
||||
NautilusFile *file;
|
||||
|
||||
favorite = NAUTILUS_FAVORITE_DIRECTORY (object);
|
||||
starred = NAUTILUS_STARRED_DIRECTORY (object);
|
||||
|
||||
/* Remove file connections */
|
||||
for (l = favorite->files; l != NULL; l = l->next)
|
||||
for (l = starred->files; l != NULL; l = l->next)
|
||||
{
|
||||
file = l->data;
|
||||
|
||||
/* Disconnect change handler */
|
||||
g_signal_handlers_disconnect_by_func (file, file_changed, favorite);
|
||||
g_signal_handlers_disconnect_by_func (file, file_changed, starred);
|
||||
|
||||
/* Remove monitors */
|
||||
for (monitor_list = favorite->monitor_list; monitor_list;
|
||||
for (monitor_list = starred->monitor_list; monitor_list;
|
||||
monitor_list = monitor_list->next)
|
||||
{
|
||||
monitor = monitor_list->data;
|
||||
|
@ -514,22 +514,22 @@ nautilus_favorite_directory_dispose (GObject *object)
|
|||
}
|
||||
|
||||
/* Remove search monitors */
|
||||
if (favorite->monitor_list)
|
||||
if (starred->monitor_list)
|
||||
{
|
||||
for (l = favorite->monitor_list; l != NULL; l = l->next)
|
||||
for (l = starred->monitor_list; l != NULL; l = l->next)
|
||||
{
|
||||
favorite_monitor_destroy ((FavoriteMonitor*) l->data, favorite);
|
||||
starred_monitor_destroy ((FavoriteMonitor*) l->data, starred);
|
||||
}
|
||||
|
||||
g_list_free (favorite->monitor_list);
|
||||
favorite->monitor_list = NULL;
|
||||
g_list_free (starred->monitor_list);
|
||||
starred->monitor_list = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (nautilus_favorite_directory_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (nautilus_starred_directory_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_favorite_directory_class_init (NautilusFavoriteDirectoryClass *klass)
|
||||
nautilus_starred_directory_class_init (NautilusFavoriteDirectoryClass *klass)
|
||||
{
|
||||
GObjectClass *oclass;
|
||||
NautilusDirectoryClass *directory_class;
|
||||
|
@ -537,8 +537,8 @@ nautilus_favorite_directory_class_init (NautilusFavoriteDirectoryClass *klass)
|
|||
oclass = G_OBJECT_CLASS (klass);
|
||||
directory_class = NAUTILUS_DIRECTORY_CLASS (klass);
|
||||
|
||||
oclass->finalize = nautilus_favorite_directory_finalize;
|
||||
oclass->dispose = nautilus_favorite_directory_dispose;
|
||||
oclass->finalize = nautilus_starred_directory_finalize;
|
||||
oclass->dispose = nautilus_starred_directory_dispose;
|
||||
|
||||
directory_class->handles_location = real_handles_location;
|
||||
directory_class->contains_file = real_contains_file;
|
||||
|
@ -553,29 +553,29 @@ nautilus_favorite_directory_class_init (NautilusFavoriteDirectoryClass *klass)
|
|||
}
|
||||
|
||||
NautilusFavoriteDirectory*
|
||||
nautilus_favorite_directory_new ()
|
||||
nautilus_starred_directory_new ()
|
||||
{
|
||||
NautilusFavoriteDirectory *self;
|
||||
|
||||
self = g_object_new (NAUTILUS_TYPE_FAVORITE_DIRECTORY, NULL);
|
||||
self = g_object_new (NAUTILUS_TYPE_STARRED_DIRECTORY, NULL);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_favorite_directory_init (NautilusFavoriteDirectory *self)
|
||||
nautilus_starred_directory_init (NautilusFavoriteDirectory *self)
|
||||
{
|
||||
NautilusTagManager *tag_manager;
|
||||
|
||||
tag_manager = nautilus_tag_manager_get ();
|
||||
|
||||
g_signal_connect (tag_manager,
|
||||
"favorites-changed",
|
||||
(GCallback) on_favorites_files_changed,
|
||||
"starred-changed",
|
||||
(GCallback) on_starred_files_changed,
|
||||
self);
|
||||
|
||||
self->tag_manager = tag_manager;
|
||||
|
||||
nautilus_favorite_directory_set_files (self);
|
||||
nautilus_starred_directory_set_files (self);
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* nautilus-favorite-directory.h
|
||||
/* nautilus-starred-directory.h
|
||||
*
|
||||
* Copyright (C) 2017 Alexandru Pandelea <alexandru.pandelea@gmail.com>
|
||||
*
|
||||
|
@ -16,20 +16,20 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_FAVORITE_DIRECTORY_H
|
||||
#define NAUTILUS_FAVORITE_DIRECTORY_H
|
||||
#ifndef NAUTILUS_STARRED_DIRECTORY_H
|
||||
#define NAUTILUS_STARRED_DIRECTORY_H
|
||||
|
||||
#include "nautilus-directory.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define NAUTILUS_FAVORITE_DIRECTORY_PROVIDER_NAME "favorite-directory-provider"
|
||||
#define NAUTILUS_STARRED_DIRECTORY_PROVIDER_NAME "starred-directory-provider"
|
||||
|
||||
#define NAUTILUS_TYPE_FAVORITE_DIRECTORY (nautilus_favorite_directory_get_type ())
|
||||
#define NAUTILUS_TYPE_STARRED_DIRECTORY (nautilus_starred_directory_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (NautilusFavoriteDirectory, nautilus_favorite_directory, NAUTILUS, FAVORITE_DIRECTORY, NautilusDirectory);
|
||||
G_DECLARE_FINAL_TYPE (NautilusFavoriteDirectory, nautilus_starred_directory, NAUTILUS, STARRED_DIRECTORY, NautilusDirectory);
|
||||
|
||||
NautilusFavoriteDirectory* nautilus_favorite_directory_new ();
|
||||
NautilusFavoriteDirectory* nautilus_starred_directory_new ();
|
||||
|
||||
G_END_DECLS
|
||||
|
|
@ -30,7 +30,7 @@ struct _NautilusTagManager
|
|||
TrackerNotifier *notifier;
|
||||
GError *notifier_error;
|
||||
|
||||
GHashTable *favorite_files;
|
||||
GHashTable *starred_files;
|
||||
GCancellable *cancellable;
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,7 @@ static NautilusTagManager *tag_manager = NULL;
|
|||
|
||||
typedef enum
|
||||
{
|
||||
GET_FAVORITE_FILES,
|
||||
GET_STARRED_FILES,
|
||||
GET_IDS_FOR_URLS
|
||||
} OperationType;
|
||||
|
||||
|
@ -65,7 +65,7 @@ typedef struct
|
|||
|
||||
enum
|
||||
{
|
||||
FAVORITES_CHANGED,
|
||||
STARRED_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -200,9 +200,9 @@ on_query_callback (GObject *object,
|
|||
{
|
||||
if (error->code != G_IO_ERROR_CANCELLED)
|
||||
{
|
||||
if (op_type == GET_FAVORITE_FILES)
|
||||
if (op_type == GET_STARRED_FILES)
|
||||
{
|
||||
g_warning ("Error on getting favorite files: %s", error->message);
|
||||
g_warning ("Error on getting starred files: %s", error->message);
|
||||
}
|
||||
else if (op_type == GET_IDS_FOR_URLS)
|
||||
{
|
||||
|
@ -259,14 +259,14 @@ on_update_callback (GObject *object,
|
|||
id = g_new0 (gint64, 1);
|
||||
|
||||
*id = (gint64) g_hash_table_lookup (data->ids, uri);
|
||||
g_hash_table_insert (data->tag_manager->favorite_files,
|
||||
g_hash_table_insert (data->tag_manager->starred_files,
|
||||
nautilus_file_get_uri (NAUTILUS_FILE (l->data)),
|
||||
id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_hash_table_remove (data->tag_manager->favorite_files, uri);
|
||||
g_hash_table_remove (data->tag_manager->starred_files, uri);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
|
@ -276,13 +276,13 @@ on_update_callback (GObject *object,
|
|||
{
|
||||
NautilusFileUndoInfo *undo_info;
|
||||
|
||||
undo_info = nautilus_file_undo_info_favorites_new (data->selection, data->star);
|
||||
undo_info = nautilus_file_undo_info_starred_new (data->selection, data->star);
|
||||
nautilus_file_undo_manager_set_action (undo_info);
|
||||
|
||||
g_object_unref (undo_info);
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (data->tag_manager, "favorites-changed", nautilus_file_list_copy (data->selection));
|
||||
g_signal_emit_by_name (data->tag_manager, "starred-changed", nautilus_file_list_copy (data->selection));
|
||||
|
||||
g_task_return_boolean (data->task, TRUE);
|
||||
g_object_unref (data->task);
|
||||
|
@ -344,13 +344,13 @@ get_query_status (TrackerSparqlCursor *cursor,
|
|||
}
|
||||
|
||||
GList*
|
||||
nautilus_tag_manager_get_favorite_files (NautilusTagManager *self)
|
||||
nautilus_tag_manager_get_starred_files (NautilusTagManager *self)
|
||||
{
|
||||
return g_hash_table_get_keys (self->favorite_files);
|
||||
return g_hash_table_get_keys (self->starred_files);
|
||||
}
|
||||
|
||||
static void
|
||||
on_get_favorite_files_cursor_callback (GObject *object,
|
||||
on_get_starred_files_cursor_callback (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -366,7 +366,7 @@ on_get_favorite_files_cursor_callback (GObject *object,
|
|||
|
||||
self = NAUTILUS_TAG_MANAGER (user_data);
|
||||
|
||||
success = get_query_status (cursor, result, GET_FAVORITE_FILES, NULL);
|
||||
success = get_query_status (cursor, result, GET_STARRED_FILES, NULL);
|
||||
if (!success)
|
||||
{
|
||||
return;
|
||||
|
@ -377,25 +377,25 @@ on_get_favorite_files_cursor_callback (GObject *object,
|
|||
url = tracker_sparql_cursor_get_string (cursor, 0, NULL);
|
||||
*id = tracker_sparql_cursor_get_integer (cursor, 1);
|
||||
|
||||
g_hash_table_insert (self->favorite_files,
|
||||
g_hash_table_insert (self->starred_files,
|
||||
g_strdup (url),
|
||||
id);
|
||||
|
||||
file = nautilus_file_get_by_uri (url);
|
||||
changed_files = g_list_prepend (NULL, file);
|
||||
|
||||
g_signal_emit_by_name (self, "favorites-changed", changed_files);
|
||||
g_signal_emit_by_name (self, "starred-changed", changed_files);
|
||||
|
||||
nautilus_file_list_free (changed_files);
|
||||
|
||||
tracker_sparql_cursor_next_async (cursor,
|
||||
self->cancellable,
|
||||
on_get_favorite_files_cursor_callback,
|
||||
on_get_starred_files_cursor_callback,
|
||||
self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_get_favorite_files_query_callback (GObject *object,
|
||||
on_get_starred_files_query_callback (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -406,13 +406,13 @@ on_get_favorite_files_query_callback (GObject *object,
|
|||
on_query_callback (object,
|
||||
result,
|
||||
user_data,
|
||||
on_get_favorite_files_cursor_callback,
|
||||
GET_FAVORITE_FILES,
|
||||
on_get_starred_files_cursor_callback,
|
||||
GET_STARRED_FILES,
|
||||
self->cancellable);
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_tag_manager_query_favorite_files (NautilusTagManager *self,
|
||||
nautilus_tag_manager_query_starred_files (NautilusTagManager *self,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
GString *query;
|
||||
|
@ -422,7 +422,7 @@ nautilus_tag_manager_query_favorite_files (NautilusTagManager *self,
|
|||
query = g_string_new ("SELECT ?url tracker:id(?urn) WHERE { ?urn nie:url ?url ; nao:hasTag nao:predefined-tag-favorite}");
|
||||
|
||||
start_query_or_update (query,
|
||||
on_get_favorite_files_query_callback,
|
||||
on_get_starred_files_query_callback,
|
||||
self,
|
||||
TRUE,
|
||||
cancellable);
|
||||
|
@ -474,10 +474,10 @@ nautilus_tag_manager_insert_tag (NautilusTagManager *self,
|
|||
}
|
||||
|
||||
gboolean
|
||||
nautilus_tag_manager_file_is_favorite (NautilusTagManager *self,
|
||||
nautilus_tag_manager_file_is_starred (NautilusTagManager *self,
|
||||
const gchar *file_name)
|
||||
{
|
||||
return g_hash_table_contains (self->favorite_files, file_name);
|
||||
return g_hash_table_contains (self->starred_files, file_name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -715,7 +715,7 @@ on_tracker_notifier_events(TrackerNotifier *notifier,
|
|||
tracker_notifier_event_get_id (event));
|
||||
|
||||
/* check if the file changed it's location and update hash table if so */
|
||||
new_location_uri = nautilus_tag_manager_file_with_id_changed_url (self->favorite_files,
|
||||
new_location_uri = nautilus_tag_manager_file_with_id_changed_url (self->starred_files,
|
||||
tracker_notifier_event_get_id (event),
|
||||
location_uri);
|
||||
if (new_location_uri)
|
||||
|
@ -723,15 +723,15 @@ on_tracker_notifier_events(TrackerNotifier *notifier,
|
|||
id = g_new0 (gint64, 1);
|
||||
*id = tracker_notifier_event_get_id (event);
|
||||
|
||||
g_hash_table_remove (self->favorite_files, new_location_uri);
|
||||
g_hash_table_insert (self->favorite_files,
|
||||
g_hash_table_remove (self->starred_files, new_location_uri);
|
||||
g_hash_table_insert (self->starred_files,
|
||||
g_strdup (location_uri),
|
||||
id);
|
||||
|
||||
file = nautilus_file_get_by_uri (location_uri);
|
||||
changed_files = g_list_prepend (NULL, file);
|
||||
|
||||
g_signal_emit_by_name (self, "favorites-changed", changed_files);
|
||||
g_signal_emit_by_name (self, "starred-changed", changed_files);
|
||||
|
||||
nautilus_file_list_free (changed_files);
|
||||
}
|
||||
|
@ -765,33 +765,33 @@ on_tracker_notifier_events(TrackerNotifier *notifier,
|
|||
{
|
||||
query_has_results = tracker_sparql_cursor_next (cursor, NULL, &error);
|
||||
|
||||
/* if no results are found, then the file isn't marked as favorite.
|
||||
/* if no results are found, then the file isn't marked as starred.
|
||||
* If needed, update the hashtable.
|
||||
*/
|
||||
if (!query_has_results && location_uri && g_hash_table_contains (self->favorite_files, location_uri))
|
||||
if (!query_has_results && location_uri && g_hash_table_contains (self->starred_files, location_uri))
|
||||
{
|
||||
g_hash_table_remove (self->favorite_files, location_uri);
|
||||
g_hash_table_remove (self->starred_files, location_uri);
|
||||
|
||||
file = nautilus_file_get_by_uri (location_uri);
|
||||
changed_files = g_list_prepend (NULL, file);
|
||||
|
||||
g_signal_emit_by_name (self, "favorites-changed", changed_files);
|
||||
g_signal_emit_by_name (self, "starred-changed", changed_files);
|
||||
|
||||
nautilus_file_list_free (changed_files);
|
||||
}
|
||||
else if (query_has_results && location_uri && !g_hash_table_contains (self->favorite_files, location_uri))
|
||||
else if (query_has_results && location_uri && !g_hash_table_contains (self->starred_files, location_uri))
|
||||
{
|
||||
id = g_new0 (gint64, 1);
|
||||
*id = tracker_notifier_event_get_id (event);
|
||||
|
||||
g_hash_table_insert (self->favorite_files,
|
||||
g_hash_table_insert (self->starred_files,
|
||||
g_strdup (location_uri),
|
||||
id);
|
||||
|
||||
file = nautilus_file_get_by_uri (location_uri);
|
||||
changed_files = g_list_prepend (NULL, file);
|
||||
|
||||
g_signal_emit_by_name (self, "favorites-changed", changed_files);
|
||||
g_signal_emit_by_name (self, "starred-changed", changed_files);
|
||||
|
||||
nautilus_file_list_free (changed_files);
|
||||
}
|
||||
|
@ -818,7 +818,7 @@ nautilus_tag_manager_finalize (GObject *object)
|
|||
self);
|
||||
g_clear_object (&self->notifier);
|
||||
|
||||
g_hash_table_destroy (self->favorite_files);
|
||||
g_hash_table_destroy (self->starred_files);
|
||||
|
||||
G_OBJECT_CLASS (nautilus_tag_manager_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -832,7 +832,7 @@ nautilus_tag_manager_class_init (NautilusTagManagerClass *klass)
|
|||
|
||||
oclass->finalize = nautilus_tag_manager_finalize;
|
||||
|
||||
signals[FAVORITES_CHANGED] = g_signal_new ("favorites-changed",
|
||||
signals[STARRED_CHANGED] = g_signal_new ("starred-changed",
|
||||
NAUTILUS_TYPE_TAG_MANAGER,
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
|
@ -860,7 +860,7 @@ NautilusTagManager* nautilus_tag_manager_get ()
|
|||
void nautilus_tag_manager_set_cancellable (NautilusTagManager *tag_manager,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
nautilus_tag_manager_query_favorite_files (tag_manager, cancellable);
|
||||
nautilus_tag_manager_query_starred_files (tag_manager, cancellable);
|
||||
|
||||
tag_manager->notifier = tracker_notifier_new (NULL,
|
||||
TRACKER_NOTIFIER_FLAG_QUERY_LOCATION,
|
||||
|
@ -877,7 +877,7 @@ void nautilus_tag_manager_set_cancellable (NautilusTagManager *tag_manager,
|
|||
static void
|
||||
nautilus_tag_manager_init (NautilusTagManager *self)
|
||||
{
|
||||
self->favorite_files = g_hash_table_new_full (g_str_hash,
|
||||
self->starred_files = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) g_free);
|
||||
|
|
|
@ -34,7 +34,7 @@ NautilusTagManager* nautilus_tag_manager_get ();
|
|||
void nautilus_tag_manager_set_cancellable (NautilusTagManager *tag_manager,
|
||||
GCancellable *cancellable);
|
||||
|
||||
GList* nautilus_tag_manager_get_favorite_files (NautilusTagManager *self);
|
||||
GList* nautilus_tag_manager_get_starred_files (NautilusTagManager *self);
|
||||
|
||||
void nautilus_tag_manager_star_files (NautilusTagManager *self,
|
||||
GObject *object,
|
||||
|
@ -49,7 +49,7 @@ void nautilus_tag_manager_unstar_files (NautilusTagManager
|
|||
GCancellable *cancellable);
|
||||
|
||||
|
||||
gboolean nautilus_tag_manager_file_is_favorite (NautilusTagManager *self,
|
||||
gboolean nautilus_tag_manager_file_is_starred (NautilusTagManager *self,
|
||||
const gchar *file_name);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -1131,7 +1131,7 @@ places_sidebar_show_starred_location (NautilusWindow *window,
|
|||
{
|
||||
GFile *location;
|
||||
|
||||
location = g_file_new_for_uri ("favorites:///");
|
||||
location = g_file_new_for_uri ("starred:///");
|
||||
|
||||
open_location_cb (window, location, open_flags);
|
||||
|
||||
|
@ -1801,7 +1801,7 @@ in_app_notification_undo_unstar_get_label (NautilusFileUndoInfo *undo_info)
|
|||
gchar *label;
|
||||
gint length;
|
||||
|
||||
files = nautilus_file_undo_info_favorites_get_files (NAUTILUS_FILE_UNDO_INFO_FAVORITES (undo_info));
|
||||
files = nautilus_file_undo_info_starred_get_files (NAUTILUS_FILE_UNDO_INFO_STARRED (undo_info));
|
||||
length = g_list_length (files);
|
||||
if (length == 1)
|
||||
{
|
||||
|
@ -1854,7 +1854,7 @@ nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
|
|||
label = in_app_notification_undo_deleted_get_label (undo_info);
|
||||
}
|
||||
}
|
||||
else if (nautilus_file_undo_info_get_op_type (undo_info) == NAUTILUS_FILE_UNDO_OP_FAVORITES)
|
||||
else if (nautilus_file_undo_info_get_op_type (undo_info) == NAUTILUS_FILE_UNDO_OP_STARRED)
|
||||
{
|
||||
NautilusWindowSlot *active_slot;
|
||||
GFile *location;
|
||||
|
@ -1864,9 +1864,9 @@ nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
|
|||
/* Don't pop up a notification if the focus is not in the this
|
||||
* window. This is an easy way to know from which window was the
|
||||
* unstart operation made */
|
||||
if (eel_uri_is_favorites (g_file_get_uri (location)) &&
|
||||
if (eel_uri_is_starred (g_file_get_uri (location)) &&
|
||||
gtk_window_has_toplevel_focus (GTK_WINDOW (window)) &&
|
||||
!nautilus_file_undo_info_favorites_is_favorited (NAUTILUS_FILE_UNDO_INFO_FAVORITES (undo_info)))
|
||||
!nautilus_file_undo_info_starred_is_starred (NAUTILUS_FILE_UNDO_INFO_STARRED (undo_info)))
|
||||
{
|
||||
popup_notification = TRUE;
|
||||
label = in_app_notification_undo_unstar_get_label (undo_info);
|
||||
|
|
|
@ -222,12 +222,12 @@
|
|||
<attribute name="hidden-when">action-disabled</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes" context="menu item" comments="Marks a file as starred (favorite)">Star</attribute>
|
||||
<attribute name="label" translatable="yes" context="menu item" comments="Marks a file as starred (starred)">Star</attribute>
|
||||
<attribute name="action">view.star</attribute>
|
||||
<attribute name="hidden-when">action-disabled</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes" context="menu item" comments="Unmarks a file as starred (favorite)">Unstar</attribute>
|
||||
<attribute name="label" translatable="yes" context="menu item" comments="Unmarks a file as starred (starred)">Unstar</attribute>
|
||||
<attribute name="action">view.unstar</attribute>
|
||||
<attribute name="hidden-when">action-disabled</attribute>
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue