Ejemplo n.º 1
0
void fl_set_working_dir(const gchar *dir)
{
	gchar *aux;

	if (dir == NULL || strcmp(working_dir->str, dir) == 0)
		return;

	/* set the new working_dir */
	g_string_assign(working_dir, dir);
	expand_dir(working_dir);

	aux = str_filename_to_utf8(working_dir->str, NULL);
	if (aux == NULL) {
		/* if we can't convert to UTF-8, leave it as is
		   (let Gtk do the complaining...) */
		g_string_assign(working_dir_utf8, dir);
	}
	else {
		g_string_assign(working_dir_utf8, aux);
		free(aux);
	}
	
	gtk_entry_set_text(ent_wd, working_dir_utf8->str);
	
	/* update the directory mru list */
	mru_add(dir_mru, working_dir_utf8->str);

	gtk_combo_box_text_remove_all(combo_wd);
	g_list_foreach(GLIST(dir_mru->list), glist_2_combo, combo_wd);

	if (check_working_dir())
		load_file_list();
	else
		clear_file_list();
}
Ejemplo n.º 2
0
static void
set_group_index_defaults (void)
{
	if (!MU_CONFIG.maildir)
		MU_CONFIG.maildir = mu_util_guess_maildir ();

	expand_dir (MU_CONFIG.maildir);
}
Ejemplo n.º 3
0
int
expand_snapshot(clicon_handle h, char *name, cvec *vars, cg_var *arg, int *nr, char ***commands, char ***helptexts)
{
    char           *dir;

    dir = clicon_archive_dir(h);
    return expand_dir(dir, nr, commands, S_IFREG, 1);
}
Ejemplo n.º 4
0
static void
set_group_extract_defaults (void)
{
	if (!MU_CONFIG.targetdir)
		MU_CONFIG.targetdir = g_strdup (".");

	expand_dir (MU_CONFIG.targetdir);
}
Ejemplo n.º 5
0
status_t ArpMultiDir::AddSearchPath(const char* path, const char* leaf)
{
	if( !path ) return B_OK;
	
	char* mypath = strdup(path);
	if( !mypath ) return B_NO_MEMORY;
	
	char* base = mypath;
	status_t ret = B_OK;
	while( *base ) {
		bool need_repl = false;
		char* buffer;
		while( *mypath != ':' && *mypath != 0 ) {
			if( *mypath == '%' ) need_repl = true;
			mypath++;
		}
		char endc = *mypath;
		*mypath = 0;
		
		if( need_repl ) {
			int32 size = expand_dir(NULL,base);
			buffer = (char*)malloc(size);
			if( buffer ) {
				expand_dir(buffer,base);
				base = buffer;
			} else ret = B_NO_MEMORY;
		} else buffer = NULL;
		
		if( ret == B_OK ) ret = AddDirectory(base, leaf);
		else AddDirectory(base, leaf);
		
		*mypath = endc;
		if( *mypath != 0 ) mypath++;
		base = mypath;
		
		if( buffer ) free(buffer);
	}
	return ret;
}
Ejemplo n.º 6
0
void fl_set_working_dir_utf8(const gchar *dir)
{
	gchar *aux;

	if (dir == NULL || strcmp(working_dir_utf8->str, dir) == 0)
		return;

	/* set the new working_dir */
	g_string_assign(working_dir_utf8, dir);

	aux = str_filename_from_utf8(working_dir_utf8->str, NULL);
	if (aux == NULL) {
		/* if we can't convert from UTF-8, leave it as is
		   (loading from the filesystem will just fail) */
		g_string_assign(working_dir, dir);
	}
	else {
		g_string_assign(working_dir, aux);
		free(aux);
	}
	
	if (expand_dir(working_dir)) {
		// need to reflect back to utf
		aux = str_filename_to_utf8(working_dir->str, NULL);
		if (aux != NULL)
			g_string_assign(working_dir_utf8, aux);
		free(aux);
	}
	
	gtk_entry_set_text(ent_wd, working_dir_utf8->str);
	
	/* update the directory mru list */
	mru_add(dir_mru, working_dir_utf8->str);
	gtk_combo_box_text_remove_all(combo_wd);
	g_list_foreach(GLIST(dir_mru->list), glist_2_combo, combo_wd);


	if (check_working_dir())
		load_file_list();
	else
		clear_file_list();
}
Ejemplo n.º 7
0
static void
set_group_find_defaults (void)
{
	/* note, when no fields are specified, we use
	 * date-from-subject, and sort descending by date. If fields
	 * *are* specified, we sort in ascending order. */
	if (!MU_CONFIG.fields) {
		MU_CONFIG.fields = "d f s";
		if (!MU_CONFIG.sortfield)
			MU_CONFIG.sortfield = "d";
	}

	if (!MU_CONFIG.formatstr) /* by default, use plain output */
		MU_CONFIG.format = MU_CONFIG_FORMAT_PLAIN;
	else
		MU_CONFIG.format =
			get_output_format (MU_CONFIG.formatstr);

	expand_dir (MU_CONFIG.linksdir);
}
Ejemplo n.º 8
0
static void
set_group_extract_defaults (void)
{
	expand_dir (MU_CONFIG.targetdir);
}
Ejemplo n.º 9
0
int
expand_flash(clicon_handle h, char *name, cvec *vars, cg_var *arg, int *nr, char ***commands, char ***helptexts)
{
    return expand_dir(ROST_IMAGE_DIR, nr, commands, S_IFREG, 1);
}
Ejemplo n.º 10
0
int
expand_configfile(clicon_handle h, char *name, cvec *vars, cg_var *arg, int *nr, char ***commands, char ***helptexts)
{
    return expand_dir(ROST_CONFIG_DIR, nr, commands, S_IFREG, 0);
}
Ejemplo n.º 11
0
int
expand_cwd(clicon_handle h, char *name, cvec *vars, cg_var *arg, int *nr, char ***commands, char ***helptexts)
{
    return expand_dir(getcwd(NULL, PATH_MAX), nr, commands, S_IFREG, 1);
}
Ejemplo n.º 12
0
int
expand_home(clicon_handle h, char *name, cvec *vars, cg_var *arg, int *nr, char ***commands, char ***helptexts)
{
    return expand_dir(getenv("HOME"), nr, commands, S_IFREG, 1);
}