Use custom configuration given as \fICONFIG-FILE\fP.
This will also be applied on new spawned instances.
.TP
+.BI "\-p, \-\-profile " "PROFILE-NAME"
+Create or open specified configuration profile. Configuration data for the profile is stored in a directory named \fIPROFILE-NAME\fP under default directory for configuration data.
+.TP
.BI "\-e, \-\-embed " "WINID"
.I WINID
of an XEmbed-aware application, that Vimb will use as its parent.
.PD
.RE
.TP
+.I $XDG_CONFIG_HOME/vimb/PROFILE-NAME
+Directory for configuration data if executed with \fB-p \fIPROFILE-NAME\fR parameter. It has same structure as default directory for configuration data.
+.TP
.I $XDG_CACHE_HOME/vimb/
Default directory for cache data.
.TP
+.I $XDG_CACHE_HOME/vimb/PROFILE-NAME
+Directory for cache data if executed with \fB-p \fIPROFILE-NAME\fR parameter.
+.TP
.I $XDG_RUNTIME_DIR/vimb/socket/
Directory where the control sockets are placed.
+.TP
+.I $XDG_RUNTIME_DIR/vimb/PROFILE-NAME/socket/
+Directory where the control sockets are placed if executed with \fB-p \fIPROFILE-NAME\fR parameter.
.PP
There are also some sample scripts installed together with Vimb under
PREFIX/share/vimb/examples.
struct sockaddr_un local;
/* create socket in runtime directory */
- dir = g_build_filename(g_get_user_runtime_dir(), PROJECT, "socket", NULL);
+ dir = g_build_filename(util_get_runtime_dir(vb.config.profile), PROJECT, "socket", NULL);
util_create_dir_if_not_exists(dir);
path = g_build_filename(dir, name, NULL);
g_free(dir);
3 /* basename + uri + ending NULL */
+ (vb.embed ? 2 : 0)
+ (vb.config.file ? 2 : 0)
+ + (vb.config.profile ? 2 : 0)
+ (vb.config.kioskmode ? 1 : 0)
#ifdef FEATURE_SOCKET
+ (vb.config.socket ? 1 : 0)
cmd[i++] = "-c";
cmd[i++] = vb.config.file;
}
+ if (vb.config.profile) {
+ cmd[i++] = "-p";
+ cmd[i++] = vb.config.profile;
+ }
for (GSList *l = vb.config.cmdargs; l; l = l->next) {
cmd[i++] = "-C";
cmd[i++] = l->data;
static void init_files(void)
{
- char *path = util_get_config_dir();
+ char *path = util_get_config_dir(vb.config.profile);
if (vb.config.file) {
char *rp = realpath(vb.config.file, NULL);
#endif
#ifdef FEATURE_SOUP_CACHE
/* setup the soup cache but without setting the cache size - this is done in setting.c */
- char *cache_dir = util_get_cache_dir();
+ char *cache_dir = util_get_cache_dir(vb.config.profile);
vb.config.soup_cache = soup_cache_new(cache_dir, SOUP_CACHE_SINGLE_USER);
soup_session_add_feature(vb.session, SOUP_SESSION_FEATURE(vb.config.soup_cache));
soup_cache_load(vb.config.soup_cache);
static GOptionEntry opts[] = {
{"cmd", 'C', 0, G_OPTION_ARG_CALLBACK, autocmdOptionArgFunc, "Ex command run before first page is loaded", NULL},
{"config", 'c', 0, G_OPTION_ARG_FILENAME, &vb.config.file, "Custom configuration file", NULL},
+ {"profile", 'p', 0, G_OPTION_ARG_STRING, &vb.config.profile, "Profile name", NULL},
{"embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "Reparents to window specified by xid", NULL},
#ifdef FEATURE_SOCKET
{"dump", 'd', 0, G_OPTION_ARG_NONE, &dump, "Dump the socket path to stdout", NULL},
char *nextpattern; /* regex patter nfor prev link matching */
char *prevpattern; /* regex patter nfor next link matching */
char *file; /* path to the custome config file */
+ char *profile; /* profile name */
GSList *cmdargs; /* list of commands given by --cmd option */
char *cafile; /* path to the ca file */
GTlsDatabase *tls_db; /* tls database */
static gboolean match_list(const char *pattern, int patlen, const char *subject);
/**
- * Retrieves newly allocated string with vimb config directory.
- * Retruned string must be freed.
+ * Retrieves newly allocated string with vimb config directory with profilename.
+ * If profilename is NULL, path to default directory is returned.
+ * Returned string must be freed.
+ */
+char *util_get_config_dir(const char *profilename)
+{
+ char *path = g_build_filename(g_get_user_config_dir(), PROJECT, G_DIR_SEPARATOR_S, profilename, NULL);
+ util_create_dir_if_not_exists(path);
+
+ return path;
+}
+
+/**
+ * Retrieves the path to the cache dir with profilename
+ * If profilename is NULL, path to default directory is returned.
+ * Returned string must be freed.
*/
-char *util_get_config_dir(void)
+char *util_get_cache_dir(const char *profilename)
{
- char *path = g_build_filename(g_get_user_config_dir(), PROJECT, NULL);
+ char *path = g_build_filename(g_get_user_cache_dir(), PROJECT, G_DIR_SEPARATOR_S, profilename, NULL);
util_create_dir_if_not_exists(path);
return path;
}
/**
- * Retrieves the path to the cach dir.
+ * Retrieves the path to the socket dir with profilename
+ * If profilename is NULL, path to default directory is returned.
* Returned string must be freed.
*/
-char *util_get_cache_dir(void)
+char *util_get_runtime_dir(const char *profilename)
{
- char *path = g_build_filename(g_get_user_cache_dir(), PROJECT, NULL);
+ char *path = g_build_filename(g_get_user_runtime_dir(), PROJECT, G_DIR_SEPARATOR_S, profilename, NULL);
util_create_dir_if_not_exists(path);
return path;
typedef void *(*Util_Content_Func)(const char*, const char*);
-char* util_get_config_dir(void);
-char* util_get_cache_dir(void);
+char* util_get_config_dir(const char* profilename);
+char* util_get_cache_dir(const char* profilename);
+char* util_get_runtime_dir(const char* profilename);
const char* util_get_home_dir(void);
void util_create_dir_if_not_exists(const char* dirpath);
void util_create_file_if_not_exists(const char* filename);