Skip to content
1 change: 1 addition & 0 deletions include/bottle_clone_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct CloneBottleStruct
Glib::ustring name;
Glib::ustring folder_name;
Glib::ustring description;
Glib::ustring wine_bin_path;
};

/**
Expand Down
1 change: 1 addition & 0 deletions include/bottle_config_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct BottleConfigData
{
std::string name;
std::string description;
std::string wine_bin_path;
bool logging_enabled;
int debug_log_level;
std::vector<std::pair<std::string, std::string>> env_vars;
Expand Down
9 changes: 9 additions & 0 deletions include/bottle_edit_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "bottle_types.h"
#include "busy_dialog.h"
#include <gtkmm.h>
#include <iostream>

using std::string;

Expand All @@ -37,6 +38,7 @@ struct UpdateBottleStruct
{
Glib::ustring name;
Glib::ustring folder_name;
Glib::ustring wine_bin_path;
Glib::ustring description;
BottleTypes::Windows windows_version;
Glib::ustring virtual_desktop_resolution;
Expand Down Expand Up @@ -77,6 +79,7 @@ class BottleEditWindow : public Gtk::Window
Gtk::Label header_edit_label; /*!< header edit label */
Gtk::Label name_label; /*!< name label */
Gtk::Label folder_name_label; /*!< folder name label */
Gtk::Label wine_bin_path_label; /*!< wine binary path label */
Gtk::Label windows_version_label; /*!< windows version label */
Gtk::Label audio_driver_label; /*!< audio driver label */
Gtk::Label virtual_desktop_resolution_label; /*!< virtual desktop resolution label */
Expand All @@ -85,7 +88,9 @@ class BottleEditWindow : public Gtk::Window
Gtk::Label environment_variables_label; /*!< environment variables label */
Gtk::Entry name_entry; /*!< name input field */
Gtk::Entry folder_name_entry; /*!< folder name input field */
Gtk::Entry wine_bin_path_entry; /*!< wine binary path input field */
Gtk::Entry virtual_desktop_resolution_entry; /*!< virtual desktop resolution input field */
Gtk::CheckButton system_wine_bin_path_check; /*!< use system wine binary path checkbox */
Gtk::ComboBoxText windows_version_combobox; /*!< windows version combobox */
Gtk::ComboBoxText audio_driver_combobox; /*!< audio driver combobox */
Gtk::CheckButton virtual_desktop_check; /*!< virtual desktop checkbox */
Expand All @@ -94,6 +99,7 @@ class BottleEditWindow : public Gtk::Window
Gtk::ScrolledWindow description_scrolled_window; /*!< description scrolled window */
Gtk::TextView description_text_view; /*!< description text view */
Gtk::Button configure_environment_variables_button; /*!< configure environment variables button */
Gtk::Button wine_bin_path_button; /*!< choose wine bin path button */
Gtk::Button save_button; /*!< save button */
Gtk::Button cancel_button; /*!< cancel button */
Gtk::Button delete_button; /*!< delete button */
Expand All @@ -102,10 +108,13 @@ class BottleEditWindow : public Gtk::Window
// Signal handlers
void on_cancel_button_clicked();
void on_save_button_clicked();
void on_system_wine_bin_path_toggle();
void on_select_wine_bin_path();
void on_virtual_desktop_toggle();
void on_debug_logging_toggle();

// Member functions
void system_wine_bin_path_sensitive(bool sensitive);
void create_layout();
void virtual_desktop_resolution_sensitive(bool sensitive);
void log_level_sensitive(bool sensitive);
Expand Down
14 changes: 14 additions & 0 deletions include/bottle_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class BottleItem : public Gtk::ListBoxRow
using std::swap;
swap(a.name_, b.name_);
swap(a.folder_name_, b.folder_name_);
swap(a.wine_bin_path_, b.wine_bin_path_);
swap(a.description_, b.description_);
swap(a.is_status_ok_, b.is_status_ok_);
swap(a.win_, b.win_);
Expand All @@ -74,6 +75,7 @@ class BottleItem : public Gtk::ListBoxRow

BottleItem(Glib::ustring& name,
Glib::ustring& folder_name,
Glib::ustring& wine_bin_path,
Glib::ustring& wine_version,
bool is_wine64_bit,
Glib::ustring& wine_location,
Expand All @@ -82,6 +84,7 @@ class BottleItem : public Gtk::ListBoxRow

BottleItem(Glib::ustring& name,
Glib::ustring& folder_name,
Glib::ustring& wine_bin_path,
Glib::ustring& description,
bool status,
BottleTypes::Windows win,
Expand Down Expand Up @@ -126,6 +129,16 @@ class BottleItem : public Gtk::ListBoxRow
{
return folder_name_;
};
/// set wine binary path
void wine_bin_path(const Glib::ustring& wine_bin_path)
{
wine_bin_path_ = wine_bin_path;
};
/// get wine binary path
const Glib::ustring& wine_bin_path() const
{
return wine_bin_path_;
};
/// set description
void description(const Glib::ustring& description)
{
Expand Down Expand Up @@ -289,6 +302,7 @@ class BottleItem : public Gtk::ListBoxRow
private:
Glib::ustring name_;
Glib::ustring folder_name_;
Glib::ustring wine_bin_path_;
Glib::ustring description_;
bool is_status_ok_;
BottleTypes::Windows win_;
Expand Down
9 changes: 7 additions & 2 deletions include/bottle_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,18 @@ class BottleManager
void update_bottle(SignalController* caller,
const Glib::ustring& name,
const Glib::ustring& folder_name,
const Glib::ustring& wine_bin_path,
const Glib::ustring& description,
BottleTypes::Windows windows_version,
const Glib::ustring& virtual_desktop_resolution,
BottleTypes::AudioDriver audio,
bool is_debug_logging,
int debug_log_level);
void clone_bottle(SignalController* caller, const Glib::ustring& name, const Glib::ustring& folder_name, const Glib::ustring& description);
void clone_bottle(SignalController* caller,
const Glib::ustring& name,
const Glib::ustring& folder_name,
const Glib::ustring& description,
const Glib::ustring& wine_bin_path);
void delete_bottle(Gtk::Window* parent);
void set_active_bottle(BottleItem* bottle);
const Glib::ustring& get_error_message() const;
Expand Down Expand Up @@ -127,7 +132,7 @@ class BottleManager
GeneralConfigData load_and_save_general_config();
bool is_bottle_not_null();
string get_deinstall_mono_command();
string get_wine_version();
string get_wine_version(const string& wine_bin_path);
std::vector<string> get_bottle_paths();
std::list<BottleItem> create_wine_bottles(const std::vector<string>& bottle_dirs);
};
12 changes: 7 additions & 5 deletions include/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class Helper
const vector<pair<string, string>>& env_vars = {},
bool give_error = true,
bool stderr_output = true);
static string run_program_under_wine(bool wine_64_bit,
static string run_program_under_wine(const string& wine_bin_path,
bool wine_64_bit,
const string& prefix_path,
int debug_log_level,
const string& program,
Expand All @@ -66,11 +67,12 @@ class Helper
static string get_log_file_path(const string& logging_bottle_prefix);
static void wait_until_wineserver_is_terminated(const string& prefix_path);
static int determine_wine_executable();
static string get_wine_executable_location(bool bit64);
static string get_wine_executable_location(const string& wine_bin_path, bool bit64);
static string get_winetricks_location();
static string get_wine_version(bool wine_64_bit);
static string get_wine_version(const string& wine_bin_path, bool wine_64_bit);
static string open_file_from_uri(const string& uri);
static void create_wine_bottle(bool wine_64_bit, const string& prefix_path, BottleTypes::Bit bit, const bool disable_gecko_mono);
static void
create_wine_bottle(const string& wine_bin_path, bool wine_64_bit, const string& prefix_path, BottleTypes::Bit bit, const bool disable_gecko_mono);
static void remove_wine_bottle(const string& prefix_path);
static void rename_wine_bottle_folder(const string& current_prefix_path, const string& new_prefix_path);
static void copy_wine_bottle_folder(const string& source_prefix_path, const string& destination_prefix_path);
Expand All @@ -96,7 +98,7 @@ class Helper
static vector<string> get_menu_items(const string& prefix_path);
static vector<pair<string, string>> get_desktop_items(const string& prefix_path);
static string log_level_to_winedebug_string(int log_level);
static string get_wine_guid(bool wine_64_bit, const string& prefix_path, const string& application_name);
static string get_wine_guid(const string& wine_bin_path, bool wine_64_bit, const string& prefix_path, const string& application_name);
static bool get_dll_override(const string& prefix_path, const string& dll_name, DLLOverride::LoadOrder load_order = DLLOverride::LoadOrder::Native);
static string get_uninstaller(const string& prefix_path, const string& uninstallerKey);
static string get_font_filename(const string& prefix_path, BottleTypes::Bit bit, const string& fontName);
Expand Down
1 change: 1 addition & 0 deletions include/main_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class MainWindow : public Gtk::ApplicationWindow
// Detailed info labels on the right panel
Gtk::Label name_label; /*!< Bottle name */
Gtk::Label folder_name_label; /*!< Folder name */
Gtk::Label wine_bin_path_label; /*!< Wine binary path */
Gtk::Label window_version_label; /*!< Windows version text */
Gtk::Label c_drive_location_label; /*!< C:\ drive location text */
Gtk::Label wine_version_label; /*!< Wine version text */
Expand Down
1 change: 1 addition & 0 deletions src/bottle_clone_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,6 @@ void BottleCloneWindow::on_clone_button_clicked()
clone_bottle_struct.name = name_entry.get_text();
clone_bottle_struct.folder_name = folder_name_entry.get_text();
clone_bottle_struct.description = description_text_view.get_buffer()->get_text();
clone_bottle_struct.wine_bin_path = active_bottle_->wine_bin_path();
clone_bottle.emit(clone_bottle_struct);
}
22 changes: 21 additions & 1 deletion src/bottle_config_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ bool BottleConfigFile::write_config_file(const std::string& prefix_path,
auto keyfile = Glib::KeyFile::create();
keyfile->set_string("General", "Name", bottle_config.name);
keyfile->set_string("General", "Description", bottle_config.description);
keyfile->set_string("General", "WineBinaryPath", bottle_config.wine_bin_path);
keyfile->set_boolean("Logging", "Enabled", bottle_config.logging_enabled);
keyfile->set_integer("Logging", "DebugLevel", bottle_config.debug_log_level);
// Iterate over the key/value environment variable pairs (if present)
Expand Down Expand Up @@ -92,7 +93,7 @@ bool BottleConfigFile::write_config_file(const std::string& prefix_path,
*/
std::tuple<BottleConfigData, std::map<int, ApplicationData>> BottleConfigFile::read_config_file(const std::string& prefix_path)
{
;
bool keyfile_needs_save = false;
std::string file_path = Glib::build_filename(prefix_path, "winegui.ini");

struct BottleConfigData bottle_config;
Expand Down Expand Up @@ -129,6 +130,19 @@ std::tuple<BottleConfigData, std::map<int, ApplicationData>> BottleConfigFile::r
bottle_config.description = keyfile->get_string("General", "Description");
bottle_config.logging_enabled = keyfile->get_boolean("Logging", "Enabled");
bottle_config.debug_log_level = keyfile->get_integer("Logging", "DebugLevel");
try
{
bottle_config.wine_bin_path = keyfile->get_string("General", "WineBinaryPath");
}
catch (const Glib::Error& ex)
{
// WineGUI <= 2.8.1 did not have the 'WineBinaryPath' property, so set to empty string
std::cerr << "Warning: Could not find 'General>WineBinaryPath' property in '" << file_path << "'! Setting it to an empty string."
<< std::endl;
std::cerr << " This is probably a WineGUI <= 2.8.1 keyfile." << std::endl;
keyfile_needs_save = true;
bottle_config.wine_bin_path = "";
}

// Retrieve environment variables (if present)
if (keyfile->has_group("EnvironmentVariables"))
Expand Down Expand Up @@ -160,5 +174,11 @@ std::tuple<BottleConfigData, std::map<int, ApplicationData>> BottleConfigFile::r
}
}

// Update if property is missing (due to keyfile created in older WineGUI version)
if (keyfile_needs_save)
{
write_config_file(prefix_path, bottle_config, app_list);
}

return std::make_tuple(bottle_config, app_list);
}
Loading