Skip to content
This repository has been archived by the owner on Feb 2, 2025. It is now read-only.

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rirusha committed Nov 29, 2024
1 parent a0b5dbc commit 6702c1c
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions lib/folder.vala
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ namespace Foldy.Folder {
public static void add_folder_categories (string folder_id, string[] folder_categories) {
var builder = new StrvBuilder ();

builder.addv (get_folder_categories (folder_id));
builder.addv (folder_categories);
var current_categories = get_folder_categories (folder_id);

builder.addv (current_categories);
foreach (string category in folder_categories) {
if (!(category in current_categories)) {
builder.add (category);
}
}

set_folder_categories (folder_id, builder.end ());
}
Expand Down Expand Up @@ -94,8 +100,14 @@ namespace Foldy.Folder {
public static void add_folder_apps (string folder_id, string[] folder_apps) {
var builder = new StrvBuilder ();

builder.addv (get_folder_apps (folder_id));
builder.addv (folder_apps);
var current_apps = get_folder_apps (folder_id);

builder.addv (current_apps);
foreach (string app in folder_apps) {
if (!(app in current_apps)) {
builder.add (app);
}
}

set_folder_apps (folder_id, builder.end ());
}
Expand Down Expand Up @@ -126,16 +138,22 @@ namespace Foldy.Folder {
public static void add_folder_excluded_apps (string folder_id, string[] folder_excluded_apps) {
var builder = new StrvBuilder ();

builder.addv (get_folder_apps (folder_id));
builder.addv (folder_excluded_apps);
var current_excluded_apps = get_folder_excluded_apps (folder_id);

builder.addv (current_excluded_apps);
foreach (string excluded_app in folder_excluded_apps) {
if (!(excluded_app in current_excluded_apps)) {
builder.add (excluded_app);
}
}

set_folder_apps (folder_id, builder.end ());
}

public static void remove_folder_excluded_apps (string folder_id, string[] folder_excluded_apps) {
var builder = new StrvBuilder ();

foreach (string excluded_app in get_folder_apps (folder_id)) {
foreach (string excluded_app in get_folder_excluded_apps (folder_id)) {
if (!(excluded_app in folder_excluded_apps)) {
builder.add (excluded_app);
}
Expand Down

0 comments on commit 6702c1c

Please sign in to comment.