This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
FeedbackD-Configuration/src/util.c

46 lines
1.0 KiB
C

#include "util.h"
struct app_data *app_data = NULL;
// Initialize App Data
void init_app_data() {
app_data = malloc(sizeof (struct app_data));
}
// Get App Data
struct app_data *get_app_data() {
return app_data;
}
// Free App Data
void free_app_data() {
if (app_data != NULL) {
free(app_data);
}
}
// Convert Profile List Widget To Profile Name
char *profile_list_to_name(GtkListBox *profile) {
if (profile == app_data->full_list) {
return "full";
} else if (profile == app_data->quiet_list) {
return "quiet";
} else if (profile == app_data->silent_list) {
return "silent";
} else {
return NULL;
}
}
// Convert Name To Profile Obj
JsonArray *name_to_profile(char *name) {
if (g_strcmp0(name, "full") == 0) {
return app_data->full;
} else if (g_strcmp0(name, "quiet") == 0) {
return app_data->quiet;
} else if (g_strcmp0(name, "silent") == 0) {
return app_data->silent;
} else {
return NULL;
}
}