Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
ristretto
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Avinash Sonawane
ristretto
Commits
f6208969
Commit
f6208969
authored
Oct 07, 2016
by
Igor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement sorting by file type option
Resolves
https://bugzilla.xfce.org/show_bug.cgi?id=12749
parent
44cf184a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
6 deletions
+56
-6
src/image_list.c
src/image_list.c
+25
-0
src/image_list.h
src/image_list.h
+4
-0
src/main_window.c
src/main_window.c
+25
-6
src/main_window_ui.xml
src/main_window_ui.xml
+1
-0
src/util.h
src/util.h
+1
-0
No files found.
src/image_list.c
View file @
f6208969
...
...
@@ -175,6 +175,8 @@ static RsttoImageListIter * rstto_image_list_iter_new ();
static
gint
cb_rstto_image_list_image_name_compare_func
(
RsttoFile
*
a
,
RsttoFile
*
b
);
static
gint
cb_rstto_image_list_image_type_compare_func
(
RsttoFile
*
a
,
RsttoFile
*
b
);
static
gint
cb_rstto_image_list_exif_date_compare_func
(
RsttoFile
*
a
,
RsttoFile
*
b
);
static
GObjectClass
*
parent_class
=
NULL
;
...
...
@@ -1350,6 +1352,12 @@ rstto_image_list_set_sort_by_name (RsttoImageList *image_list)
rstto_image_list_set_compare_func
(
image_list
,
(
GCompareFunc
)
cb_rstto_image_list_image_name_compare_func
);
}
void
rstto_image_list_set_sort_by_type
(
RsttoImageList
*
image_list
)
{
rstto_image_list_set_compare_func
(
image_list
,
(
GCompareFunc
)
cb_rstto_image_list_image_type_compare_func
);
}
void
rstto_image_list_set_sort_by_date
(
RsttoImageList
*
image_list
)
{
...
...
@@ -1373,6 +1381,23 @@ cb_rstto_image_list_image_name_compare_func (RsttoFile *a, RsttoFile *b)
return
g_strcmp0
(
a_collate_key
,
b_collate_key
);
}
/**
* cb_rstto_image_list_image_type_compare_func:
* @a:
* @b:
*
*
* Return value: (see strcmp)
*/
static
gint
cb_rstto_image_list_image_type_compare_func
(
RsttoFile
*
a
,
RsttoFile
*
b
)
{
const
gchar
*
a_content_type
=
rstto_file_get_content_type
(
a
);
const
gchar
*
b_content_type
=
rstto_file_get_content_type
(
b
);
return
g_strcmp0
(
a_content_type
,
b_content_type
);
}
/**
* cb_rstto_image_list_exif_date_compare_func:
* @a:
...
...
src/image_list.h
View file @
f6208969
...
...
@@ -133,6 +133,10 @@ void
rstto_image_list_set_sort_by_name
(
RsttoImageList
*
image_list
);
void
rstto_image_list_set_sort_by_type
(
RsttoImageList
*
image_list
);
void
rstto_image_list_set_sort_by_date
(
RsttoImageList
*
image_list
);
...
...
src/main_window.c
View file @
f6208969
...
...
@@ -610,20 +610,24 @@ static const GtkToggleActionEntry toggle_action_entries[] =
/** Image sorting options*/
static
const
GtkRadioActionEntry
radio_action_sort_entries
[]
=
{
/* Sort by Filename */
{
"sort-filename"
,
NULL
,
/* Icon-name */
N_
(
"sort by filename"
),
/* Label-text */
NULL
,
/* Keyboard shortcut */
NULL
,
/* Tooltip text */
0
},
/* Sort by Date*/
SORT_TYPE_NAME
},
{
"sort-filetype"
,
NULL
,
/* Icon-name */
N_
(
"sort by filetype"
),
/* Label-text */
NULL
,
/* Keyboard shortcut */
NULL
,
/* Tooltip text */
SORT_TYPE_TYPE
},
{
"sort-date"
,
NULL
,
/* Icon-name */
N_
(
"sort by date"
),
/* Label-text */
NULL
,
/* Keyboard shortcut */
NULL
,
/* Tooltip text */
1
},
SORT_TYPE_DATE
},
};
/** Navigationbar+Thumbnailbar positioning options*/
...
...
@@ -1085,6 +1089,14 @@ rstto_main_window_init (RsttoMainWindow *window)
"/main-menu/edit-menu/sorting-menu/sort-filename"
)),
TRUE
);
break
;
case
SORT_TYPE_TYPE
:
gtk_check_menu_item_set_active
(
GTK_CHECK_MENU_ITEM
(
gtk_ui_manager_get_widget
(
window
->
priv
->
ui_manager
,
"/main-menu/edit-menu/sorting-menu/sort-filetype"
)),
TRUE
);
break
;
case
SORT_TYPE_DATE
:
gtk_check_menu_item_set_active
(
GTK_CHECK_MENU_ITEM
(
...
...
@@ -2066,7 +2078,7 @@ cb_rstto_main_window_sorting_function_changed (GtkRadioAction *action, GtkRadioA
{
switch
(
gtk_radio_action_get_current_value
(
current
))
{
case
0
:
/* Sort by filename */
case
SORT_TYPE_NAME
:
default:
if
(
window
->
priv
->
image_list
!=
NULL
)
{
...
...
@@ -2074,7 +2086,14 @@ cb_rstto_main_window_sorting_function_changed (GtkRadioAction *action, GtkRadioA
rstto_settings_set_uint_property
(
window
->
priv
->
settings_manager
,
"sort-type"
,
SORT_TYPE_NAME
);
}
break
;
case
1
:
/* Sort by date */
case
SORT_TYPE_TYPE
:
if
(
window
->
priv
->
image_list
!=
NULL
)
{
rstto_image_list_set_sort_by_type
(
window
->
priv
->
image_list
);
rstto_settings_set_uint_property
(
window
->
priv
->
settings_manager
,
"sort-type"
,
SORT_TYPE_TYPE
);
}
break
;
case
SORT_TYPE_DATE
:
if
(
window
->
priv
->
image_list
!=
NULL
)
{
rstto_image_list_set_sort_by_date
(
window
->
priv
->
image_list
);
...
...
src/main_window_ui.xml
View file @
f6208969
...
...
@@ -21,6 +21,7 @@
<separator/>
<menu
action=
"sorting-menu"
>
<menuitem
action=
"sort-filename"
/>
<menuitem
action=
"sort-filetype"
/>
<menuitem
action=
"sort-date"
/>
</menu>
<menuitem
action=
"delete"
/>
...
...
src/util.h
View file @
f6208969
...
...
@@ -44,6 +44,7 @@ typedef enum {
typedef
enum
{
SORT_TYPE_NAME
=
0
,
SORT_TYPE_TYPE
,
SORT_TYPE_DATE
,
SORT_TYPE_COUNT
,
}
RsttoSortType
;
...
...
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