Add history to path entry.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5049 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2010-06-18 12:22:00 +00:00
parent c41b55d692
commit 9dc088c1e7
2 changed files with 33 additions and 19 deletions

View File

@ -3,6 +3,8 @@
* src/ui_utils.h, src/dialogs.c, src/plugindata.h, src/search.c,
src/plugins.c, src/ui_utils.c, plugins/geanyfunctions.h:
Add ui_combo_box_add_to_history() to API.
* plugins/filebrowser.c:
Add history to path entry.
2010-06-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -38,7 +38,7 @@ GeanyData *geany_data;
GeanyFunctions *geany_functions;
PLUGIN_VERSION_CHECK(175)
PLUGIN_VERSION_CHECK(GEANY_API_VERSION)
PLUGIN_SET_INFO(_("File Browser"), _("Adds a file browser tab to the sidebar."), VERSION,
_("The Geany developer team"))
@ -75,6 +75,7 @@ static GtkTreeIter *last_dir_iter = NULL;
static GtkEntryCompletion *entry_completion = NULL;
static GtkWidget *filter_entry;
static GtkWidget *path_combo;
static GtkWidget *path_entry;
static gchar *current_dir = NULL; /* in locale-encoding */
static gchar *open_cmd; /* in locale-encoding */
@ -274,6 +275,7 @@ static void refresh(void)
utf8_dir = utils_get_utf8_from_locale(current_dir);
gtk_entry_set_text(GTK_ENTRY(path_entry), utf8_dir);
ui_combo_box_add_to_history(GTK_COMBO_BOX_ENTRY(path_combo), utf8_dir, 0);
g_free(utf8_dir);
add_top_level_entry(); /* ".." item */
@ -766,6 +768,14 @@ static void on_path_entry_activate(GtkEntry *entry, gpointer user_data)
}
static void on_path_combo_changed(GtkComboBox *combo, gpointer user_data)
{
/* we get this callback on typing as well as choosing an item */
if (gtk_combo_box_get_active(combo) >= 0)
on_path_entry_activate(GTK_ENTRY(path_entry), NULL);
}
static void on_filter_activate(GtkEntry *entry, gpointer user_data)
{
setptr(filter, g_strdup(gtk_entry_get_text(entry)));
@ -1079,8 +1089,10 @@ void plugin_init(GeanyData *data)
filterbar = make_filterbar();
gtk_box_pack_start(GTK_BOX(file_view_vbox), filterbar, FALSE, FALSE, 0);
path_entry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(file_view_vbox), path_entry, FALSE, FALSE, 2);
path_combo = gtk_combo_box_entry_new_text();
gtk_box_pack_start(GTK_BOX(file_view_vbox), path_combo, FALSE, FALSE, 2);
g_signal_connect(path_combo, "changed", G_CALLBACK(on_path_combo_changed), NULL);
path_entry = GTK_BIN(path_combo)->child;
g_signal_connect(path_entry, "activate", G_CALLBACK(on_path_entry_activate), NULL);
file_view = gtk_tree_view_new();