aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/ext/pm/file_browser.lua15
-rw-r--r--src/textadept.c11
2 files changed, 20 insertions, 6 deletions
diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua
index ad70f75b..8aa6cf96 100644
--- a/core/ext/pm/file_browser.lua
+++ b/core/ext/pm/file_browser.lua
@@ -24,12 +24,15 @@ end
function get_contents_for(full_path)
local dir = {}
local dirpath = table.concat(full_path, '/')
- for name in lfs.dir(dirpath) do
- if not name:find('^%.') then
- dir[name] = { text = name }
- if lfs.attributes(dirpath..'/'..name, 'mode') == 'directory' then
- dir[name].parent = true
- dir[name].pixbuf = 'gtk-directory'
+ local path = lfs.attributes(dirpath)
+ if path and path.mode == 'directory' then
+ for name in lfs.dir(dirpath) do
+ if not name:find('^%.') then
+ dir[name] = { text = name }
+ if lfs.attributes(dirpath..'/'..name, 'mode') == 'directory' then
+ dir[name].parent = true
+ dir[name].pixbuf = 'gtk-directory'
+ end
end
end
end
diff --git a/src/textadept.c b/src/textadept.c
index 9ad44010..cd823e86 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -38,6 +38,7 @@ static int pm_search_equal_func(GtkTreeModel *model, int col, const char *key,
static int pm_sort_iter_compare_func(GtkTreeModel *model, GtkTreeIter *a,
GtkTreeIter *b, gpointer);
static void pm_entry_activated(GtkWidget *widget, gpointer);
+static void pm_entry_changed(GtkComboBoxEntry *widget, gpointer);
static gbool pm_keypress(GtkWidget *, GdkEventKey *event, gpointer);
static void pm_row_expanded(GtkTreeView *, GtkTreeIter *iter,
GtkTreePath *path, gpointer);
@@ -625,6 +626,7 @@ GtkWidget *pm_create_ui() {
gtk_box_pack_start(GTK_BOX(pm_container), scrolled, TRUE, TRUE, 0);
signal(pm_entry, "activate", pm_entry_activated);
+ signal(pm_combo, "changed", pm_entry_changed);
signal(pm_entry, "key_press_event", pm_keypress);
signal(pm_view, "key_press_event", pm_keypress);
signal(pm_view, "row_expanded", pm_row_expanded);
@@ -775,6 +777,15 @@ static void pm_entry_activated(GtkWidget *widget, gpointer) {
}
/**
+ * Signal for a change of the text in the Project Manager entry.
+ * Calls pm_entry_activated to populate the treeview.
+ * @see pm_entry_activated
+ */
+static void pm_entry_changed(GtkComboBoxEntry *widget, gpointer) {
+ pm_entry_activated(gtk_bin_get_child(GTK_BIN(widget)), NULL);
+}
+
+/**
* Signal for a Project Manager keypress.
* Currently handled keypresses:
* - Ctrl+Tab - Refocuses the Scintilla view.