summaryrefslogtreecommitdiff
path: root/src/Dialogs.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-04-03 13:14:53 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-04-03 13:14:53 +0200
commitc43dfb815a4951b8248f4f0e98babe4f80204f03 (patch)
tree82745ed2353757c41ea1865bad9ac7a1b0a8a366 /src/Dialogs.vala
parent2785a691b958a79a1dd606c445188c71c3f58b3c (diff)
Imported Upstream version 0.22.0upstream/0.22.0
Diffstat (limited to 'src/Dialogs.vala')
-rw-r--r--src/Dialogs.vala146
1 files changed, 74 insertions, 72 deletions
diff --git a/src/Dialogs.vala b/src/Dialogs.vala
index 1f6a5ce..d760e73 100644
--- a/src/Dialogs.vala
+++ b/src/Dialogs.vala
@@ -1,4 +1,4 @@
-/* Copyright 2009-2014 Yorba Foundation
+/* Copyright 2009-2015 Yorba Foundation
*
* This software is licensed under the GNU LGPL (version 2.1 or later).
* See the COPYING file in this distribution.
@@ -35,7 +35,7 @@ public bool confirm_warn_developer_changed(int number) {
"<span weight=\"bold\" size=\"larger\">%s</span>".printf(ngettext("Switching developers will undo all changes you have made to this photo in Shotwell",
"Switching developers will undo all changes you have made to these photos in Shotwell", number)));
- dialog.add_buttons(Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL);
+ dialog.add_buttons(Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL);
dialog.add_buttons(_("_Switch Developer"), Gtk.ResponseType.YES);
int response = dialog.run();
@@ -58,8 +58,8 @@ public File? choose_file(string current_file_basename) {
_("Export Video") : _("Export Photo");
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog(file_chooser_title,
- AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Gtk.Stock.CANCEL,
- Gtk.ResponseType.CANCEL, Gtk.Stock.SAVE, Gtk.ResponseType.ACCEPT, null);
+ AppWindow.get_instance(), Gtk.FileChooserAction.SAVE, Resources.CANCEL_LABEL,
+ Gtk.ResponseType.CANCEL, Resources.SAVE_LABEL, Gtk.ResponseType.ACCEPT, null);
chooser.set_do_overwrite_confirmation(true);
chooser.set_current_folder(current_export_dir.get_path());
chooser.set_current_name(current_file_basename);
@@ -87,8 +87,8 @@ public File? choose_dir(string? user_title = null) {
user_title = _("Export Photos");
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog(user_title,
- AppWindow.get_instance(), Gtk.FileChooserAction.SELECT_FOLDER, Gtk.Stock.CANCEL,
- Gtk.ResponseType.CANCEL, Gtk.Stock.OK, Gtk.ResponseType.ACCEPT, null);
+ AppWindow.get_instance(), Gtk.FileChooserAction.SELECT_FOLDER, Resources.CANCEL_LABEL,
+ Gtk.ResponseType.CANCEL, Resources.OK_LABEL, Gtk.ResponseType.ACCEPT, null);
chooser.set_current_folder(current_export_dir.get_path());
chooser.set_local_only(false);
@@ -168,6 +168,8 @@ public class ExportDialog : Gtk.Dialog {
private bool in_insert = false;
public ExportDialog(string title) {
+ Object (use_header_bar: 1);
+
this.title = title;
resizable = false;
@@ -198,7 +200,6 @@ public class ExportDialog : Gtk.Dialog {
pixels_entry = new Gtk.Entry();
pixels_entry.set_max_length(6);
- pixels_entry.set_size_request(60, -1);
pixels_entry.set_text("%d".printf(current_scale));
// register after preparation to avoid signals during init
@@ -218,30 +219,23 @@ public class ExportDialog : Gtk.Dialog {
add_label(_("_Scaling constraint:"), 0, 2, constraint_combo);
add_control(constraint_combo, 1, 2);
- Gtk.Label pixels_label = new Gtk.Label.with_mnemonic(_(" _pixels"));
- pixels_label.set_mnemonic_widget(pixels_entry);
-
- Gtk.Box pixels_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
- pixels_box.pack_start(pixels_entry, false, false, 0);
- pixels_box.pack_end(pixels_label, false, false, 0);
- add_control(pixels_box, 1, 3);
+ add_label(_("_Pixels:"), 0, 3, pixels_entry);
+ add_control(pixels_entry, 1, 3);
export_metadata = new Gtk.CheckButton.with_label(_("Export metadata"));
add_control(export_metadata, 1, 4);
export_metadata.active = true;
- table.set_row_spacing(4);
- table.set_column_spacing(4);
- table.set_margin_top(4);
- table.set_margin_bottom(4);
- table.set_margin_left(4);
- table.set_margin_right(4);
+ table.set_row_spacing(5);
+ table.set_column_spacing(5);
+ table.set_border_width(3);
((Gtk.Box) get_content_area()).add(table);
// add buttons to action area
- add_button(Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL);
- ok_button = add_button(Gtk.Stock.OK, Gtk.ResponseType.OK);
+ add_button(Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL);
+ ok_button = add_button(Resources.OK_LABEL, Gtk.ResponseType.OK);
+ set_default_response(Gtk.ResponseType.OK);
ok_button.set_can_default(true);
ok_button.has_default = true;
@@ -357,7 +351,7 @@ public class ExportDialog : Gtk.Dialog {
}
private void add_label(string text, int x, int y, Gtk.Widget? widget = null) {
- Gtk.Alignment left_aligned = new Gtk.Alignment(0.0f, 0.5f, 0, 0);
+ Gtk.Alignment left_aligned = new Gtk.Alignment(1, 0.5f, 0, 0);
Gtk.Label new_label = new Gtk.Label.with_mnemonic(text);
new_label.set_use_underline(true);
@@ -371,7 +365,7 @@ public class ExportDialog : Gtk.Dialog {
}
private void add_control(Gtk.Widget widget, int x, int y) {
- Gtk.Alignment left_aligned = new Gtk.Alignment(0, 0.5f, 0, 0);
+ Gtk.Alignment left_aligned = new Gtk.Alignment(0, 0.5f, 1, 0);
left_aligned.add(widget);
table.attach(left_aligned, x, y, 1, 1);
@@ -857,7 +851,7 @@ public bool report_manifest(ImportManifest manifest, bool show_dest_id,
Gtk.Widget save_results_button = dialog.add_button(ImportUI.SAVE_RESULTS_BUTTON_NAME,
ImportUI.SAVE_RESULTS_RESPONSE_ID);
save_results_button.set_visible(manifest.success.size < manifest.all.size);
- Gtk.Widget ok_button = dialog.add_button(Gtk.Stock.OK, Gtk.ResponseType.OK);
+ Gtk.Widget ok_button = dialog.add_button(Resources.OK_LABEL, Gtk.ResponseType.OK);
dialog.set_default(ok_button);
Gtk.Window dialog_parent = (Gtk.Window) dialog.get_parent();
@@ -896,7 +890,7 @@ public bool report_manifest(ImportManifest manifest, bool show_dest_id,
internal void save_import_results(Gtk.Window? chooser_dialog_parent, string results_log) {
Gtk.FileChooserDialog chooser_dialog = new Gtk.FileChooserDialog(
ImportUI.SAVE_RESULTS_FILE_CHOOSER_TITLE, chooser_dialog_parent, Gtk.FileChooserAction.SAVE,
- Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL, Gtk.Stock.SAVE, Gtk.ResponseType.ACCEPT, null);
+ Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL, Resources.SAVE_AS_LABEL, Gtk.ResponseType.ACCEPT, null);
chooser_dialog.set_do_overwrite_confirmation(true);
chooser_dialog.set_current_folder(Environment.get_home_dir());
chooser_dialog.set_current_name("Shotwell Import Log.txt");
@@ -1196,6 +1190,10 @@ public class TextEntryDialog : Gtk.Dialog {
private Gtk.Button button2;
private Gtk.ButtonBox action_area_box;
+ public TextEntryDialog() {
+ Object (use_header_bar: 1);
+ }
+
public void set_builder(Gtk.Builder builder) {
this.builder = builder;
}
@@ -1204,7 +1202,6 @@ public class TextEntryDialog : Gtk.Dialog {
string? initial_text, Gee.Collection<string>? completion_list, string? completion_delimiter) {
set_title(title);
set_resizable(true);
- set_default_size (350, 104);
set_parent_window(AppWindow.get_instance().get_parent_window());
set_transient_for(AppWindow.get_instance());
on_modify_validate = modify_validate;
@@ -1220,8 +1217,8 @@ public class TextEntryDialog : Gtk.Dialog {
action_area_box = (Gtk.ButtonBox) get_action_area();
action_area_box.set_layout(Gtk.ButtonBoxStyle.END);
- button1 = (Gtk.Button) add_button(Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL);
- button2 = (Gtk.Button) add_button(Gtk.Stock.SAVE, Gtk.ResponseType.OK);
+ button1 = (Gtk.Button) add_button(Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL);
+ button2 = (Gtk.Button) add_button(Resources.SAVE_LABEL, Gtk.ResponseType.OK);
set_default_response(Gtk.ResponseType.OK);
if (completion_list != null) { // Textfield with autocompletion
@@ -1266,6 +1263,10 @@ public class MultiTextEntryDialog : Gtk.Dialog {
private Gtk.Button button2;
private Gtk.ButtonBox action_area_box;
+ public MultiTextEntryDialog() {
+ Object (use_header_bar: 1);
+ }
+
public void set_builder(Gtk.Builder builder) {
this.builder = builder;
}
@@ -1278,12 +1279,6 @@ public class MultiTextEntryDialog : Gtk.Dialog {
set_transient_for(AppWindow.get_instance());
on_modify_validate = modify_validate;
- Gtk.Label name_label = builder.get_object("label9") as Gtk.Label;
- name_label.set_text(label);
-
- Gtk.ScrolledWindow scrolled = builder.get_object("scrolledwindow1") as Gtk.ScrolledWindow;
- scrolled.set_shadow_type (Gtk.ShadowType.ETCHED_IN);
-
entry = builder.get_object("textview1") as Gtk.TextView;
entry.set_wrap_mode (Gtk.WrapMode.WORD);
entry.buffer = new Gtk.TextBuffer(null);
@@ -1294,8 +1289,9 @@ public class MultiTextEntryDialog : Gtk.Dialog {
action_area_box = (Gtk.ButtonBox) get_action_area();
action_area_box.set_layout(Gtk.ButtonBoxStyle.END);
- button1 = (Gtk.Button) add_button(Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL);
- button2 = (Gtk.Button) add_button(Gtk.Stock.SAVE, Gtk.ResponseType.OK);
+ button1 = (Gtk.Button) add_button(Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL);
+ button2 = (Gtk.Button) add_button(Resources.SAVE_LABEL, Gtk.ResponseType.OK);
+ set_default_response(Gtk.ResponseType.OK);
set_has_resize_grip(true);
}
@@ -1326,7 +1322,9 @@ public class EventRenameDialog : TextEntryDialogMediator {
public class EditTitleDialog : TextEntryDialogMediator {
public EditTitleDialog(string? photo_title) {
- base (_("Edit Title"), _("Title:"), photo_title);
+ // Dialog title
+ base (_("Edit Title"),
+ _("Title:"), photo_title);
}
public virtual string? execute() {
@@ -1340,7 +1338,10 @@ public class EditTitleDialog : TextEntryDialogMediator {
public class EditCommentDialog : MultiTextEntryDialogMediator {
public EditCommentDialog(string? comment, bool is_event = false) {
- string title_tmp = (is_event) ? _("Edit Event Comment") : _("Edit Photo/Video Comment");
+ string title_tmp = (is_event)
+ // Dialog title
+ ? _("Edit Event Comment")
+ : _("Edit Photo/Video Comment");
base(title_tmp, _("Comment:"), comment);
}
@@ -1477,7 +1478,7 @@ public class ProgressDialog : Gtk.Window {
vbox_bar.pack_start(progress_bar, true, false, 0);
if (cancellable != null) {
- cancel_button = new Gtk.Button.from_stock(Gtk.Stock.CANCEL);
+ cancel_button = new Gtk.Button.with_mnemonic(Resources.CANCEL_LABEL);
cancel_button.clicked.connect(on_cancel);
delete_event.connect(on_window_closed);
}
@@ -1648,12 +1649,14 @@ public class AdjustDateTimeDialog : Gtk.Dialog {
bool contains_video = false, bool only_video = false) {
assert(source != null);
+ Object(use_header_bar: 1);
+
set_modal(true);
set_resizable(false);
set_transient_for(AppWindow.get_instance());
- add_buttons(Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
- Gtk.Stock.OK, Gtk.ResponseType.OK);
+ add_buttons(Resources.CANCEL_LABEL, Gtk.ResponseType.CANCEL,
+ Resources.OK_LABEL, Gtk.ResponseType.OK);
set_title(Resources.ADJUST_DATE_TIME_LABEL);
calendar = new Gtk.Calendar();
@@ -1669,13 +1672,16 @@ public class AdjustDateTimeDialog : Gtk.Dialog {
hour.output.connect(on_spin_button_output);
hour.set_width_chars(2);
+ hour.set_max_width_chars(2);
minute = new Gtk.SpinButton.with_range(0, 59, 1);
minute.set_width_chars(2);
+ minute.set_max_width_chars(2);
minute.output.connect(on_spin_button_output);
second = new Gtk.SpinButton.with_range(0, 59, 1);
second.set_width_chars(2);
+ second.set_max_width_chars(2);
second.output.connect(on_spin_button_output);
system = new Gtk.ComboBoxText();
@@ -1684,14 +1690,14 @@ public class AdjustDateTimeDialog : Gtk.Dialog {
system.append_text(_("24 Hr"));
system.changed.connect(on_time_system_changed);
- Gtk.Box clock = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
+ Gtk.Box clock = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 3);
- clock.pack_start(hour, false, false, 3);
- clock.pack_start(new Gtk.Label(":"), false, false, 3); // internationalize?
- clock.pack_start(minute, false, false, 3);
- clock.pack_start(new Gtk.Label(":"), false, false, 3);
- clock.pack_start(second, false, false, 3);
- clock.pack_start(system, false, false, 3);
+ clock.pack_start(hour, false, false, 0);
+ clock.pack_start(new Gtk.Label(":"), false, false, 0); // internationalize?
+ clock.pack_start(minute, false, false, 0);
+ clock.pack_start(new Gtk.Label(":"), false, false, 0);
+ clock.pack_start(second, false, false, 0);
+ clock.pack_start(system, false, false, 0);
set_default_response(Gtk.ResponseType.OK);
@@ -1719,15 +1725,15 @@ public class AdjustDateTimeDialog : Gtk.Dialog {
modify_originals_check_button.sensitive = (!only_video) &&
(!Config.Facade.get_instance().get_commit_metadata_to_masters() && display_options);
- Gtk.Box time_content = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
+ Gtk.Box time_content = new Gtk.Box(Gtk.Orientation.VERTICAL, 5);
- time_content.pack_start(calendar, true, false, 3);
- time_content.pack_start(clock, true, false, 3);
+ time_content.pack_start(calendar, true, false, 0);
+ time_content.pack_start(clock, true, false, 0);
if (display_options) {
- time_content.pack_start(relativity_radio_button, true, false, 3);
- time_content.pack_start(batch_radio_button, true, false, 3);
- time_content.pack_start(modify_originals_check_button, true, false, 3);
+ time_content.pack_start(relativity_radio_button, true, false, 0);
+ time_content.pack_start(batch_radio_button, true, false, 0);
+ time_content.pack_start(modify_originals_check_button, true, false, 0);
}
Gdk.Pixbuf preview = null;
@@ -1740,26 +1746,26 @@ public class AdjustDateTimeDialog : Gtk.Dialog {
}
Gtk.Box image_content = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
+ image_content.set_valign(Gtk.Align.START);
+ image_content.set_homogeneous(true);
Gtk.Image image = (preview != null) ? new Gtk.Image.from_pixbuf(preview) : new Gtk.Image();
original_time_label = new Gtk.Label(null);
- image_content.pack_start(image, true, false, 3);
- image_content.pack_start(original_time_label, true, false, 3);
+ image_content.pack_start(image, true, false, 0);
+ image_content.pack_start(original_time_label, true, false, 0);
- Gtk.Box hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
- hbox.pack_start(image_content, true, false, 6);
- hbox.pack_start(time_content, true, false, 6);
+ Gtk.Box hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 10);
+ hbox.set_border_width(3);
+ hbox.pack_start(image_content, true, false, 0);
+ hbox.pack_start(time_content, true, false, 0);
Gtk.Alignment hbox_alignment = new Gtk.Alignment(0.5f, 0.5f, 0, 0);
- hbox_alignment.set_padding(6, 3, 6, 6);
hbox_alignment.add(hbox);
- ((Gtk.Box) get_content_area()).pack_start(hbox_alignment, true, false, 6);
+ ((Gtk.Box) get_content_area()).pack_start(hbox_alignment, true, false, 0);
notification = new Gtk.Label("");
notification.set_line_wrap(true);
notification.set_justify(Gtk.Justification.CENTER);
- notification.set_size_request(-1, -1);
- notification.set_padding(12, 6);
((Gtk.Box) get_content_area()).pack_start(notification, true, true, 0);
@@ -1779,8 +1785,8 @@ public class AdjustDateTimeDialog : Gtk.Dialog {
calendar.select_day(time.day);
if (Config.Facade.get_instance().get_use_24_hour_time()) {
- hour.set_value(time.hour);
system.set_active(TimeSystem.24HR);
+ hour.set_value(time.hour);
} else {
int AMPM_hour = time.hour % 12;
hour.set_value((AMPM_hour == 0) ? 12 : AMPM_hour);
@@ -2066,7 +2072,7 @@ public class WelcomeDialog : Gtk.Dialog {
public WelcomeDialog(Gtk.Window owner) {
import_meta_host = new Spit.DataImports.WelcomeImportMetaHost(this);
bool show_system_pictures_import = is_system_pictures_import_possible();
- Gtk.Widget ok_button = add_button(Gtk.Stock.OK, Gtk.ResponseType.OK);
+ Gtk.Widget ok_button = add_button(Resources.OK_LABEL, Gtk.ResponseType.OK);
set_title(_("Welcome!"));
set_resizable(false);
set_type_hint(Gdk.WindowTypeHint.DIALOG);
@@ -2265,7 +2271,6 @@ public class PreferencesDialog {
private Gee.ArrayList<PathFormat> path_formats = new Gee.ArrayList<PathFormat>();
private GLib.DateTime example_date = new GLib.DateTime.local(2009, 3, 10, 18, 16, 11);
private Gtk.CheckButton lowercase;
- private Gtk.Button close_button;
private Plugins.ManifestWidgetMediator plugins_mediator = new Plugins.ManifestWidgetMediator();
private Gtk.ComboBoxText default_raw_developer_combo;
@@ -2289,8 +2294,6 @@ public class PreferencesDialog {
library_dir_button = builder.get_object("library_dir_button") as Gtk.FileChooserButton;
- close_button = builder.get_object("close_button") as Gtk.Button;
-
photo_editor_combo = builder.get_object("external_photo_editor_combo") as Gtk.ComboBox;
raw_editor_combo = builder.get_object("external_raw_editor_combo") as Gtk.ComboBox;
@@ -2563,20 +2566,19 @@ public class PreferencesDialog {
if (is_string_empty(example) && !is_string_empty(dir_pattern_entry.text)) {
// Invalid pattern.
dir_pattern_example.set_text(_("Invalid pattern"));
- dir_pattern_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, Gtk.Stock.DIALOG_ERROR);
+ dir_pattern_entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, "dialog-error");
dir_pattern_entry.set_icon_activatable(Gtk.EntryIconPosition.SECONDARY, false);
set_allow_closing(false);
} else {
// Valid pattern.
dir_pattern_example.set_text(example);
- dir_pattern_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, null);
+ dir_pattern_entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, null);
set_allow_closing(true);
}
}
private void set_allow_closing(bool allow) {
dialog.set_deletable(allow);
- close_button.set_sensitive(allow);
allow_closing = allow;
}