1 2 #ifndef __MIME_H__ 3 # define __MIME_H__ 4 5 # include "rfm.h" 6 # define MIME_hashtype(x) ((gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "find_mimetype_in_hash")) 7 8 # define MIME_file(x) ((gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_file")) 9 10 # define MIME_command_icon(x) ((const gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_command_icon")) 11 12 # define MIME_command_text(x) ((const gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_command_text")) 13 # define MIME_command_text2(x) ((const gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_command_text2")) 14 # define MIME_command_output(x) (GPOINTER_TO_INT(rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_command_output"))) 15 # define MIME_command_output_ext(x) ((const gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_command_output_ext")) 16 17 # define MIME_command(x) ((gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_command")) 18 # define MIME_apps(x) ((gchar **)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_apps")) 19 # define MIME_magic(x) ((gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_magic")) 20 # define MIME_encoding(x) ((gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_encoding")) 21 //# define MIME_typeinfo(x) ((gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_typeinfo")) 22 # define MIME_is_valid_command(x) (GPOINTER_TO_INT(rfm_natural(RFM_MODULE_DIR, "mime", (void *)x, "mime_is_valid_command"))) 23 # define MIME_mk_terminal_line(x) ((gchar *)rfm_natural(RFM_MODULE_DIR, "mime", (void *)(x), "mime_mk_terminal_line")) 24 25 # define MIME_type(x, y) ((gchar *)rfm_rational(RFM_MODULE_DIR, "mime", (void *)(x), (void *)(y), "mime_type")) 26 # define MIME_add(x, y) (rfm_rational(RFM_MODULE_DIR, "mime", (void *)(x), (void *)(y), "mime_add")) 27 # define MIME_mk_command_line(x, y) ((gchar *)rfm_rational(RFM_MODULE_DIR, "mime", (void *)(x), (void *)(y), "mime_mk_command_line")) 28 29 /****************************************************************/ 30 /** 31 * mime_get_type: 32 * @file: NULL terminated string with full path of file to query. 33 * @flags: bitwise TRY_STAT and/or TRY_MAGIC or zero. 34 * 35 * Returns: string with the mime type, or "undetermined type" 36 * if no mime type is associated. 37 * 38 * 39 G_MODULE_EXPORT 40 gchar * 41 mime_type(const gchar *file, struct stat *st_p); 42 */ 43 44 /****************************************************************/ 45 /** 46 * mime_command: 47 * @type: Mimetype to query for associated application 48 * 49 * As there may be more than one application associated, 50 * use mime_apps() if you want all of them. This function 51 * returns the default application, which is the last associated 52 * application entered into the association hash. 53 * 54 * Returns: string with the default application for @file, or 55 * NULL if there is no application associated. * 56 * 57 G_MODULE_EXPORT gchar *mime_command (gchar * type); 58 59 ****************************************************************/ 60 /** 61 * mime_apps: 62 * @file: Path of file to query for associated applications. 63 * 64 * Returns: array of strings with associated applications. The last 65 * element of the array is a NULL pointer. If no applications are 66 * associated, returns NULL. 67 * 68 * 69 G_MODULE_EXPORT gchar **mime_apps (gchar * type); 70 71 ****************************************************************/ 72 /** 73 * mk_command_line: 74 * @command_fmt: Command string to execute. 75 * @path: Path to file to send with command. 76 * @interm: TRUE if to execute within a terminal window. 77 * @hold: TRUE if to hold the output of a terminal window on 78 * completion of command. 79 * 80 * A command string may have %s to indicate the position where the 81 * path is to be inserted. Otherwise the path is appended. 82 * 83 * Returns: A string with the command line constructed, suitable for 84 * a g_spawn_async() or similar. 85 * 86 **/ 87 88 /****************************************************************/ 89 /** 90 * mime_typeinfo: 91 * @type: the mimetype for which information is being requested 92 * 93 * Returns: A string with mimetype information. 94 * 95 **/ 96 97 /****************************************************************/ 98 /** 99 * mime_add: 100 * @file: File to associate command with. 101 * @command: Command to associate. 102 * 103 * This associates a command with a file type, determined by the file 104 * extension. When this command is used, the associated command becomes 105 * the default command for the file type while the module remains 106 * loaded. 107 * 108 * 109 **/ 110 111 /****************************************************************/ 112 /** 113 * is_valid_command: 114 * @cmd_fmt: command to check for. 115 * 116 * Checks whether @cmd_fmt is in $PATH and whether it can be executed. 117 * 118 * 119 * Returns: TRUE if @cmd_fmt can be executed, FALSE otherwise. 120 **/ 121 122 #endif 123