Skip to content

Commit

Permalink
Fix scale position at bottom of windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aharotias2 committed Jun 17, 2023
1 parent 894e15f commit 80f8194
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 86 deletions.
1 change: 0 additions & 1 deletion src/Model/DualFileAccessor.vala
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,3 @@ namespace ParaPara {
}
}
}

6 changes: 3 additions & 3 deletions src/Model/FileList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ParaPara {
public signal void terminated();
public signal void directory_not_found();
public signal void file_not_found();

public FileSystemNotifier notifier {
get;
private set;
Expand All @@ -38,7 +38,7 @@ namespace ParaPara {
get;
construct set;
}

public bool closed {
get;
private set;
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace ParaPara {
notifier.watch.begin();
debug("file list watching has been started!");
}

public void close() {
closed = true;
notifier.quit();
Expand Down
10 changes: 5 additions & 5 deletions src/Model/FileSystemNotifier.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FileSystemNotifier : Object {
public string directory_path { get; private set; }
private bool loop_quit_flag;
private int inotify_fd;

public FileSystemNotifier(string directory_path) {
this.directory_path = directory_path;
// inotify初期化
Expand All @@ -37,7 +37,7 @@ public class FileSystemNotifier : Object {
return;
}
}

public async void watch() {
// IOChannelの作成
IOChannel inotify_channel = new IOChannel.unix_new(inotify_fd);
Expand All @@ -61,7 +61,7 @@ public class FileSystemNotifier : Object {
});

loop_quit_flag = false;

// inotifyイベントループを開始
while (!loop_quit_flag) {
// inotifyのウォッチ開始
Expand All @@ -77,11 +77,11 @@ public class FileSystemNotifier : Object {
// inotifyのファイル記述子を閉じる。
Posix.close(inotify_fd);
}

public void quit() {
loop_quit_flag = true;
}

private void handle_event() {
if (!FileUtils.test(directory_path, FileTest.EXISTS)) {
debug("directory has been deleted!");
Expand Down
3 changes: 1 addition & 2 deletions src/Model/SlideFileAccessor.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace ParaPara {
get;
construct;
}

public SortOrder sort_order {
get;
set;
Expand Down Expand Up @@ -63,4 +63,3 @@ namespace ParaPara {
}
}
}

1 change: 0 additions & 1 deletion src/Model/ViewMode.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ namespace ParaPara {
SINGLE_VIEW_MODE, SLIDE_VIEW_MODE, DUAL_VIEW_MODE
}
}

1 change: 0 additions & 1 deletion src/Utils/FileUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ namespace ParaPara {
}
}
}

12 changes: 6 additions & 6 deletions src/Utils/inotify-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ int read_inotify_event(int fd, GeeQueue* queue) {

// ファイル記述子から読み込んでバッファにデータを写す
int r = read(fd, buffer, 30000);
InotifyEvent* pevent;
InotifyEvent* pevent;

while (buffer_i < r) {
// バッファからinotify_event構造体を読み出す。
InotifyEvent* pevent = (InotifyEvent*) &buffer[buffer_i];

// inotify_event構造体のサイズは16 + lenフィールドの値
int event_size = sizeof(InotifyEvent) + pevent->len;

// キューに入れるため、メモリを確保する
InotifyEvent* event = malloc(event_size);

// inotify_event構造体をコピーする
memmove(event, pevent, event_size);

// コピーしたinotify_event構造体へのポインタをキューに入れる
gee_queue_offer(queue, event);

// イベントを最後まで読み込む
buffer_i += event_size;
}
Expand Down
18 changes: 9 additions & 9 deletions src/Widgets/Image.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ namespace ParaPara {
get;
set;
}

public File? fileref {
get;
set;
}

public bool fit {
get;
set;
}

public bool is_animation {
get;
private set;
}

public bool paused {
get {
return paused_value;
Expand All @@ -60,7 +60,7 @@ namespace ParaPara {
}

private ViewMode _view_mode;

public ViewMode view_mode {
get {
return _view_mode;
Expand All @@ -75,24 +75,24 @@ namespace ParaPara {
return zoom_percent / 10.0;
}
}

public int original_height {
get {
return original_pixbuf.height;
}
}

public int original_width {
get {
return original_pixbuf.width;
}
}

public bool has_image {
get;
set;
}

public Pixbuf? original_pixbuf {
get;
private set;
Expand Down
14 changes: 7 additions & 7 deletions src/Widgets/ImageView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,34 @@ namespace ParaPara {
get;
construct;
}

public abstract ParaPara.Window main_window {
get;
construct;
}

public abstract FileList file_list {
get;
set;
}

public abstract bool controllable {
get;
set;
}

public abstract string dir_path {
owned get;
}

public abstract bool has_image {
get;
}

public abstract double position {
get;
}

public abstract int index {
get;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/ResizeDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace ParaPara {
construct set;
get;
}

public int original_height {
construct set;
get;
Expand Down
18 changes: 9 additions & 9 deletions src/Widgets/SingleImageView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,50 @@ namespace ParaPara {
get;
construct;
}

public Overlay overlay {
get;
private set;
}

public Image image {
get;
private set;
}

public ScrolledWindow scrolled {
get;
private set;
}

public Label error_message {
get;
private set;
}

public ViewMode view_mode {
get;
construct;
}

public bool controllable {
get;
set;
default = true;
}

public bool has_image {
get {
return image.has_image;
}
}

public int index {
get {
return accessor.get_index();
}
}

public double position {
get {
return (double) accessor.get_index() / (double) _file_list.size;
Expand Down

0 comments on commit 80f8194

Please sign in to comment.