Skip to content
Permalink
Browse files

保存先をcurrent pathでなくdconf設定値を選ぶように

  • Loading branch information...
ottyajp committed Jul 31, 2019
1 parent 6d68a43 commit 075035060c3d95d161d0bf7f348cab0126384be9
Showing with 13 additions and 1 deletion.
  1. +13 −1 gtkmm/dialog.cpp
@@ -38,6 +38,8 @@
#include <gtkmm/main.h>
#include <gtkmm/messagedialog.h>

#include <gio/gio.h>

#include <utsushi/file.hpp>
#include <utsushi/i18n.hpp>
#include <utsushi/range.hpp>
@@ -357,7 +359,13 @@ dialog::on_scan (void)
file_chooser dialog (*this, SEC_("Save As..."));

fs::path default_name (std::string (SEC_("Untitled")) + ".pdf");
fs::path default_path (fs::current_path () / default_name);

// load previous-path
GSettings *settings = g_settings_new("apps.utsushi");
GVariant *previousPath = g_settings_get_value(settings, "previous-path");
gchar *savePath;
g_variant_get(previousPath, "s", &savePath);
fs::path default_path (savePath / default_name);

dialog.set_current_name (default_name.string ());
dialog.set_filename (default_path.string ());
@@ -370,6 +378,10 @@ dialog::on_scan (void)

std::string path (dialog.get_filename ());

// save previous-path
previousPath = g_variant_new_string(dialog.get_current_folder().c_str());
g_settings_set_value(settings, "previous-path", previousPath);

// Infer image format and check support

std::string ext = fs::path (path).extension ().string ();

0 comments on commit 0750350

Please sign in to comment.
You can’t perform that action at this time.