62
61
static GHashTable *files = NULL;
63
62
static GHashTable *mime_table = NULL;
65
static gboolean have_private_profile = FALSE;
66
64
static gboolean keep_temp_directory = FALSE; /* for debug purposes */
67
65
static char *dot_dir = NULL;
68
66
static char *tmp_dir = NULL;
277
* ephy_has_private_profile:
279
* Whether Epiphany is running with a private profile (-p command line option).
281
* Returns: %TRUE if a private profile is in use
284
ephy_has_private_profile (void)
286
return have_private_profile;
290
275
* ephy_file_helpers_init:
291
276
* @profile_dir: directory to use as Epiphany's profile
292
277
* @private_profile: %TRUE if we should use a private profile
398
382
if (!keep_temp_directory)
400
/* recursively delete the contents and the directory */
401
ephy_file_delete_directory (tmp_dir);
385
tmp_dir_file = g_file_new_for_path (tmp_dir);
387
/* recursively delete the contents and the
389
LOG ("shutdown: delete tmp_dir %s", tmp_dir);
390
ephy_file_delete_dir_recursively (tmp_dir_file,
392
g_object_unref (tmp_dir_file);
404
395
g_free (tmp_dir);
754
745
* ephy_file_launch_desktop_file:
755
746
* @filename: the path to the .desktop file
756
* @parameter: path to a parameter file to pass to the application
747
* @parameter: path to an optional parameter file to pass to the application
757
748
* @user_time: user time to prevent focus stealing
758
749
* @widget: an optional widget for ephy_file_launch_application()
769
760
GtkWidget *widget)
771
762
GDesktopAppInfo *app;
773
764
GList *list = NULL;
776
767
app = g_desktop_app_info_new (filename);
777
file = g_file_new_for_path (parameter);
778
list = g_list_append (list, file);
770
file = g_file_new_for_path (parameter);
771
list = g_list_append (list, file);
780
774
ret = ephy_file_launch_application (G_APP_INFO (app), list, user_time, widget);
781
775
g_list_free (list);
782
g_object_unref (file);
777
g_object_unref (file);
863
858
ephy_file_browse_to (GFile *file,
864
859
guint32 user_time)
869
parent = g_file_get_parent (file);
870
/* TODO find a way to make nautilus scroll to the actual file */
871
ret = ephy_file_launch_handler ("inode/directory",
875
g_object_unref (parent);
861
return ephy_file_launch_handler ("inode/directory", file, user_time);
881
* ephy_file_delete_directory:
882
* @path: the path to remove
865
* ephy_file_delete_dir_recursively:
866
* @directory: directory to remove
867
* @error: location to set any #GError
884
869
* Remove @path and its contents. Like calling rm -rf @path.
887
ephy_file_delete_directory (const char *path)
872
ephy_file_delete_dir_recursively (GFile *directory, GError **error)
892
file = g_file_new_for_path (path);
894
ret = g_file_delete (file, NULL, NULL);
898
LOG ("Deleted dir '%s'", path);
902
LOG ("Couldn't delete dir '%s'", path);
904
g_object_unref (file);
874
GFileEnumerator *children = NULL;
878
children = g_file_enumerate_children (directory,
879
"standard::name,standard::type",
884
info = g_file_enumerator_next_file (children, NULL, error);
885
while (info || error) {
893
name = g_file_info_get_name (info);
894
child = g_file_get_child (directory, name);
895
type = g_file_info_get_file_type (info);
897
LOG ("ephy-file-delete-dir: delete child %s", name);
898
if (type == G_FILE_TYPE_DIRECTORY)
899
ret = ephy_file_delete_dir_recursively (child, error);
900
else if (type == G_FILE_TYPE_REGULAR)
901
ret = g_file_delete (child, NULL, error);
903
g_object_unref (info);
908
info = g_file_enumerator_next_file (children, NULL, error);
913
LOG ("ephy-file-delete-dir: delete successful");
914
g_file_delete (directory, NULL, error);
918
g_object_unref (children);
933
949
g_object_unref (file);
953
get_accels_filename (void)
957
home = g_get_home_dir();
960
return g_build_filename (home, GNOME_DOT_GNOME, "accels", PACKAGE, NULL);
964
ephy_file_load_accels (void)
968
filename = get_accels_filename ();
972
gtk_accel_map_load (filename);
977
ephy_file_save_accels (void)
981
filename = get_accels_filename ();
985
gtk_accel_map_save (filename);