![]() |
![]() |
![]() |
Epiphany Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum EphyMimePermission; const char * ephy_file (const char *filename
); gboolean ephy_file_browse_to (GFile *file
,guint32 user_time
); EphyMimePermission ephy_file_check_mime (const char *mime_type
); void ephy_file_delete_on_exit (GFile *file
); void ephy_file_delete_uri (const char *uri
); char * ephy_file_desktop_dir (void
); GSList * ephy_file_find (const char *path
,const char *fname
,gint maxdepth
); char * ephy_file_get_downloads_dir (void
); gboolean ephy_file_helpers_init (const char *profile_dir
,EphyFileHelpersFlags flags
,GError **error
); void ephy_file_helpers_shutdown (void
); gboolean ephy_file_launch_application (GAppInfo *app
,GList *files
,guint32 user_time
,GtkWidget *widget
); gboolean ephy_file_launch_desktop_file (const char *filename
,const char *parameter
,guint32 user_time
,GtkWidget *widget
); gboolean ephy_file_launch_handler (const char *mime_type
,GFile *file
,guint32 user_time
); gboolean ephy_file_switch_temp_file (GFile *file_dest
,GFile *file_temp
); const char * ephy_file_tmp_dir (void
); char * ephy_file_tmp_filename (const char *base
,const char *extension
); char * ephy_file_create_data_uri_for_filename (const char *filename
,const char *mime_type
); char * ephy_sanitize_filename (char *filename
);
typedef enum { EPHY_MIME_PERMISSION_SAFE = 1, EPHY_MIME_PERMISSION_UNSAFE = 2, EPHY_MIME_PERMISSION_UNKNOWN = 3 } EphyMimePermission;
const char * ephy_file (const char *filename
);
Looks for filename
in Epiphany's directories and relevant paths.
|
the name of the Epiphany file requested |
Returns : |
the full path to the requested file |
gboolean ephy_file_browse_to (GFile *file
,guint32 user_time
);
Launches the default application for browsing directories, with file
's
parent directory as its target. Passes user_time
to
ephy_file_launch_handler()
to prevent focus stealing.
EphyMimePermission ephy_file_check_mime (const char *mime_type
);
Checks mime_type
against our safe/unsafe database of types, returns an
EphyMimePermission.
|
a mime type |
Returns : |
an EphyMimePermission |
void ephy_file_delete_on_exit (GFile *file
);
Schedules file
to be deleted when Epiphany exits. This function currently
does nothing.
|
a GFile |
void ephy_file_delete_uri (const char *uri
);
Remove the given URI.
|
URI of the file to be deleted |
char * ephy_file_desktop_dir (void
);
Gets the XDG desktop dir path or a default homedir/Desktop alternative.
Returns : |
a newly-allocated string containing the desktop dir path. |
GSList * ephy_file_find (const char *path
,const char *fname
,gint maxdepth
);
Searchs for fname
in path
with a maximum depth of maxdepth
.
|
path to search for fname
|
|
filename to search for |
|
maximum directory depth when searching path
|
Returns : |
a GSList of matches |
char * ephy_file_get_downloads_dir (void
);
Returns a proper downloads destination by checking the EPHY_PREFS_STATE_DOWNLOAD_DIR GSettings key and following this logic:
- An absolute path: considered user-set, use this value directly.
- "Desktop" keyword in GSettings: the directory returned by
ephy_file_desktop_dir()
.
- "Downloads" keyword in GSettings, or any other value: the XDG downloads directory, or ~/Downloads.
Returns : |
a newly-allocated string containing the path to the downloads dir. |
gboolean ephy_file_helpers_init (const char *profile_dir
,EphyFileHelpersFlags flags
,GError **error
);
Initializes Epiphany file helper functions, sets profile_dir
as Epiphany's
profile dir and whether the running session will be private.
void ephy_file_helpers_shutdown (void
);
Cleans file helpers information, corresponds to ephy_file_helpers_init()
.
gboolean ephy_file_launch_application (GAppInfo *app
,GList *files
,guint32 user_time
,GtkWidget *widget
);
Launches app
to open files
. If widget
is set the screen and display from
it will be used to launch the application, otherwise the defaults will be
used.
|
the application to launch |
|
files to pass to app
|
|
user time to prevent focus stealing |
|
a relevant widget from where to get the GdkScreen and GdkDisplay |
Returns : |
TRUE if g_app_info_launch() succeeded |
gboolean ephy_file_launch_desktop_file (const char *filename
,const char *parameter
,guint32 user_time
,GtkWidget *widget
);
Calls ephy_file_launch_application()
for the application described by the
.desktop file filename
. Can pass parameter
as optional file arguments.
|
the path to the .desktop file |
|
path to an optional parameter file to pass to the application |
|
user time to prevent focus stealing |
|
an optional widget for ephy_file_launch_application()
|
Returns : |
TRUE if the application launch was successful |
gboolean ephy_file_launch_handler (const char *mime_type
,GFile *file
,guint32 user_time
);
Launches file
with its default handler application, if mime_type
is NULL
then file
will be queried for its type.
gboolean ephy_file_switch_temp_file (GFile *file_dest
,GFile *file_temp
);
Moves file_temp
to file_dest
atomically, doing a backup and restoring it if
something fails.
|
destination file |
|
file to move to file
|
Returns : |
TRUE if the switch was successful |
const char * ephy_file_tmp_dir (void
);
Returns the name of the temp dir for the running Epiphany instance.
Returns : |
the name of the temp dir, this string belongs to Epiphany. |
char * ephy_file_tmp_filename (const char *base
,const char *extension
);
Gets a usable temp filename with g_mkstemp()
using base
as the name
with an optional extension
. base
should contain "XXXXXX" in it.
Notice that this does not create the file. It only gets a valid filename.
char * ephy_file_create_data_uri_for_filename (const char *filename
,const char *mime_type
);
Create a data uri using the contents of filename
.
If mime_type
is NULL
, the G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
attribute of filename
will be used.
char * ephy_sanitize_filename (char *filename
);
Sanitize filename
to make sure it's a valid filename. If the
filename contains directory separators, they will be converted to
underscores, so that they are not interpreted as a path by the
filesystem.
Note that it modifies string in place. The return value is to allow nesting.
|
a filename |
Returns : |
the sanitized filename |