Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
shotwell
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
100
Issues
100
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
shotwell
Commits
79da4b6e
Commit
79da4b6e
authored
May 16, 2009
by
Jim Nelson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in sorting code.
parent
c02170e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
36 deletions
+50
-36
CollectionPage.vala
CollectionPage.vala
+48
-34
Orientation.vala
Orientation.vala
+2
-2
No files found.
CollectionPage.vala
View file @
79da4b6e
...
...
@@ -17,6 +17,42 @@ public class CollectionPage : CheckerboardPage {
private
static
const
int
IMPROVAL_PRIORITY
=
Priority
.
LOW
;
private
static
const
int
IMPROVAL_DELAY_MS
=
250
;
private
class
CompareName
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
string
namea
=
((
Thumbnail
)
a
).
get_title
();
string
nameb
=
((
Thumbnail
)
b
).
get_title
();
return
strcmp
(
namea
,
nameb
);
}
}
private
class
ReverseCompareName
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
string
namea
=
((
Thumbnail
)
a
).
get_title
();
string
nameb
=
((
Thumbnail
)
b
).
get_title
();
return
strcmp
(
nameb
,
namea
);
}
}
private
class
CompareDate
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
time_t
timea
=
((
Thumbnail
)
a
).
get_photo
().
get_exposure_time
();
time_t
timeb
=
((
Thumbnail
)
b
).
get_photo
().
get_exposure_time
();
return
timea
-
timeb
;
}
}
private
class
ReverseCompareDate
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
time_t
timea
=
((
Thumbnail
)
a
).
get_photo
().
get_exposure_time
();
time_t
timeb
=
((
Thumbnail
)
b
).
get_photo
().
get_exposure_time
();
return
timeb
-
timea
;
}
}
private
Gtk
.
Toolbar
toolbar
=
new
Gtk
.
Toolbar
();
private
Gtk
.
HScale
slider
=
null
;
private
Gtk
.
ToolButton
rotate_button
=
null
;
...
...
@@ -461,48 +497,26 @@ public class CollectionPage : CheckerboardPage {
return
value
;
}
private
class
CompareName
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
return
strcmp
(((
Thumbnail
)
a
).
get_name
(),
((
Thumbnail
)
b
).
get_name
());
}
}
private
class
ReverseCompareName
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
return
strcmp
(((
Thumbnail
)
b
).
get_name
(),
((
Thumbnail
)
a
).
get_name
());
}
}
private
class
CompareDate
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
return
((
Thumbnail
)
a
).
get_photo
().
get_exposure_time
()
-
((
Thumbnail
)
b
).
get_photo
().
get_exposure_time
();
}
}
private
class
ReverseCompareDate
:
Comparator
<
LayoutItem
>
{
public
override
int64
compare
(
LayoutItem
a
,
LayoutItem
b
)
{
return
((
Thumbnail
)
b
).
get_photo
().
get_exposure_time
()
-
((
Thumbnail
)
a
).
get_photo
().
get_exposure_time
();
}
}
private
void
on_sort_changed
()
{
Comparator
<
LayoutItem
>
cmp
=
null
;
switch
(
get_sort_criteria
())
{
case
SORT_BY_NAME
:
{
if
(
get_sort_order
()
==
SORT_ORDER_ASCENDING
)
{
case
SORT_BY_NAME
:
if
(
get_sort_order
()
==
SORT_ORDER_ASCENDING
)
cmp
=
new
CompareName
();
}
else
{
else
cmp
=
new
ReverseCompareName
();
}
}
break
;
break
;
case
SORT_BY_EXPOSURE_DATE
:
{
if
(
get_sort_order
()
==
SORT_ORDER_ASCENDING
)
{
case
SORT_BY_EXPOSURE_DATE
:
if
(
get_sort_order
()
==
SORT_ORDER_ASCENDING
)
cmp
=
new
CompareDate
();
}
else
{
else
cmp
=
new
ReverseCompareDate
();
}
}
break
;
break
;
default
:
error
(
"Unknown sort criteria: %d"
,
get_sort_criteria
());
break
;
}
if
(
cmp
==
null
)
...
...
Orientation.vala
View file @
79da4b6e
public
enum
Orientation
{
M
AX
=
1
,
M
IN
=
1
,
TOP_LEFT
=
1
,
TOP_RIGHT
=
2
,
BOTTOM_RIGHT
=
3
,
...
...
@@ -9,7 +9,7 @@ public enum Orientation {
RIGHT_TOP
=
6
,
RIGHT_BOTTOM
=
7
,
LEFT_BOTTOM
=
8
,
M
IN
=
8
;
M
AX
=
8
;
public
string
to_string
()
{
switch
(
this
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment