Commit ac933585 authored by Jim Nelson's avatar Jim Nelson

#2638: Migration to Vala 0.11.7.

parent 63181b1c
......@@ -6,8 +6,7 @@ BUILD_ROOT = 1
VALAC := valac
VALAC_VERSION := `$(VALAC) --version | awk '{print $$2}'`
MIN_VALAC_VERSION := 0.10.4
MAX_VALAC_VERSION := 0.11.0
MIN_VALAC_VERSION := 0.11.7
INSTALL_PROGRAM := install
INSTALL_DATA := install -m 644
......
......@@ -257,9 +257,9 @@ public class Transaction {
use_custom_payload = false;
return;
}
message.set_request(payload_content_type, Soup.MemoryUse.COPY, custom_payload,
(payload_length > 0) ? payload_length : custom_payload.length);
ulong length = (payload_length > 0) ? payload_length : custom_payload.length;
message.set_request(payload_content_type, Soup.MemoryUse.COPY, custom_payload.data[0:length]);
use_custom_payload = true;
}
......@@ -316,7 +316,7 @@ public class Transaction {
}
message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY,
formdata_string, formdata_string.length);
formdata_string.data);
is_executed = true;
try {
send();
......@@ -411,8 +411,7 @@ public class UploadTransaction : Transaction {
int payload_part_num = message_parts.get_length();
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, payload,
payload_length);
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, payload.data[0:payload_length]);
message_parts.append_form_file("", publishable.get_serialized_file().get_path(), mime_type,
bindable_data);
......
......@@ -296,7 +296,7 @@ private class UploadTransaction: Transaction {
int image_part_num = message_parts.get_length();
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, photo_data, data_length);
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, photo_data.data[0:data_length]);
message_parts.append_form_file("", photo.get_serialized_file().get_path(), "image/jpeg", bindable_data);
unowned Soup.MessageHeaders image_part_header;
......
......@@ -832,12 +832,18 @@ internal class FacebookRESTSession {
string decoded_uri = Soup.URI.decode(good_login_uri);
// locate the session object description string within the decoded uri
string session_desc = decoded_uri.str("session={");
string? session_desc = null;
int index = decoded_uri.index_of("session={");
if (index >= 0)
session_desc = decoded_uri[index:decoded_uri.length];
if (session_desc == null)
throw new Spit.Publishing.PublishingError.MALFORMED_RESPONSE("Server redirect URL contained no session description");
// remove any trailing parameters from the session description string
string trailing_params = session_desc.chr(-1, '&');
string? trailing_params = null;
index = session_desc.index_of_char('&');
if (index >= 0)
trailing_params = session_desc[index:session_desc.length];
if (trailing_params != null)
session_desc = session_desc.replace(trailing_params, "");
......@@ -1147,7 +1153,7 @@ internal class FacebookRESTTransaction {
}
message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY,
formdata_string, formdata_string.length);
formdata_string.data);
is_executed = true;
try {
send();
......@@ -1305,8 +1311,7 @@ internal class FacebookUploadTransaction : FacebookRESTTransaction {
// bind the binary data read from disk into a Soup.Buffer object so that we
// can attach it to the multipart request, then actaully append the buffer
// to the multipart request. Then, set the MIME type for this part.
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, payload,
payload_length);
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, payload.data[0:payload_length]);
message_parts.append_form_file("", file.get_path(), mime_type, bindable_data);
// set up the Content-Disposition header for the multipart part that contains the
......@@ -1468,7 +1473,8 @@ internal class WebAuthenticationPane : Spit.Publishing.DialogPane, Object {
// strip parameters from the loaded url
if (loaded_url.contains("?")) {
string params = loaded_url.chr(-1, '?');
int index = loaded_url.index_of_char('?');
string params = loaded_url[index:loaded_url.length];
loaded_url = loaded_url.replace(params, "");
}
......
......@@ -541,7 +541,7 @@ public class FlickrPublisher : Spit.Publishing.Publisher, GLib.Object {
throw new Spit.Publishing.PublishingError.MALFORMED_RESPONSE(
"Unable to determine if user has free or pro account");
int quota_mb_left = remaining_kb_str.to_int() / 1024;
int quota_mb_left = int.parse(remaining_kb_str) / 1024;
parameters.quota_free_mb = quota_mb_left;
parameters.user_kind = user_kind;
......
......@@ -198,8 +198,9 @@ public class PicasaPublisher : Spit.Publishing.Publisher, GLib.Object {
return;
debug("EVENT: network transaction to fetch token for login completed successfully.");
string auth_substring = txn.get_response().str("Auth=");
int index = txn.get_response().index_of("Auth=");
string auth_substring = (index >= 0) ? txn.get_response()[index:txn.get_response().length] : "";
auth_substring = auth_substring.chomp();
string auth_token = auth_substring.substring(5);
......@@ -705,8 +706,7 @@ internal class UploadTransaction : AuthenticatedTransaction {
string metadata = METADATA_TEMPLATE.printf(Publishing.RESTSupport.decimal_entity_encode(
publishable.get_publishing_name()), Publishing.RESTSupport.decimal_entity_encode(
publishable.get_publishing_name()));
Soup.Buffer metadata_buffer = new Soup.Buffer(Soup.MemoryUse.COPY, metadata,
metadata.length);
Soup.Buffer metadata_buffer = new Soup.Buffer(Soup.MemoryUse.COPY, metadata.data);
message_parts.append_form_file("", "", "application/atom+xml", metadata_buffer);
// attempt to read the binary image data from disk
......@@ -726,7 +726,7 @@ internal class UploadTransaction : AuthenticatedTransaction {
// bind the binary image data read from disk into a Soup.Buffer object so that we
// can attach it to the multipart request, then actaully append the buffer
// to the multipart request. Then, set the MIME type for this part.
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, photo_data, data_length);
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, photo_data.data[0:data_length]);
message_parts.append_form_file("", publishable.get_serialized_file().get_path(), mime_type,
bindable_data);
......
......@@ -210,8 +210,9 @@ public class YouTubePublisher : Spit.Publishing.Publisher, GLib.Object {
return;
debug("EVENT: network transaction to fetch token for login completed successfully.");
string auth_substring = txn.get_response().str("Auth=");
int index = txn.get_response().index_of("Auth=");
string auth_substring = txn.get_response().substring(0, index);
auth_substring = auth_substring.chomp();
string auth_token = auth_substring.substring(5);
......@@ -632,8 +633,7 @@ internal class UploadTransaction : AuthenticatedTransaction {
string metadata = METADATA_TEMPLATE.printf(Publishing.RESTSupport.decimal_entity_encode(
publishable.get_publishing_name()), private_video, unlisted_video);
Soup.Buffer metadata_buffer = new Soup.Buffer(Soup.MemoryUse.COPY, metadata,
metadata.length);
Soup.Buffer metadata_buffer = new Soup.Buffer(Soup.MemoryUse.COPY, metadata.data);
message_parts.append_form_file("", "", "application/atom+xml", metadata_buffer);
// attempt to read the binary video data from disk
......@@ -653,7 +653,7 @@ internal class UploadTransaction : AuthenticatedTransaction {
// bind the binary video data read from disk into a Soup.Buffer object so that we
// can attach it to the multipart request, then actaully append the buffer
// to the multipart request. Then, set the MIME type for this part.
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, video_data, data_length);
Soup.Buffer bindable_data = new Soup.Buffer(Soup.MemoryUse.COPY, video_data.data[0:data_length]);
message_parts.append_form_file("", publishable.get_serialized_file().get_path(), "video/mpeg",
bindable_data);
......
......@@ -11,7 +11,7 @@ public class FullscreenWindow : PageWindow {
private Gtk.Window toolbar_window = new Gtk.Window(Gtk.WindowType.POPUP);
private Gtk.UIManager ui = new Gtk.UIManager();
private Gtk.ToolButton close_button = new Gtk.ToolButton.from_stock(Gtk.STOCK_LEAVE_FULLSCREEN);
private Gtk.ToolButton close_button = new Gtk.ToolButton.from_stock(Gtk.Stock.LEAVE_FULLSCREEN);
private Gtk.ToggleToolButton pin_button = new Gtk.ToggleToolButton.from_stock(Resources.PIN_TOOLBAR);
private bool is_toolbar_shown = false;
private bool waiting_for_invoke = false;
......@@ -133,7 +133,7 @@ public class FullscreenWindow : PageWindow {
private Gtk.ActionEntry[] create_actions() {
Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0];
Gtk.ActionEntry leave_fullscreen = { "LeaveFullscreen", Gtk.STOCK_LEAVE_FULLSCREEN,
Gtk.ActionEntry leave_fullscreen = { "LeaveFullscreen", Gtk.Stock.LEAVE_FULLSCREEN,
TRANSLATABLE, "F11", TRANSLATABLE, on_close };
leave_fullscreen.label = _("Leave _Fullscreen");
leave_fullscreen.tooltip = _("Leave fullscreen");
......@@ -470,25 +470,25 @@ public abstract class AppWindow : PageWindow {
private Gtk.ActionEntry[] create_common_actions() {
Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0];
Gtk.ActionEntry quit = { "CommonQuit", Gtk.STOCK_QUIT, TRANSLATABLE, "<Ctrl>Q",
Gtk.ActionEntry quit = { "CommonQuit", Gtk.Stock.QUIT, TRANSLATABLE, "<Ctrl>Q",
TRANSLATABLE, on_quit };
quit.label = _("_Quit");
quit.tooltip = _("Quit Shotwell");
actions += quit;
Gtk.ActionEntry about = { "CommonAbout", Gtk.STOCK_ABOUT, TRANSLATABLE, null,
Gtk.ActionEntry about = { "CommonAbout", Gtk.Stock.ABOUT, TRANSLATABLE, null,
TRANSLATABLE, on_about };
about.label = _("_About");
about.tooltip = _("About Shotwell");
actions += about;
Gtk.ActionEntry fullscreen = { "CommonFullscreen", Gtk.STOCK_FULLSCREEN,
Gtk.ActionEntry fullscreen = { "CommonFullscreen", Gtk.Stock.FULLSCREEN,
TRANSLATABLE, "F11", TRANSLATABLE, on_fullscreen };
fullscreen.label = _("Fulls_creen");
fullscreen.tooltip = _("Use Shotwell at fullscreen");
actions += fullscreen;
Gtk.ActionEntry help_contents = { "CommonHelpContents", Gtk.STOCK_HELP,
Gtk.ActionEntry help_contents = { "CommonHelpContents", Gtk.Stock.HELP,
TRANSLATABLE, "F1", TRANSLATABLE, on_help_contents };
help_contents.label = _("_Contents");
help_contents.tooltip = _("More information on Shotwell");
......@@ -500,25 +500,25 @@ public abstract class AppWindow : PageWindow {
help_faq.tooltip = _("Answers to common questions about Shotwell");
actions += help_faq;
Gtk.ActionEntry undo = { "CommonUndo", Gtk.STOCK_UNDO, TRANSLATABLE, "<Ctrl>Z",
Gtk.ActionEntry undo = { "CommonUndo", Gtk.Stock.UNDO, TRANSLATABLE, "<Ctrl>Z",
TRANSLATABLE, on_undo };
undo.label = Resources.UNDO_MENU;
undo.tooltip = Resources.UNDO_TOOLTIP;
actions += undo;
Gtk.ActionEntry redo = { "CommonRedo", Gtk.STOCK_REDO, TRANSLATABLE, "<Ctrl><Shift>Z",
Gtk.ActionEntry redo = { "CommonRedo", Gtk.Stock.REDO, TRANSLATABLE, "<Ctrl><Shift>Z",
TRANSLATABLE, on_redo };
redo.label = Resources.REDO_MENU;
redo.tooltip = Resources.REDO_TOOLTIP;
actions += redo;
Gtk.ActionEntry jump_to_file = { "CommonJumpToFile", Gtk.STOCK_JUMP_TO, TRANSLATABLE,
Gtk.ActionEntry jump_to_file = { "CommonJumpToFile", Gtk.Stock.JUMP_TO, TRANSLATABLE,
"<Ctrl><Shift>M", TRANSLATABLE, on_jump_to_file };
jump_to_file.label = Resources.JUMP_TO_FILE_MENU;
jump_to_file.tooltip = Resources.JUMP_TO_FILE_TOOLTIP;
actions += jump_to_file;
Gtk.ActionEntry select_all = { "CommonSelectAll", Gtk.STOCK_SELECT_ALL, TRANSLATABLE,
Gtk.ActionEntry select_all = { "CommonSelectAll", Gtk.Stock.SELECT_ALL, TRANSLATABLE,
"<Ctrl>A", TRANSLATABLE, on_select_all };
select_all.label = Resources.SELECT_ALL_MENU;
select_all.tooltip = Resources.SELECT_ALL_TOOLTIP;
......
......@@ -1413,7 +1413,7 @@ private class PrepareFilesJob : BackgroundImportJob {
private static int get_test_variable(string name) {
string value = Environment.get_variable(name);
return (value == null || value.length == 0) ? 0 : value.to_int();
return (value == null || value.length == 0) ? 0 : int.parse(value);
}
public override void execute() {
......
......@@ -26,7 +26,7 @@ private class CheckerboardItemText {
}
private bool is_single_line() {
return text.chr(-1, '\n') == null;
return !String.contains_char(text, '\n');
}
public bool is_marked_up() {
......
......@@ -131,7 +131,7 @@ public abstract class CollectionPage : MediaPage {
protected override Gtk.ActionEntry[] init_collect_action_entries() {
Gtk.ActionEntry[] actions = base.init_collect_action_entries();
Gtk.ActionEntry print = { "Print", Gtk.STOCK_PRINT, TRANSLATABLE, "<Ctrl>P",
Gtk.ActionEntry print = { "Print", Gtk.Stock.PRINT, TRANSLATABLE, "<Ctrl>P",
TRANSLATABLE, on_print };
print.label = Resources.PRINT_MENU;
print.tooltip = Resources.PRINT_TOOLTIP;
......@@ -173,7 +173,7 @@ public abstract class CollectionPage : MediaPage {
enhance.tooltip = Resources.ENHANCE_TOOLTIP;
actions += enhance;
Gtk.ActionEntry revert = { "Revert", Gtk.STOCK_REVERT_TO_SAVED, TRANSLATABLE, null,
Gtk.ActionEntry revert = { "Revert", Gtk.Stock.REVERT_TO_SAVED, TRANSLATABLE, null,
TRANSLATABLE, on_revert };
revert.label = Resources.REVERT_MENU;
revert.tooltip = Resources.REVERT_TOOLTIP;
......@@ -197,7 +197,7 @@ public abstract class CollectionPage : MediaPage {
adjust_date_time.tooltip = Resources.ADJUST_DATE_TIME_TOOLTIP;
actions += adjust_date_time;
Gtk.ActionEntry external_edit = { "ExternalEdit", Gtk.STOCK_EDIT, TRANSLATABLE, "<Ctrl>Return",
Gtk.ActionEntry external_edit = { "ExternalEdit", Gtk.Stock.EDIT, TRANSLATABLE, "<Ctrl>Return",
TRANSLATABLE, on_external_edit };
external_edit.label = Resources.EXTERNAL_EDIT_MENU;
external_edit.tooltip = Resources.EXTERNAL_EDIT_TOOLTIP;
......
......@@ -56,7 +56,7 @@ public SortedList<AppInfo> get_apps_for_mime_types(string[] mime_types) {
// 3 loops because SortedList.contains() wasn't paying nicely with AppInfo,
// probably because it has a special equality function
foreach (string mime_type in mime_types) {
string content_type = g_content_type_from_mime_type(mime_type);
string content_type = ContentType.from_mime_type(mime_type);
if (content_type == null)
break;
......
......@@ -15,8 +15,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, Gtk.Stock.CANCEL,
Gtk.ResponseType.CANCEL, Gtk.Stock.SAVE, 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);
......@@ -41,8 +41,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, Gtk.Stock.CANCEL,
Gtk.ResponseType.CANCEL, Gtk.Stock.OK, Gtk.ResponseType.ACCEPT, null);
chooser.set_current_folder(current_export_dir.get_path());
chooser.set_local_only(false);
......@@ -183,8 +183,8 @@ public class ExportDialog : Gtk.Dialog {
((Gtk.VBox) 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(Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL);
ok_button = add_button(Gtk.Stock.OK, Gtk.ResponseType.OK);
ok_button.set_flags(ok_button.get_flags() | Gtk.WidgetFlags.CAN_DEFAULT | Gtk.WidgetFlags.HAS_DEFAULT);
set_default(ok_button);
......@@ -270,7 +270,7 @@ public class ExportDialog : Gtk.Dialog {
constraint = CONSTRAINT_ARRAY[index];
current_constraint = constraint;
scale = pixels_entry.get_text().to_int();
scale = int.parse(pixels_entry.get_text());
if (constraint != ScaleConstraint.ORIGINAL)
assert(scale > 0);
current_scale = scale;
......@@ -364,7 +364,7 @@ public class ExportDialog : Gtk.Dialog {
}
private void on_pixels_changed() {
ok_button.sensitive = (pixels_entry.get_text_length() > 0) && (pixels_entry.get_text().to_int() > 0);
ok_button.sensitive = (pixels_entry.get_text_length() > 0) && (int.parse(pixels_entry.get_text()) > 0);
}
private void on_pixels_insert_text(string text, int length, void *position) {
......@@ -695,7 +695,7 @@ public class EntryMultiCompletion : Gtk.EntryCompletion {
// Use a "COMPOSE" normalization to allow comparison to the position value returned by
// Gtk.Entry, i.e. one character=one position. Using the default normalization a character
// like "é" or "ö" would have a length of two.
possible_match = possible_match.casefold().normalize(-1, NormalizeMode.ALL_COMPOSE);
possible_match = possible_match.casefold().normalize(-1, NormalizeMode.ALL_COMPOSE);
string normed_key = key.normalize(-1, NormalizeMode.ALL_COMPOSE);
if (delimiter == null) {
......@@ -703,7 +703,7 @@ public class EntryMultiCompletion : Gtk.EntryCompletion {
} else {
if (normed_key.contains(delimiter)) {
// check whether cursor is before last delimiter
long offset = normed_key.pointer_to_offset(normed_key.rchr(-1, delimiter[0]));
int offset = normed_key.char_count(normed_key.last_index_of_char(delimiter[0]));
int position = ((Gtk.Entry) get_entry()).get_position();
if (position <= offset)
return false; // TODO: Autocompletion for tags not last in list
......@@ -727,7 +727,7 @@ public class EntryMultiCompletion : Gtk.EntryCompletion {
string old_text = entry.get_text();
if (old_text.length > 0) {
if (old_text.contains(delimiter)) {
long start = old_text.pointer_to_offset(old_text.rchr(-1, delimiter[0]));
int start = old_text.char_count(old_text.last_index_of_char(delimiter[0]));
old_text = old_text.substring(0, start + 1) + (delimiter != " " ? " " : "");
} else
old_text = "";
......@@ -1008,7 +1008,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.from_stock(Gtk.Stock.CANCEL);
cancel_button.clicked.connect(on_cancel);
delete_event.connect(on_window_closed);
}
......@@ -1152,8 +1152,8 @@ public class AdjustDateTimeDialog : Gtk.Dialog {
has_separator = false;
set_transient_for(AppWindow.get_instance());
add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK);
add_buttons(Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
Gtk.Stock.OK, Gtk.ResponseType.OK);
set_title(Resources.ADJUST_DATE_TIME_LABEL);
calendar = new Gtk.Calendar();
......@@ -1527,7 +1527,7 @@ public class WelcomeDialog : Gtk.Dialog {
public WelcomeDialog(Gtk.Window owner) {
bool show_fspot_import = is_fspot_import_possible();
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(Gtk.Stock.OK, Gtk.ResponseType.OK);
set_title(_("Welcome!"));
set_resizable(false);
has_separator = false;
......@@ -1617,7 +1617,7 @@ public class WelcomeDialog : Gtk.Dialog {
ok_button.grab_focus();
}
public bool execute(out bool do_fspot_import = false, out bool do_system_pictures_import = false) {
public bool execute(out bool do_fspot_import, out bool do_system_pictures_import) {
show_all();
bool ok = (run() == Gtk.ResponseType.OK);
......@@ -1626,10 +1626,9 @@ public class WelcomeDialog : Gtk.Dialog {
if (ok)
show_dialog = !hide_button.get_active();
if (fspot_import_check != null)
do_fspot_import = fspot_import_check.get_active();
if (system_pictures_import_check != null)
do_system_pictures_import = system_pictures_import_check.get_active();
do_fspot_import = (fspot_import_check != null) ? fspot_import_check.get_active() : false;
do_system_pictures_import =
(system_pictures_import_check != null) ? system_pictures_import_check.get_active() : false;
destroy();
......@@ -1944,7 +1943,7 @@ 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_stock(Gtk.EntryIconPosition.SECONDARY, Gtk.Stock.DIALOG_ERROR);
dir_pattern_entry.set_icon_activatable(Gtk.EntryIconPosition.SECONDARY, false);
set_allow_closing(false);
} else {
......
......@@ -68,7 +68,7 @@ public class DirectoryMonitor : Object {
public const bool SUPPORT_DIR_SYMLINKS = true;
public const bool SUPPORT_FILE_SYMLINKS = false;
protected const string SUPPLIED_ATTRIBUTES = Util.FILE_ATTRIBUTES;
public const string SUPPLIED_ATTRIBUTES = Util.FILE_ATTRIBUTES;
private const FileMonitorFlags FILE_MONITOR_FLAGS = FileMonitorFlags.SEND_MOVED;
private const uint DELETED_EXPIRATION_MSEC = 500;
......
......@@ -544,8 +544,8 @@ public class CropTool : EditingTool {
private class CropToolWindow : EditingToolWindow {
private const int CONTROL_SPACING = 8;
public Gtk.Button ok_button = new Gtk.Button.from_stock(Gtk.STOCK_OK);
public Gtk.Button cancel_button = new Gtk.Button.from_stock(Gtk.STOCK_CANCEL);
public Gtk.Button ok_button = new Gtk.Button.from_stock(Gtk.Stock.OK);
public Gtk.Button cancel_button = new Gtk.Button.from_stock(Gtk.Stock.CANCEL);
public Gtk.ComboBox constraint_combo;
public Gtk.Button pivot_reticle_button = new Gtk.Button();
public Gtk.Entry custom_width_entry = new Gtk.Entry();
......@@ -717,8 +717,8 @@ public class CropTool : EditingTool {
}
private bool on_custom_entry_focus_out(Gdk.EventFocus event) {
int width = crop_tool_window.custom_width_entry.text.to_int();
int height = crop_tool_window.custom_height_entry.text.to_int();
int width = int.parse(crop_tool_window.custom_width_entry.text);
int height = int.parse(crop_tool_window.custom_height_entry.text);
if ((width == custom_width) && (height == custom_height))
return false;
......@@ -1745,9 +1745,9 @@ public class RedeyeTool : EditingTool {
private Gtk.Label slider_label = new Gtk.Label.with_mnemonic(_("Size:"));
public Gtk.Button apply_button =
new Gtk.Button.from_stock(Gtk.STOCK_APPLY);
new Gtk.Button.from_stock(Gtk.Stock.APPLY);
public Gtk.Button close_button =
new Gtk.Button.from_stock(Gtk.STOCK_CLOSE);
new Gtk.Button.from_stock(Gtk.Stock.CLOSE);
public Gtk.HScale slider = new Gtk.HScale.with_range(
RedeyeInstance.MIN_RADIUS, RedeyeInstance.MAX_RADIUS, 1.0);
......@@ -2062,9 +2062,9 @@ public class AdjustTool : EditingTool {
public Gtk.HScale shadows_slider = new Gtk.HScale.with_range(
ShadowDetailTransformation.MIN_PARAMETER, ShadowDetailTransformation.MAX_PARAMETER,
1.0);
public Gtk.Button ok_button = new Gtk.Button.from_stock(Gtk.STOCK_OK);
public Gtk.Button ok_button = new Gtk.Button.from_stock(Gtk.Stock.OK);
public Gtk.Button reset_button = new Gtk.Button.with_mnemonic(_("_Reset"));
public Gtk.Button cancel_button = new Gtk.Button.from_stock(Gtk.STOCK_CANCEL);
public Gtk.Button cancel_button = new Gtk.Button.from_stock(Gtk.Stock.CANCEL);
public RGBHistogramManipulator histogram_manipulator = new RGBHistogramManipulator();
public AdjustToolWindow(Gtk.Window container) {
......
......@@ -5,17 +5,22 @@
*/
class EventDirectoryItem : CheckerboardItem {
public const int CROPPED_SCALE = ThumbnailCache.Size.MEDIUM.get_scale()
+ ((ThumbnailCache.Size.BIG.get_scale() - ThumbnailCache.Size.MEDIUM.get_scale()) / 2);
public static Scaling squared_scaling = Scaling.to_fill_viewport(Dimensions(CROPPED_SCALE, CROPPED_SCALE));
private static int CROPPED_SCALE {
get {
return ThumbnailCache.Size.MEDIUM.get_scale()
+ ((ThumbnailCache.Size.BIG.get_scale() - ThumbnailCache.Size.MEDIUM.get_scale()) / 2);
}
}
public static Scaling squared_scaling = Scaling.to_fill_viewport(Dimensions(CROPPED_SCALE,
CROPPED_SCALE));
public Event event;
private Gdk.Rectangle paul_lynde = Gdk.Rectangle();
public EventDirectoryItem(Event event) {
base(event, Dimensions(CROPPED_SCALE, CROPPED_SCALE), get_formatted_title(event), true,
base (event, Dimensions(CROPPED_SCALE, CROPPED_SCALE), get_formatted_title(event), true,
Pango.Alignment.CENTER);
this.event = event;
......
......@@ -133,7 +133,7 @@ namespace GPhoto {
}
}
MemoryInputStream mins = new MemoryInputStream.from_data(raw, raw.length, null);
MemoryInputStream mins = new MemoryInputStream.from_data(raw, null);
return new Gdk.Pixbuf.from_stream(mins, null);
}
......@@ -198,10 +198,10 @@ namespace GPhoto {
unowned uint8[] data;
res = camera_file.get_data_and_size(out data);
if (res == Result.OK) {
uint8 *buffer = malloc(data.length);
uint8[] buffer = new uint8[data.length];
Memory.copy(buffer, data, data.length);
return new MemoryInputStream.from_data(buffer, data.length, on_mins_destroyed);
return new MemoryInputStream.from_data(buffer, on_mins_destroyed);
}
// if not stored in memory, try copying it to a temp file and then reading out of that
......
......@@ -250,7 +250,7 @@ class ImportPreview : MediaSourceItem {
bool using_placeholder = (pixbuf == null);
if (pixbuf == null) {
if (placeholder_preview == null) {
placeholder_preview = AppWindow.get_instance().render_icon(Gtk.STOCK_MISSING_IMAGE,
placeholder_preview = AppWindow.get_instance().render_icon(Gtk.Stock.MISSING_IMAGE,
Gtk.IconSize.DIALOG, null);
placeholder_preview = scale_pixbuf(placeholder_preview, MAX_SCALE,
Gdk.InterpType.BILINEAR, true);
......@@ -1404,7 +1404,7 @@ public class ImportPage : CheckerboardPage {
photos_string, videos_string, both_string, _("File error"));
ImportUI.QuestionParams question = new ImportUI.QuestionParams(
question_string, Gtk.STOCK_DELETE, _("_Keep"));
question_string, Gtk.Stock.DELETE, _("_Keep"));
if (!ImportUI.report_manifest(manifest, false, question))
return;
......@@ -1483,7 +1483,7 @@ public class ImportQueuePage : SinglePhotoPage {
Gtk.Toolbar toolbar = get_toolbar();
// Stop button
Gtk.ToolButton stop_button = new Gtk.ToolButton.from_stock(Gtk.STOCK_STOP);
Gtk.ToolButton stop_button = new Gtk.ToolButton.from_stock(Gtk.Stock.STOP);
stop_button.set_related_action(get_action("Stop"));
toolbar.insert(stop_button, -1);
......@@ -1515,7 +1515,7 @@ public class ImportQueuePage : SinglePhotoPage {
file.label = _("_File");
actions += file;
Gtk.ActionEntry stop = { "Stop", Gtk.STOCK_STOP, TRANSLATABLE, null, TRANSLATABLE,
Gtk.ActionEntry stop = { "Stop", Gtk.Stock.STOP, TRANSLATABLE, null, TRANSLATABLE,
on_stop };
stop.label = _("_Stop Import");
stop.tooltip = _("Stop importing photos");
......
......@@ -7,8 +7,12 @@
public class LibraryWindow : AppWindow {
public const int SIDEBAR_MIN_WIDTH = 200;
public const int SIDEBAR_MAX_WIDTH = 320;
public const int PAGE_MIN_WIDTH =
Thumbnail.MAX_SCALE + (CheckerboardLayout.COLUMN_GUTTER_PADDING * 2);
public static int PAGE_MIN_WIDTH {
get {
return Thumbnail.MAX_SCALE + (CheckerboardLayout.COLUMN_GUTTER_PADDING * 2);
}
}
public const int SORT_EVENTS_ORDER_ASCENDING = 0;
public const int SORT_EVENTS_ORDER_DESCENDING = 1;
......@@ -359,13 +363,13 @@ public class LibraryWindow : AppWindow {
sort.label = _("Sort _Events");
actions += sort;
Gtk.ActionEntry preferences = { "CommonPreferences", Gtk.STOCK_PREFERENCES, TRANSLATABLE,
Gtk.ActionEntry preferences = { "CommonPreferences", Gtk.Stock.PREFERENCES, TRANSLATABLE,
null, TRANSLATABLE, on_preferences };
preferences.label = Resources.PREFERENCES_MENU;
preferences.tooltip = Resources.PREFERENCES_TOOLTIP;
actions += preferences;
Gtk.ActionEntry empty = { "CommonEmptyTrash", Gtk.STOCK_CLEAR, TRANSLATABLE, null, null,
Gtk.ActionEntry empty = { "CommonEmptyTrash", Gtk.Stock.CLEAR, TRANSLATABLE, null, null,
on_empty_trash };
empty.label = _("Empty T_rash");
empty.tooltip = _("Delete all photos in the trash");
......@@ -377,7 +381,7 @@ public class LibraryWindow : AppWindow {
jump_to_event.tooltip = _("Go to this photo's event");
actions += jump_to_event;
Gtk.ActionEntry find = { "CommonFind", Gtk.STOCK_FIND, TRANSLATABLE, null, null,
Gtk.ActionEntry find = { "CommonFind", Gtk.Stock.FIND, TRANSLATABLE, null, null,
on_find };
find.label = _("_Find");
find.tooltip = _("Find photos and videos by search criteria");
......@@ -407,7 +411,7 @@ public class LibraryWindow : AppWindow {
extended_props.tooltip = _("Display extended information for the selection");
actions += extended_props;
Gtk.ToggleActionEntry searchbar = { "CommonDisplaySearchbar", Gtk.STOCK_FIND, TRANSLATABLE,
Gtk.ToggleActionEntry searchbar = { "CommonDisplaySearchbar", Gtk.Stock.FIND, TRANSLATABLE,
"F8", TRANSLATABLE, on_display_searchbar, is_search_toolbar_visible };
searchbar.label = _("_Search Bar");
searchbar.tooltip = _("Display the search bar");
......@@ -420,14 +424,14 @@ public class LibraryWindow : AppWindow {
Gtk.RadioActionEntry[] actions = new Gtk.RadioActionEntry[0];
Gtk.RadioActionEntry ascending = { "CommonSortEventsAscending",
Gtk.STOCK_SORT_ASCENDING, TRANSLATABLE, null, TRANSLATABLE,
Gtk.Stock.SORT_ASCENDING, TRANSLATABLE, null, TRANSLATABLE,
SORT_EVENTS_ORDER_ASCENDING };
ascending.label = _("_Ascending");
ascending.tooltip = _("Sort photos in an ascending order");
actions += ascending;
Gtk.RadioActionEntry descending = { "CommonSortEventsDescending",
Gtk.STOCK_SORT_DESCENDING, TRANSLATABLE, null, TRANSLATABLE,
Gtk.Stock.SORT_DESCENDING, TRANSLATABLE, null, TRANSLATABLE,
SORT_EVENTS_ORDER_DESCENDING };
descending.label = _("D_escending");
descending.tooltip = _("Sort photos in a descending order");
......@@ -640,8 +644,8 @@ public class LibraryWindow : AppWindow {
private void on_file_import() {
Gtk.FileChooserDialog import_dialog = new Gtk.FileChooserDialog(_("Import From Folder"), null,
Gtk.FileChooserAction.SELECT_FOLDER, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK);
Gtk.FileChooserAction.SELECT_FOLDER, Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
Gtk.Stock.OK, Gtk.ResponseType.OK);
import_dialog.set_local_only(false);
import_dialog.set_select_multiple(true);
import_dialog.set_current_folder(import_dir);
......
......@@ -573,15 +573,9 @@ public abstract class MediaSourceCollection : DatabaseSourceCollection {
public virtual MediaSource? fetch_by_source_id(string source_id) {
string[] components = source_id.split("-");
assert(components.length == 2);
unowned string endptr;
int64 id = components[1].to_int64(out endptr, 16);
assert(endptr[0] == '\0');
return fetch_by_numeric_id(id);
return fetch_by_numeric_id(parse_int64(components[1], 16));
}
public abstract Gee.Collection<string> get_event_source_ids(EventID event_id);
......
......@@ -273,7 +273,7 @@ public abstract class MediaPage : CheckerboardPage {
file.label = _("_File");