Revision: 5706 http://geany.svn.sourceforge.net/geany/?rev=5706&view=rev Author: ntrel Date: 2011-04-11 12:07:19 +0000 (Mon, 11 Apr 2011)
Log Message: ----------- Update path when saving a new document for the first time if the follow path option is enabled.
Modified Paths: -------------- trunk/ChangeLog trunk/plugins/filebrowser.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-04-10 17:03:41 UTC (rev 5705) +++ trunk/ChangeLog 2011-04-11 12:07:19 UTC (rev 5706) @@ -1,3 +1,10 @@ +2011-04-11 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * plugins/filebrowser.c: + Update path when saving a new document for the first time if the + follow path option is enabled. + + 2011-04-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/editor.c:
Modified: trunk/plugins/filebrowser.c =================================================================== --- trunk/plugins/filebrowser.c 2011-04-10 17:03:41 UTC (rev 5705) +++ trunk/plugins/filebrowser.c 2011-04-11 12:07:19 UTC (rev 5706) @@ -97,6 +97,7 @@
static void project_change_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 }, @@ -1042,11 +1043,15 @@ }
+static gpointer last_activate_path = NULL; + static void document_activate_cb(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc, G_GNUC_UNUSED gpointer data) { gchar *new_dir;
+ last_activate_path = doc->real_path; + if (! fb_follow_path || doc->file_name == NULL || ! g_path_is_absolute(doc->file_name)) return;
@@ -1063,6 +1068,13 @@ }
+static void document_save_cb(GObject *obj, GeanyDocument *doc, gpointer user_data) +{ + if (!last_activate_path) + document_activate_cb(obj, doc, user_data); +} + + static void kb_activate(guint key_id) { gtk_notebook_set_current_page(GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), page_number); @@ -1125,6 +1137,8 @@
plugin_signal_connect(geany_plugin, NULL, "document-activate", TRUE, (GCallback) &document_activate_cb, NULL); + plugin_signal_connect(geany_plugin, NULL, "document-save", TRUE, + (GCallback) &document_save_cb, NULL); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.