Revision: 5549 http://geany.svn.sourceforge.net/geany/?rev=5549&view=rev Author: statc Date: 2011-02-27 08:46:16 +0000 (Sun, 27 Feb 2011)
Log Message: ----------- SM: Don't save configuration on interactive SmSaveGlobal; don't ask to cancel shutdown if not a shutdown.
Modified Paths: -------------- branches/sm/src/callbacks.c branches/sm/src/main.c branches/sm/src/main.h branches/sm/src/sm.c
Modified: branches/sm/src/callbacks.c =================================================================== --- branches/sm/src/callbacks.c 2011-02-27 08:45:50 UTC (rev 5548) +++ branches/sm/src/callbacks.c 2011-02-27 08:46:16 UTC (rev 5549) @@ -116,7 +116,7 @@ quit = FALSE; }
- if (quit && main_save(TRUE)) + if (quit && main_save(GEANY_MAIN_SAVE_ALL, TRUE)) { main_finalize(); return FALSE;
Modified: branches/sm/src/main.c =================================================================== --- branches/sm/src/main.c 2011-02-27 08:45:50 UTC (rev 5548) +++ branches/sm/src/main.c 2011-02-27 08:46:16 UTC (rev 5549) @@ -1190,17 +1190,20 @@ }
-gboolean main_save(gboolean interactive) +gboolean main_save(GeanyMainSaveFlags flags, gboolean interactive) { - if (interactive && !document_account_for_unsaved()) - return FALSE; + if ((flags & GEANY_MAIN_SAVE_DOCUMENTS) && interactive) + if (!document_account_for_unsaved()) + return FALSE;
- if (!cl_options.new_instance) - configuration_save(GEANY_SETTINGS_RUNTIME); + if (flags & GEANY_MAIN_SAVE_CONFIGURATION) + { + if (!cl_options.new_instance) + configuration_save(GEANY_SETTINGS_RUNTIME); + if (app->project) + project_save(FALSE, GEANY_PROJECT_SETTINGS_RUNTIME); + }
- if (app->project) - project_save(FALSE, GEANY_PROJECT_SETTINGS_RUNTIME); - return TRUE; }
Modified: branches/sm/src/main.h =================================================================== --- branches/sm/src/main.h 2011-02-27 08:45:50 UTC (rev 5548) +++ branches/sm/src/main.h 2011-02-27 08:46:16 UTC (rev 5549) @@ -69,11 +69,20 @@ extern GeanyStatus main_status;
+typedef enum +{ + GEANY_MAIN_SAVE_CONFIGURATION = 1, + GEANY_MAIN_SAVE_DOCUMENTS = 2, + GEANY_MAIN_SAVE_ALL = 3 +} +GeanyMainSaveFlags; + + const gchar *main_get_version_string(void);
gchar *main_get_argv_filename(const gchar *filename);
-gboolean main_save(gboolean interactive); +gboolean main_save(GeanyMainSaveFlags flags, gboolean interactive);
void main_finalize(void);
Modified: branches/sm/src/sm.c =================================================================== --- branches/sm/src/sm.c 2011-02-27 08:45:50 UTC (rev 5548) +++ branches/sm/src/sm.c 2011-02-27 08:46:16 UTC (rev 5549) @@ -109,6 +109,11 @@ */ static SmPropValue sm_client_id_arg_val;
+/* The last values received by sm_save_yourself_callback(). + * Used by the sm_interact_callback(). */ +static GeanyMainSaveFlags sm_last_save_flags; +static Bool sm_last_shutdown; + #endif
/* @@ -576,16 +581,34 @@ static void sm_save_yourself_callback(SmcConn smcon, SmPointer client_data, int save_type, Bool shutdown, int interact_style, Bool fast) { + sm_last_shutdown = shutdown; + switch (save_type) + { + case SmSaveGlobal: + sm_last_save_flags = GEANY_MAIN_SAVE_DOCUMENTS; + break; + case SmSaveLocal: + sm_last_save_flags = GEANY_MAIN_SAVE_CONFIGURATION; + break; + case SmSaveBoth: + sm_last_save_flags = GEANY_MAIN_SAVE_ALL; + break; + default: + sm_last_save_flags = 0; + } + if (save_type == SmSaveGlobal || save_type == SmSaveBoth) { + /* if we may save documents... */ if (interact_style == SmInteractStyleAny && document_any_unsaved()) { + /* ...and do it interactively, then use InteractRequest */ + sm_last_save_flags = save_type; + sm_last_shutdown = shutdown; if (!SmcInteractRequest(smcon, SmDialogNormal, sm_interact_callback, NULL)) SmcSaveYourselfDone(smcon, FALSE); return; } - else - main_save(FALSE); }
/* @@ -594,6 +617,7 @@ * until we get "Die" or "Shutdown" message. */
+ main_save(sm_last_save_flags, FALSE); sm_set_runtime_props(smcon); SmcSaveYourselfDone(smcon, TRUE); } @@ -619,9 +643,9 @@ */ static void sm_interact_callback(SmcConn smcon, SmPointer client_data) { - gboolean cancelled = !main_save(TRUE); + gboolean cancelled = !main_save(sm_last_save_flags, TRUE); sm_set_runtime_props(smcon); - SmcInteractDone(smcon, cancelled); + SmcInteractDone(smcon, sm_last_shutdown && cancelled); SmcSaveYourselfDone(smcon, TRUE); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.