diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-05 16:10:33 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-05 17:33:46 +0300 |
commit | 481cdb08ed6f33a09d0e6843d1024db93c301178 (patch) | |
tree | 77166d130bfff2d5dca884676aaeff6bc0758f96 /source/blender/windowmanager/intern/wm_window.c | |
parent | 1d97e948d2c4867306e7fb5ce5fccf8b72c13391 (diff) |
Cleanup: use new accessors to blendfile path (Main.name).
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d49df7ae09b..c7805184819 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -338,6 +338,7 @@ static void wm_block_confirm_quit_save(bContext *C, void *arg_block, void *UNUSE /* Build the confirm dialog UI */ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar, void *UNUSED(arg1)) { + Main *bmain = CTX_data_main(C); uiStyle *style = UI_style_get(); uiBlock *block = UI_block_begin(C, ar, "confirm_quit_popup", UI_EMBOSS); @@ -351,11 +352,11 @@ static uiBlock *block_create_confirm_quit(struct bContext *C, struct ARegion *ar /* Text and some vertical space */ { char *message; - if (G.main->name[0] == '\0') { + if (BKE_main_blendfile_path(bmain)[0] == '\0') { message = BLI_strdup(IFACE_("This file has not been saved yet. Save before closing?")); } else { - const char *basename = BLI_path_basename(G.main->name); + const char *basename = BLI_path_basename(BKE_main_blendfile_path(bmain)); message = BLI_sprintfN(IFACE_("Save changes to \"%s\" before closing?"), basename); } uiItemL(layout, message, ICON_ERROR); @@ -496,9 +497,10 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } else if (win->ghostwin) { /* this is set to 1 if you don't have startup.blend open */ - if (G.save_over && G.main->name[0]) { - char str[sizeof(G.main->name) + 24]; - BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*", G.main->name, + if (G.save_over && BKE_main_blendfile_path_from_global()[0]) { + char str[sizeof(((Main *)NULL)->name) + 24]; + BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", wm->file_saved ? "" : "*", + BKE_main_blendfile_path_from_global(), G.main->recovered ? " (Recovered)" : ""); GHOST_SetTitle(win->ghostwin, str); } |