Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Matthew Brush mbrush@codebrainz.ca Date: Fri, 04 Aug 2017 08:34:23 UTC Commit: 3e864317ba051512c102beb2a939caa4698515de https://github.com/geany/geany/commit/3e864317ba051512c102beb2a939caa4698515...
Log Message: ----------- filebrowser: Don't change directory on project save
This behavior might be unwanted when changing project settings which is unrelated to project base path and also fixes filebrowser behavior with the updated way project-save signal is emitted.
The patch also handles the situation where "realized" is called after project-save is called and overrides file browser's path (which is something we don't want).
Modified Paths: -------------- plugins/filebrowser.c
Modified: plugins/filebrowser.c 21 lines changed, 15 insertions(+), 6 deletions(-) =================================================================== @@ -101,13 +101,12 @@ static struct } popup_items;
-static void project_change_cb(GObject *obj, GKeyFile *config, gpointer data); +static void project_open_cb(GObject *obj, GKeyFile *config, gpointer data);
/* note: other callbacks connected in plugin_init */ PluginCallback plugin_callbacks[] = { - { "project-open", (GCallback) &project_change_cb, TRUE, NULL }, - { "project-save", (GCallback) &project_change_cb, TRUE, NULL }, + { "project-open", (GCallback) &project_open_cb, TRUE, NULL }, { NULL, NULL, FALSE, NULL } };
@@ -396,6 +395,16 @@ static void on_current_path(void) }
+static void on_realized(void) +{ + GeanyProject *project = geany->app->project; + + /* if fb_set_project_base_path and project open, the path has already been set */ + if (! fb_set_project_base_path || project == NULL || EMPTY(project->base_path)) + on_current_path(); +} + + static void on_go_up(void) { gsize len = strlen(current_dir); @@ -891,7 +900,7 @@ static void prepare_file_view(void) gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
/* Show the current path when the FB is first needed */ - g_signal_connect(file_view, "realize", G_CALLBACK(on_current_path), NULL); + g_signal_connect(file_view, "realize", G_CALLBACK(on_realized), NULL); g_signal_connect(selection, "changed", G_CALLBACK(on_tree_selection_changed), NULL); g_signal_connect(file_view, "button-press-event", G_CALLBACK(on_button_press), NULL); g_signal_connect(file_view, "key-press-event", G_CALLBACK(on_key_press), NULL); @@ -1039,8 +1048,8 @@ static void load_settings(void) }
-static void project_change_cb(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED GKeyFile *config, - G_GNUC_UNUSED gpointer data) +static void project_open_cb(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED GKeyFile *config, + G_GNUC_UNUSED gpointer data) { gchar *new_dir; GeanyProject *project = geany->app->project;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).