mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
Follow the "OnlyShowIn" and "NotShowIn" == GNOME keys for .desktop files,
2009-01-31 Cosimo Cecchi <cosimoc@gnome.org> * libnautilus-private/nautilus-directory-async.c (lacks_link_info), (monitor_includes_file), (link_info_done), (link_info_got_data), (link_info_start): * libnautilus-private/nautilus-file-private.h: * libnautilus-private/nautilus-file.c (nautilus_file_clear_info), (nautilus_file_should_show), (filter_hidden_and_backup_partition_callback), (nautilus_file_is_foreign_link): * libnautilus-private/nautilus-file.h: * libnautilus-private/nautilus-link.c (string_array_contains), (nautilus_link_get_link_info_given_file_contents): * libnautilus-private/nautilus-link.h: * src/file-manager/fm-desktop-icon-view.c (fm_desktop_icon_view_init): * src/file-manager/fm-directory-view.c (fm_directory_view_init), (fm_directory_view_should_show_file), (fm_directory_view_set_show_foreign): * src/file-manager/fm-directory-view.h: * src/file-manager/fm-tree-model.c (should_show_file): Follow the "OnlyShowIn" and "NotShowIn" == GNOME keys for .desktop files, when they are put on the desktop. Thanks to Federico Mena Quintero and Jared Moore (#338933). svn path=/trunk/; revision=14905
This commit is contained in:
parent
28f06e0a6b
commit
8f976b5f28
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2009-01-31 Cosimo Cecchi <cosimoc@gnome.org>
|
||||
|
||||
* libnautilus-private/nautilus-directory-async.c (lacks_link_info),
|
||||
(monitor_includes_file), (link_info_done), (link_info_got_data),
|
||||
(link_info_start):
|
||||
* libnautilus-private/nautilus-file-private.h:
|
||||
* libnautilus-private/nautilus-file.c (nautilus_file_clear_info),
|
||||
(nautilus_file_should_show),
|
||||
(filter_hidden_and_backup_partition_callback),
|
||||
(nautilus_file_is_foreign_link):
|
||||
* libnautilus-private/nautilus-file.h:
|
||||
* libnautilus-private/nautilus-link.c (string_array_contains),
|
||||
(nautilus_link_get_link_info_given_file_contents):
|
||||
* libnautilus-private/nautilus-link.h:
|
||||
* src/file-manager/fm-desktop-icon-view.c
|
||||
(fm_desktop_icon_view_init):
|
||||
* src/file-manager/fm-directory-view.c (fm_directory_view_init),
|
||||
(fm_directory_view_should_show_file),
|
||||
(fm_directory_view_set_show_foreign):
|
||||
* src/file-manager/fm-directory-view.h:
|
||||
* src/file-manager/fm-tree-model.c (should_show_file):
|
||||
Follow the "OnlyShowIn" and "NotShowIn" == GNOME keys for
|
||||
.desktop files, when they are put on the desktop.
|
||||
Thanks to Federico Mena Quintero and Jared Moore (#338933).
|
||||
|
||||
2009-01-29 Cosimo Cecchi <cosimoc@gnome.org>
|
||||
|
||||
* libnautilus-private/nautilus-autorun.c: (handle_dialog_closure),
|
||||
|
|
|
@ -199,7 +199,8 @@ static void link_info_done (NautilusDirectory
|
|||
const char *uri,
|
||||
const char *name,
|
||||
const char *icon,
|
||||
gboolean is_launcher);
|
||||
gboolean is_launcher,
|
||||
gboolean is_foreign);
|
||||
static void move_file_to_low_priority_queue (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
static void move_file_to_extension_queue (NautilusDirectory *directory,
|
||||
|
@ -1733,7 +1734,7 @@ lacks_link_info (NautilusFile *file)
|
|||
if (nautilus_file_is_nautilus_link (file)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
link_info_done (file->details->directory, file, NULL, NULL, NULL, FALSE);
|
||||
link_info_done (file->details->directory, file, NULL, NULL, NULL, FALSE, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
|
@ -2381,7 +2382,8 @@ monitor_includes_file (const Monitor *monitor,
|
|||
}
|
||||
return nautilus_file_should_show (file,
|
||||
monitor->monitor_hidden_files,
|
||||
monitor->monitor_backup_files);
|
||||
monitor->monitor_backup_files,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -3575,7 +3577,8 @@ link_info_done (NautilusDirectory *directory,
|
|||
const char *uri,
|
||||
const char *name,
|
||||
const char *icon,
|
||||
gboolean is_launcher)
|
||||
gboolean is_launcher,
|
||||
gboolean is_foreign)
|
||||
{
|
||||
file->details->link_info_is_up_to_date = TRUE;
|
||||
|
||||
|
@ -3593,6 +3596,7 @@ link_info_done (NautilusDirectory *directory,
|
|||
}
|
||||
file->details->custom_icon = g_strdup (icon);
|
||||
file->details->is_launcher = is_launcher;
|
||||
file->details->is_foreign_link = is_foreign;
|
||||
|
||||
nautilus_directory_async_state_changed (directory);
|
||||
}
|
||||
|
@ -3639,6 +3643,7 @@ link_info_got_data (NautilusDirectory *directory,
|
|||
{
|
||||
char *link_uri, *uri, *name, *icon;
|
||||
gboolean is_launcher;
|
||||
gboolean is_foreign;
|
||||
|
||||
nautilus_directory_ref (directory);
|
||||
|
||||
|
@ -3646,19 +3651,20 @@ link_info_got_data (NautilusDirectory *directory,
|
|||
name = NULL;
|
||||
icon = NULL;
|
||||
is_launcher = FALSE;
|
||||
is_foreign = FALSE;
|
||||
|
||||
/* Handle the case where we read the Nautilus link. */
|
||||
if (result) {
|
||||
link_uri = nautilus_file_get_uri (file);
|
||||
nautilus_link_get_link_info_given_file_contents (file_contents, bytes_read, link_uri,
|
||||
&uri, &name, &icon, &is_launcher);
|
||||
&uri, &name, &icon, &is_launcher, &is_foreign);
|
||||
g_free (link_uri);
|
||||
} else {
|
||||
/* FIXME bugzilla.gnome.org 42433: We should report this error to the user. */
|
||||
}
|
||||
|
||||
nautilus_file_ref (file);
|
||||
link_info_done (directory, file, uri, name, icon, is_launcher);
|
||||
link_info_done (directory, file, uri, name, icon, is_launcher, is_foreign);
|
||||
nautilus_file_changed (file);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
|
@ -3746,7 +3752,7 @@ link_info_start (NautilusDirectory *directory,
|
|||
|
||||
/* If it's not a link we are done. If it is, we need to read it. */
|
||||
if (!nautilus_style_link) {
|
||||
link_info_done (directory, file, NULL, NULL, NULL, FALSE);
|
||||
link_info_done (directory, file, NULL, NULL, NULL, FALSE, FALSE);
|
||||
} else if (should_read_link_info_sync (file)) {
|
||||
result = g_file_load_contents (location, NULL, &file_contents, &file_size, NULL, NULL);
|
||||
link_info_got_data (directory, file, result, file_size, file_contents);
|
||||
|
|
|
@ -198,6 +198,7 @@ struct NautilusFileDetails
|
|||
eel_boolean_bit has_open_window : 1;
|
||||
|
||||
eel_boolean_bit is_launcher : 1;
|
||||
eel_boolean_bit is_foreign_link : 1;
|
||||
eel_boolean_bit is_symlink : 1;
|
||||
eel_boolean_bit is_mountpoint : 1;
|
||||
eel_boolean_bit is_hidden : 1;
|
||||
|
|
|
@ -330,6 +330,7 @@ nautilus_file_clear_info (NautilusFile *file)
|
|||
file->details->thumbnailing_failed = FALSE;
|
||||
|
||||
file->details->is_launcher = FALSE;
|
||||
file->details->is_foreign_link = FALSE;
|
||||
file->details->is_symlink = FALSE;
|
||||
file->details->is_hidden = FALSE;
|
||||
file->details->is_backup = FALSE;
|
||||
|
@ -2790,14 +2791,16 @@ is_file_hidden (NautilusFile *file)
|
|||
gboolean
|
||||
nautilus_file_should_show (NautilusFile *file,
|
||||
gboolean show_hidden,
|
||||
gboolean show_backup)
|
||||
gboolean show_backup,
|
||||
gboolean show_foreign)
|
||||
{
|
||||
/* Never hide any files in trash. */
|
||||
if (nautilus_file_is_in_trash (file)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return (show_hidden || (!nautilus_file_is_hidden_file (file) && !is_file_hidden (file))) &&
|
||||
(show_backup || !nautilus_file_is_backup_file (file));
|
||||
(show_backup || !nautilus_file_is_backup_file (file)) &&
|
||||
(show_foreign || !(nautilus_file_is_in_desktop (file) && nautilus_file_is_foreign_link (file)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2837,7 +2840,8 @@ filter_hidden_and_backup_partition_callback (gpointer data,
|
|||
|
||||
return nautilus_file_should_show (file,
|
||||
options & SHOW_HIDDEN,
|
||||
options & SHOW_BACKUP);
|
||||
options & SHOW_BACKUP,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
GList *
|
||||
|
@ -3200,6 +3204,12 @@ nautilus_file_is_launcher (NautilusFile *file)
|
|||
return file->details->is_launcher;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_file_is_foreign_link (NautilusFile *file)
|
||||
{
|
||||
return file->details->is_foreign_link;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_file_has_activation_uri (NautilusFile *file)
|
||||
{
|
||||
|
|
|
@ -387,7 +387,8 @@ gboolean nautilus_file_is_hidden_file (Nautilu
|
|||
gboolean nautilus_file_is_backup_file (NautilusFile *file);
|
||||
gboolean nautilus_file_should_show (NautilusFile *file,
|
||||
gboolean show_hidden,
|
||||
gboolean show_backup);
|
||||
gboolean show_backup,
|
||||
gboolean show_foreign);
|
||||
GList *nautilus_file_list_filter_hidden_and_backup (GList *files,
|
||||
gboolean show_hidden,
|
||||
gboolean show_backup);
|
||||
|
@ -397,6 +398,7 @@ GList *nautilus_file_list_filter_hidden_and_backup (GList
|
|||
* Getting this can require reading the contents of the file.
|
||||
*/
|
||||
gboolean nautilus_file_is_launcher (NautilusFile *file);
|
||||
gboolean nautilus_file_is_foreign_link (NautilusFile *file);
|
||||
gboolean nautilus_file_has_activation_uri (NautilusFile *file);
|
||||
char * nautilus_file_get_activation_uri (NautilusFile *file);
|
||||
GFile * nautilus_file_get_activation_location (NautilusFile *file);
|
||||
|
|
|
@ -502,6 +502,23 @@ nautilus_link_local_get_link_uri (const char *uri)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
string_array_contains (char **array,
|
||||
const char *str)
|
||||
{
|
||||
char **p;
|
||||
|
||||
if (!array)
|
||||
return FALSE;
|
||||
|
||||
for (p = array; *p; p++)
|
||||
if (g_ascii_strcasecmp (*p, str) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_link_get_link_info_given_file_contents (const char *file_contents,
|
||||
int link_file_size,
|
||||
|
@ -509,10 +526,13 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents,
|
|||
char **uri,
|
||||
char **name,
|
||||
char **icon,
|
||||
gboolean *is_launcher)
|
||||
gboolean *is_launcher,
|
||||
gboolean *is_foreign)
|
||||
{
|
||||
GKeyFile *key_file;
|
||||
char *type;
|
||||
char **only_show_in;
|
||||
char **not_show_in;
|
||||
|
||||
if (!is_link_data (file_contents, link_file_size)) {
|
||||
return;
|
||||
|
@ -539,6 +559,21 @@ nautilus_link_get_link_info_given_file_contents (const char *file_contents,
|
|||
*is_launcher = TRUE;
|
||||
}
|
||||
g_free (type);
|
||||
|
||||
|
||||
*is_foreign = FALSE;
|
||||
only_show_in = g_key_file_get_string_list (key_file, MAIN_GROUP,
|
||||
"OnlyShowIn", NULL, NULL);
|
||||
if (only_show_in && !string_array_contains (only_show_in, "GNOME")) {
|
||||
*is_foreign = TRUE;
|
||||
}
|
||||
g_strfreev (only_show_in);
|
||||
|
||||
not_show_in = g_key_file_get_string_list (key_file, MAIN_GROUP,
|
||||
"NotShowIn", NULL, NULL);
|
||||
if (not_show_in && string_array_contains (not_show_in, "GNOME")) {
|
||||
*is_foreign = TRUE;
|
||||
}
|
||||
g_strfreev (not_show_in);
|
||||
|
||||
g_key_file_free (key_file);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ void nautilus_link_get_link_info_given_file_contents (const char
|
|||
char **uri,
|
||||
char **name,
|
||||
char **icon,
|
||||
gboolean *is_launcher);
|
||||
gboolean *is_launcher,
|
||||
gboolean *is_foreign);
|
||||
|
||||
#endif /* NAUTILUS_LINK_H */
|
||||
|
|
|
@ -562,6 +562,9 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view)
|
|||
|
||||
fm_directory_view_ignore_hidden_file_preferences
|
||||
(FM_DIRECTORY_VIEW (desktop_icon_view));
|
||||
|
||||
fm_directory_view_set_show_foreign (FM_DIRECTORY_VIEW (desktop_icon_view),
|
||||
FALSE);
|
||||
|
||||
/* Set our default layout mode */
|
||||
nautilus_icon_container_set_layout_mode (icon_container,
|
||||
|
|
|
@ -233,6 +233,7 @@ struct FMDirectoryViewDetails
|
|||
|
||||
gboolean sort_directories_first;
|
||||
|
||||
gboolean show_foreign_files;
|
||||
gboolean show_hidden_files;
|
||||
gboolean show_backup_files;
|
||||
gboolean ignore_hidden_file_preferences;
|
||||
|
@ -1861,6 +1862,9 @@ fm_directory_view_init (FMDirectoryView *view)
|
|||
|
||||
view->details = g_new0 (FMDirectoryViewDetails, 1);
|
||||
|
||||
/* Default to true; desktop-icon-view sets to false */
|
||||
view->details->show_foreign_files = TRUE;
|
||||
|
||||
view->details->non_ready_files =
|
||||
g_hash_table_new_full (file_and_directory_hash,
|
||||
file_and_directory_equal,
|
||||
|
@ -8891,7 +8895,8 @@ fm_directory_view_should_show_file (FMDirectoryView *view, NautilusFile *file)
|
|||
{
|
||||
return nautilus_file_should_show (file,
|
||||
view->details->show_hidden_files,
|
||||
view->details->show_backup_files);
|
||||
view->details->show_backup_files,
|
||||
view->details->show_foreign_files);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -9007,6 +9012,13 @@ fm_directory_view_ignore_hidden_file_preferences (FMDirectoryView *view)
|
|||
view->details->ignore_hidden_file_preferences = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
fm_directory_view_set_show_foreign (FMDirectoryView *view,
|
||||
gboolean show_foreign)
|
||||
{
|
||||
view->details->show_foreign_files = show_foreign;
|
||||
}
|
||||
|
||||
char *
|
||||
fm_directory_view_get_uri (FMDirectoryView *view)
|
||||
{
|
||||
|
|
|
@ -436,6 +436,8 @@ void fm_directory_view_new_file (FMDirect
|
|||
const char *parent_uri,
|
||||
NautilusFile *source);
|
||||
void fm_directory_view_ignore_hidden_file_preferences (FMDirectoryView *view);
|
||||
void fm_directory_view_set_show_foreign (FMDirectoryView *view,
|
||||
gboolean show_foreign);
|
||||
void fm_directory_view_init_view_iface (NautilusViewIface *iface);
|
||||
void fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view,
|
||||
const char *encoded_url,
|
||||
|
|
|
@ -901,7 +901,8 @@ should_show_file (FMTreeModel *model, NautilusFile *file)
|
|||
|
||||
should = nautilus_file_should_show (file,
|
||||
model->details->show_hidden_files,
|
||||
model->details->show_backup_files);
|
||||
model->details->show_backup_files,
|
||||
TRUE);
|
||||
|
||||
if (should
|
||||
&& model->details->show_only_directories
|
||||
|
|
Loading…
Reference in a new issue