1
0
Fork 0
mirror of synced 2024-05-15 18:02:53 +12:00
czkawka/czkawka_gui/src
krzysdz 4c205ce098
Windows taskbar progress support (#264)
* Initial Windows taskbar progress support

* Changes to COM (un)init

It turns out winapi exposes IIDs through a `uuidof()` function of interfaces, so the copied one can be removed.

* Don't return error codes

Now the `TaskbarProgress` functions fail silently.
The `TaskbarProgress` struct now will always be created (even in case of errors in initialisation), but it won't do anything.

* Fix builds for other systems

* Formatted code

* Fix progress shown after the operation finished

A progress update was received after the stop event.
Also `as_ref()` was removed in many places (I don't even know why it was there).

* Remove redundant call to hide

It's already called by the `glib_stop_receiver` receiver.

* Release the ITaskbarList3 and call CoUninitialize at exit

Because objects moved to closures used as fallbacks in GTK have [static lifetimes](https://gtk-rs.org/docs-src/tutorial/closures#closures), the `TaskbarProgress` will never be dropped.
To workaround this problem a `release` function is called when the main window is closed. This function behaves like `drop`, but sets the struct in a valid "empty" state, so that calling `release`/`drop` again won't cause problems.

* Don't set the NORMAL state manually

Because only NOPROGRESS and INDETERMINATE states are used, there is no need to set the NORMAL state when changing the progress value.

Now `set_progress_value` will also change the `TaskbarProgress::current_state` if such situation occurs.

> Unless [SetProgressState](https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate)
> has set a blocking state (TBPF_ERROR or TBPF_PAUSED) for the window, a call to **SetProgressValue** assumes the TBPF_NORMAL
> state even if it is not explicitly set. A call to **SetProgressValue** overrides and clears the TBPF_INDETERMINATE state.

See the [SetProgressValue documentation](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressvalue#how-the-taskbar-button-chooses-the-progress-indicator-for-a-group)
2021-02-20 12:24:36 +01:00
..
connect_about_buttons.rs Add about dialog (#226) 2021-01-24 12:01:02 +01:00
connect_button_delete.rs Improve English for "Ask in future" button (#261) 2021-02-20 09:56:23 +01:00
connect_button_save.rs Add broken files support (#202) 2021-01-12 20:06:12 +01:00
connect_button_search.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00
connect_button_select.rs Add broken files support (#202) 2021-01-12 20:06:12 +01:00
connect_button_stop.rs Change progress dialog to progress window (#229) 2021-01-25 18:23:42 +01:00
connect_button_symlink.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
connect_compute_results.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00
connect_header_buttons.rs Add about dialog (#226) 2021-01-24 12:01:02 +01:00
connect_hide_text_view_errors.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
connect_notebook_tabs.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
connect_popovers.rs Add missing popover info for invalid symlinks (#209) 2021-01-14 20:38:29 +01:00
connect_progress_window.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00
connect_selection_of_directories.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
connect_settings.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
create_tree_view.rs Add broken files support (#202) 2021-01-12 20:06:12 +01:00
double_click_opening.rs Add broken files support (#202) 2021-01-12 20:06:12 +01:00
gui_about.rs Add about dialog (#226) 2021-01-24 12:01:02 +01:00
gui_bottom_buttons.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
gui_data.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00
gui_header.rs Add about dialog (#226) 2021-01-24 12:01:02 +01:00
gui_main_notebook.rs Add support for CRC32 and XXH3 hash (#243) 2021-02-03 19:59:06 +01:00
gui_options.rs Add about dialog (#226) 2021-01-24 12:01:02 +01:00
gui_popovers.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
gui_progress_dialog.rs Change progress dialog to progress window (#229) 2021-01-25 18:23:42 +01:00
gui_upper_notepad.rs Split Gui code into multiple files (#194) 2021-01-10 20:12:08 +01:00
help_functions.rs Add broken files support (#202) 2021-01-12 20:06:12 +01:00
initialize_gui.rs Change progress dialog to progress window (#229) 2021-01-25 18:23:42 +01:00
main.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00
notebook_enums.rs Add broken files support (#202) 2021-01-12 20:06:12 +01:00
saving_loading.rs Move image cache to cache from config dir (#197) 2021-01-11 09:54:23 +01:00
taskbar_progress.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00
taskbar_progress_dummy.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00
taskbar_progress_win.rs Windows taskbar progress support (#264) 2021-02-20 12:24:36 +01:00