diff --git a/src/notifications.cpp b/src/notifications.cpp index 71760703..166f7337 100644 --- a/src/notifications.cpp +++ b/src/notifications.cpp @@ -929,11 +929,12 @@ LRESULT CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp if (ptr_log) app_hash = ptr_log->hash; - _app_freenotify (notify_idx, true, false); - if (app_hash) _app_freenotify (app_hash, false, false); + else + _app_freenotify (notify_idx, true, false); + _app_notifyrefresh (hwnd, true); } @@ -1171,11 +1172,12 @@ LRESULT CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp SAFE_DELETE_ARRAY (rule); } - _app_freenotify (notify_idx, true, false); - if (app_hash) _app_freenotify (app_hash, false, false); + else + _app_freenotify (notify_idx, true, false); + _app_notifyrefresh (hwnd, true); } @@ -1189,17 +1191,42 @@ LRESULT CALLBACK NotificationProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp if (DialogBoxParam (nullptr, MAKEINTRESOURCE (IDD_EDITOR), app.GetHWND (), &EditorProc, (LPARAM)ptr_rule)) { _r_fastlock_acquireexclusive (&lock_access); + const size_t rule_idx = rules_arr.size (); rules_arr.push_back (ptr_rule); _r_fastlock_releaseexclusive (&lock_access); - const UINT listview_id = _app_gettab_id (app.GetHWND ()); + // set rule information + { + _r_fastlock_acquireshared (&lock_checkbox); - _r_listview_redraw (app.GetHWND (), listview_id); + const UINT listview_rules_id = _app_getlistview_id (ptr_rule->type); + const size_t new_item = _r_listview_getitemcount (hwnd, listview_rules_id); - _app_listviewsort (app.GetHWND (), listview_id); - _app_profile_save (); + _r_listview_additem (app.GetHWND (), listview_rules_id, new_item, 0, ptr_rule->pname, _app_getruleicon (ptr_rule), _app_getrulegroup (ptr_rule), rule_idx); + _app_setruleiteminfo (app.GetHWND (), listview_rules_id, new_item, ptr_rule, true); + + _r_fastlock_releaseshared (&lock_checkbox); + } + + // set app information + { + const PITEM_APP ptr_app = _app_getapplication (app_hash); + + if (ptr_app) + { + const UINT listview_id = _app_getlistview_id (ptr_app->type); + + _r_fastlock_acquireshared (&lock_checkbox); + _app_setappiteminfo (app.GetHWND (), listview_id, _app_getposition (app.GetHWND (), listview_id, app_hash), app_hash, ptr_app); + _r_fastlock_releaseshared (&lock_checkbox); + + if (listview_id == _app_gettab_id (app.GetHWND ())) + _app_listviewsort (app.GetHWND (), listview_id); + } + } _app_refreshstatus (app.GetHWND ()); + _app_profile_save (); } else {