1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ 2 3 /* caja-file-utilities.h - interface for file manipulation routines. 4 5 Copyright (C) 1999, 2000, 2001 Eazel, Inc. 6 7 The Mate Library is free software; you can redistribute it and/or 8 modify it under the terms of the GNU Library General Public License as 9 published by the Free Software Foundation; either version 2 of the 10 License, or (at your option) any later version. 11 12 The Mate Library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Library General Public License for more details. 16 17 You should have received a copy of the GNU Library General Public 18 License along with the Mate Library; see the file COPYING.LIB. If not, 19 write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 20 Boston, MA 02110-1301, USA. 21 22 Authors: John Sullivan <sullivan@eazel.com> 23 */ 24 25 #ifndef CAJA_FILE_UTILITIES_H 26 #define CAJA_FILE_UTILITIES_H 27 28 #include <gio/gio.h> 29 #include <gtk/gtk.h> 30 31 #define CAJA_SAVED_SEARCH_EXTENSION ".savedSearch" 32 #define CAJA_SAVED_SEARCH_MIMETYPE "application/x-mate-saved-search" 33 34 /* These functions all return something something that needs to be 35 * freed with g_free, is not NULL, and is guaranteed to exist. 36 */ 37 char * caja_get_xdg_dir (const char *type); 38 char * caja_get_user_directory (void); 39 char * caja_get_desktop_directory (void); 40 GFile * caja_get_desktop_location (void); 41 char * caja_get_desktop_directory_uri (void); 42 char * caja_get_home_directory_uri (void); 43 gboolean caja_is_desktop_directory_file (GFile *dir, 44 const char *filename); 45 gboolean caja_is_root_directory (GFile *dir); 46 gboolean caja_is_desktop_directory (GFile *dir); 47 gboolean caja_is_home_directory (GFile *dir); 48 gboolean caja_is_home_directory_file (GFile *dir, 49 const char *filename); 50 GMount * caja_get_mounted_mount_for_root (GFile *location); 51 gboolean caja_is_in_desktop_dir (GFile *file); 52 gboolean caja_is_in_system_dir (GFile *file); 53 char * caja_get_pixmap_directory (void); 54 55 gboolean caja_should_use_templates_directory (void); 56 char * caja_get_templates_directory (void); 57 char * caja_get_templates_directory_uri (void); 58 void caja_create_templates_directory (void); 59 60 char * caja_compute_title_for_location (GFile *file); 61 62 /* A version of mate's mate_pixmap_file that works for the caja prefix. 63 * Otherwise similar to mate_pixmap_file in that it checks to see if the file 64 * exists and returns NULL if it doesn't. 65 */ 66 /* FIXME bugzilla.gnome.org 42425: 67 * We might not need this once we get on mate-libs 2.0 which handles 68 * mate_pixmap_file better, using MATE_PATH. 69 */ 70 char * caja_pixmap_file (const char *partial_path); 71 72 /* Locate a file in either the uers directory or the datadir. */ 73 char * caja_get_data_file_path (const char *partial_path); 74 75 gboolean caja_is_engrampa_installed (void); 76 77 /* Inhibit/Uninhibit MATE Power Manager */ 78 int caja_inhibit_power_manager (const char *message) G_GNUC_WARN_UNUSED_RESULT; 79 void caja_uninhibit_power_manager (int cookie); 80 81 /* Return an allocated file name that is guranteed to be unique, but 82 * tries to make the name readable to users. 83 * This isn't race-free, so don't use for security-related things 84 */ 85 char * caja_ensure_unique_file_name (const char *directory_uri, 86 const char *base_name, 87 const char *extension); 88 89 GFile * caja_find_existing_uri_in_hierarchy (GFile *location); 90 91 char * caja_get_accel_map_file (void); 92 93 GHashTable * caja_trashed_files_get_original_directories (GList *files, 94 GList **unhandled_files); 95 void caja_restore_files_from_trash (GList *files, 96 GtkWindow *parent_window); 97 char * caja_get_filesystem_id_by_location (GFile *location, gboolean follow); 98 char * caja_get_filesystem_id_by_uri (const char *uri, gboolean follow); 99 100 #endif /* CAJA_FILE_UTILITIES_H */ 101