Commit 38fc2d6c authored by Jens Georg's avatar Jens Georg

Add --list-profiles option

parent 6e092b0f
Pipeline #88618 canceled with stage
in 22 minutes and 22 seconds
......@@ -95,5 +95,25 @@ namespace Shotwell {
assert_not_reached();
}
}
public void print_profiles() {
print("Available profiles:\n");
print("-------------------\n");
try {
foreach (var group in profiles.get_groups()) {
print("Profile name: %s\n", profiles.get_value(group, "Name"));
var id = profiles.get_value(group, "Id");
print("Profile Id: %s\n", id);
if ("DataDir" in profiles.get_keys(group)) {
print("Data dir: %s\n", profiles.get_value(group, "DataDir"));
} else {
print("Data dir: %s\n", Path.build_filename(Environment.get_user_data_dir(), "profiles", id));
}
print("\n");
}
} catch (Error error) {
print("Failed to print profiles: %s", error.message);
}
}
}
}
......@@ -333,6 +333,7 @@ bool no_runtime_monitoring = false;
bool fullscreen = false;
bool show_metadata = false;
string? profile = null;
bool list_profiles = false;
const OptionEntry[] entries = {
{ "datadir", 'd', 0, OptionArg.FILENAME, ref data_dir, N_("Path to Shotwell’s private data"), N_("DIRECTORY") },
......@@ -342,6 +343,7 @@ const OptionEntry[] entries = {
{ "fullscreen", 'f', 0, OptionArg.NONE, ref fullscreen, N_("Start the application in fullscreen mode"), null },
{ "show-metadata", 'p', 0, OptionArg.NONE, ref show_metadata, N_("Print the metadata of the image file"), null },
{ "profile", 'i', 0, OptionArg.STRING, ref profile, N_("Name for a custom profile"), N_("PROFILE") },
{ "list-profiles", 'l', 0, OptionArg.NONE, ref list_profiles, N_("Show available profiles"), null },
{ null, 0, 0, 0, null, null, null }
};
}
......@@ -404,6 +406,15 @@ void main(string[] args) {
return;
}
if (CommandlineOptions.list_profiles) {
var manager = Shotwell.ProfileManager.get_instance();
manager.print_profiles();
AppDirs.terminate();
return;
}
// init debug prior to anything else (except Gtk, which it relies on, and AppDirs, which needs
// to be set ASAP) ... since we need to know what mode we're in, examine the command-line
// first
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment