49
49
namespace ExportUI {
50
50
private static File current_export_dir = null;
52
// Dummy function for suppressing 'could not stat file' errors
53
// generated when saving into a previously non-existant file -
54
// please see https://bugzilla.gnome.org/show_bug.cgi?id=662814
55
// This should be removed once GTK 3.4 is widely available, as
56
// it is slated to correct the problem.
57
public void suppress_warnings(string? log_domain, LogLevelFlags log_levels, string message) {
61
52
public File? choose_file(string current_file_basename) {
62
53
if (current_export_dir == null)
63
54
current_export_dir = File.new_for_path(Environment.get_home_dir());
1659
public interface WelcomeServiceEntry : GLib.Object {
1660
public abstract string get_service_name();
1662
public abstract void execute();
1668
1665
public class WelcomeDialog : Gtk.Dialog {
1669
1666
Gtk.CheckButton hide_button;
1670
Gtk.CheckButton? fspot_import_check = null;
1671
1667
Gtk.CheckButton? system_pictures_import_check = null;
1668
Gtk.CheckButton[] external_import_checks = new Gtk.CheckButton[0];
1669
WelcomeServiceEntry[] external_import_entries = new WelcomeServiceEntry[0];
1670
Gtk.Label secondary_text;
1671
Gtk.Label instruction_header;
1672
Gtk.VBox import_content;
1673
Gtk.VBox import_action_checkbox_packer;
1674
Gtk.VBox external_import_action_checkbox_packer;
1675
Spit.DataImports.WelcomeImportMetaHost import_meta_host;
1676
bool import_content_already_installed = false;
1673
1678
public WelcomeDialog(Gtk.Window owner) {
1674
bool show_fspot_import = is_fspot_import_possible();
1679
import_meta_host = new Spit.DataImports.WelcomeImportMetaHost(this);
1675
1680
bool show_system_pictures_import = is_system_pictures_import_possible();
1676
1681
Gtk.Widget ok_button = add_button(Gtk.Stock.OK, Gtk.ResponseType.OK);
1677
1682
set_title(_("Welcome!"));
1683
1688
primary_text.set_markup(
1684
1689
"<span size=\"large\" weight=\"bold\">%s</span>".printf(_("Welcome to Shotwell!")));
1685
1690
primary_text.set_alignment(0, 0.5f);
1686
Gtk.Label secondary_text = new Gtk.Label("");
1687
if (!(show_fspot_import || show_system_pictures_import)) {
1688
secondary_text.set_markup("<span weight=\"normal\">%s</span>".printf(
1689
_("To get started, import photos in any of these ways:")));
1691
secondary_text = new Gtk.Label("");
1692
secondary_text.set_markup("<span weight=\"normal\">%s</span>".printf(
1693
_("To get started, import photos in any of these ways:")));
1691
1694
secondary_text.set_alignment(0, 0.5f);
1692
1695
Gtk.Image image = new Gtk.Image.from_pixbuf(Resources.get_icon(Resources.ICON_APP, 50));
1694
Gtk.Widget? header_text = null;
1695
if (show_fspot_import || show_system_pictures_import) {
1696
header_text = primary_text;
1698
header_text = new Gtk.VBox(false, 0);
1700
((Gtk.VBox) header_text).pack_start(primary_text, false, false, 5);
1701
((Gtk.VBox) header_text).pack_start(secondary_text, false, false, 0);
1697
Gtk.VBox header_text = new Gtk.VBox(false, 0);
1698
header_text.pack_start(primary_text, false, false, 5);
1699
header_text.pack_start(secondary_text, false, false, 0);
1704
1701
Gtk.HBox header_content = new Gtk.HBox(false, 12);
1705
1702
header_content.pack_start(image, false, false, 0);
1706
1703
header_content.pack_start(header_text, false, false, 0);
1708
1705
Gtk.Label instructions = new Gtk.Label("");
1709
string indent_prefix = (show_fspot_import || show_system_pictures_import) ? " " : "";
1706
string indent_prefix = " "; // we can't tell what the indent prefix is going to be so assume we need one
1710
1707
instructions.set_markup(((indent_prefix + "• %s\n") + (indent_prefix + "• %s\n")
1711
1708
+ (indent_prefix + "• %s")).printf(
1712
1709
_("Choose <span weight=\"bold\">File %s Import From Folder</span>").printf("▸"),
1714
1711
_("Connect a camera to your computer and import")));
1715
1712
instructions.set_alignment(0, 0.5f);
1717
Gtk.VBox? import_action_checkbox_packer = null;
1718
if (show_fspot_import || show_system_pictures_import) {
1719
import_action_checkbox_packer = new Gtk.VBox(false, 2);
1721
if (show_fspot_import) {
1722
fspot_import_check = new Gtk.CheckButton.with_mnemonic(
1723
_("Import photos from your _F-Spot library"));
1724
import_action_checkbox_packer.add(fspot_import_check);
1725
fspot_import_check.set_active(true);
1728
if (show_system_pictures_import) {
1729
system_pictures_import_check = new Gtk.CheckButton.with_mnemonic(
1730
_("_Import photos from your %s folder").printf(
1731
get_display_pathname(AppDirs.get_import_dir())));
1732
import_action_checkbox_packer.add(system_pictures_import_check);
1733
system_pictures_import_check.set_active(true);
1737
Gtk.Label? instruction_header = null;
1738
if (show_fspot_import || show_system_pictures_import) {
1739
instruction_header = new Gtk.Label(
1740
_("You can also import photos in any of these ways:"));
1741
instruction_header.set_alignment(0.0f, 0.5f);
1714
import_action_checkbox_packer = new Gtk.VBox(false, 2);
1716
external_import_action_checkbox_packer = new Gtk.VBox(false, 2);
1717
import_action_checkbox_packer.add(external_import_action_checkbox_packer);
1719
if (show_system_pictures_import) {
1720
system_pictures_import_check = new Gtk.CheckButton.with_mnemonic(
1721
_("_Import photos from your %s folder").printf(
1722
get_display_pathname(AppDirs.get_import_dir())));
1723
import_action_checkbox_packer.add(system_pictures_import_check);
1724
system_pictures_import_check.set_active(true);
1727
instruction_header = new Gtk.Label(
1728
_("You can also import photos in any of these ways:"));
1729
instruction_header.set_alignment(0.0f, 0.5f);
1730
instruction_header.set_margin_top(20);
1744
1732
Gtk.VBox content = new Gtk.VBox(false, 16);
1745
1733
content.pack_start(header_content, true, true, 0);
1746
if (show_fspot_import || show_system_pictures_import) {
1747
content.add(import_action_checkbox_packer);
1748
content.add(instruction_header);
1734
import_content = new Gtk.VBox(false, 2);
1735
content.add(import_content);
1736
//content.add(import_action_checkbox_packer);
1737
//content.add(instruction_header);
1750
1738
content.pack_start(instructions, false, false, 0);
1752
1740
hide_button = new Gtk.CheckButton.with_mnemonic(_("_Don't show this message again"));
1760
1748
((Gtk.Box) get_content_area()).pack_start(alignment, false, false, 0);
1762
set_has_resize_grip(false);
1750
set_has_resize_grip(false);
1764
1752
ok_button.grab_focus();
1754
install_import_content();
1756
import_meta_host.start();
1759
private void install_import_content() {
1761
(external_import_checks.length > 0 || system_pictures_import_check != null) &&
1762
(import_content_already_installed == false)
1764
secondary_text.set_markup("");
1765
import_content.add(import_action_checkbox_packer);
1766
import_content.add(instruction_header);
1767
import_content_already_installed = true;
1771
public void install_service_entry(WelcomeServiceEntry entry) {
1772
debug("WelcomeDialog: Installing service entry for %s".printf(entry.get_service_name()));
1773
external_import_entries += entry;
1774
Gtk.CheckButton entry_check = new Gtk.CheckButton.with_label(
1775
_("Import photos from your %s library").printf(entry.get_service_name()));
1776
external_import_checks += entry_check;
1777
entry_check.set_active(true);
1778
external_import_action_checkbox_packer.add(entry_check);
1779
install_import_content();
1767
public bool execute(out bool do_fspot_import, out bool do_system_pictures_import) {
1782
public bool execute(out WelcomeServiceEntry[] selected_import_entries, out bool do_system_pictures_import) {
1770
1785
bool ok = (run() == Gtk.ResponseType.OK);
1774
1789
show_dialog = !hide_button.get_active();
1776
do_fspot_import = (fspot_import_check != null) ? fspot_import_check.get_active() : false;
1791
// Use a temporary variable as += cannot be used on parameters
1792
WelcomeServiceEntry[] result = new WelcomeServiceEntry[0];
1793
for (int i = 0; i < external_import_entries.length; i++) {
1794
if (external_import_checks[i].get_active() == true)
1795
result += external_import_entries[i];
1797
selected_import_entries = result;
1777
1798
do_system_pictures_import =
1778
1799
(system_pictures_import_check != null) ? system_pictures_import_check.get_active() : false;
2150
2168
private void set_background_color(double bg_color_value) {
2151
Config.Facade.get_instance().set_bg_color(to_grayscale((uint16) bg_color_value));
2169
Config.Facade.get_instance().set_bg_color(to_grayscale(bg_color_value));
2154
private Gdk.Color to_grayscale(uint16 color_value) {
2155
Gdk.Color color = Gdk.Color();
2172
private Gdk.RGBA to_grayscale(double color_value) {
2173
Gdk.RGBA color = Gdk.RGBA();
2157
2175
color.red = color_value;
2158
2176
color.green = color_value;
2159
2177
color.blue = color_value;