25 #include "pips_config.h"
36 #include <sys/param.h>
39 #if __linux__ || __bsdi__ || __NetBSD__ || __OpenBSD__ || __FreeBSD__
41 #define MAXNAMELEN NAME_MAX
45 #define MAXNAMELEN MAXNAMLEN
75 GtkWidget * parent_menu;
77 parent_menu = gtk_widget_get_parent(widget);
80 const char * parent_directory;
82 debug(2,
"directory_gen_pullright",
"widget = %#x (%s), parent = %#x\n",
86 parent_directory = gtk_menu_get_title(GTK_MENU(parent_menu));
87 debug(2,
"directory_gen_pullright",
" parent_directory = %s\n",
93 if (gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget)) != NULL) {
97 GtkWidget * submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
98 gtk_menu_item_set_submenu(GTK_MENU_ITEM(widget), NULL);
99 gtk_widget_destroy(submenu);
109 const char * parent_path_name;
110 const char * directory_name;
113 parent = gtk_widget_get_parent(widget);
114 if(parent == NULL || ! GTK_IS_MENU(parent))
115 parent_path_name =
"";
117 parent_path_name = gtk_menu_get_title(GTK_MENU(parent));
119 (void) sprintf(full_directory_name,
"%s/%s", parent_path_name,
126 int file_list_length;
132 menu = gtk_menu_new();
133 gtk_menu_set_title(GTK_MENU(menu), directory);
144 pips_debug(2,
"menu = %p (%s)\n", (
void *) menu, directory);
147 GtkWidget * please_close = gtk_menu_item_new_with_label(
148 "* Close the current workspace before changing directory *");
149 gtk_widget_set_sensitive(please_close, FALSE);
150 gtk_menu_append(GTK_MENU(menu), please_close);
154 GtkWidget * file_item;
161 if (return_code == -1 || file_list_length == 0) {
162 file_item = gtk_menu_item_new_with_label(
163 "* No file in this directory or cannot be open *");
164 gtk_widget_set_sensitive(file_item, FALSE);
165 gtk_menu_append(GTK_MENU(menu), file_item);
168 = gtk_menu_item_new_with_label(
169 "* Too many files. Type directly in the Directory line of the main panel *");
170 gtk_widget_set_sensitive(file_item, FALSE);
171 gtk_menu_append(GTK_MENU(menu), file_item);
173 "Too many files in the \"%s\" directory.\n", directory);
176 for (i = 0; i < file_list_length; i++) {
183 file_item = gtk_menu_item_new_with_label(
file_name);
184 gtk_menu_append(GTK_MENU(menu), file_item);
186 (void) sprintf(complete_file_name,
"%s/%s", directory,
188 if (((stat(complete_file_name, &
buf) == 0) && (
buf.st_mode
193 gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item),
195 g_signal_connect(G_OBJECT(file_item),
"activate",
200 gtk_widget_set_sensitive(file_item, FALSE);
207 gtk_widget_show_all(menu);
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
size_t gen_array_nitems(const gen_array_t a)
void gen_array_full_free(gen_array_t a)
gen_array_t gen_array_make(size_t size)
declarations...
void * gen_array_item(const gen_array_t a, size_t i)
bool directory_exists_p(const char *name)
int safe_list_files_in_directory(gen_array_t files, string dir, string re, bool(*file_name_predicate)(const char *))
returns a sorted arg list of files matching regular expression re in directory 'dir' and with file_na...
success end_directory_notify(const char *dir)
const char * gpips_gtk_menu_item_get_label(GtkWidget *w)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define user_warning(fn,...)
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...