From fe24a6b4662f3a8b56a381e6aa1a70f018d5a901 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 2 Jul 2024 10:56:15 +0600 Subject: [PATCH] Adde new function for loading files from resources --- source/libublsettings-gtk3.c | 10 ++++++++++ source/libublsettings-gtk3.h | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index d05e753..c1ba2bf 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -1357,4 +1357,14 @@ void yon_calendar_popover_open(GtkEntry *TargetEntry,GtkWidget *PopupTarget){ g_signal_connect(G_OBJECT(popover),"closed",G_CALLBACK(yon_on_popover_closed),NULL); } + +config_str yon_resource_open_file(const char *path, int *size){ + config_str parsed = NULL; + char *modules; + gsize sz; + GFile *file = g_file_new_for_uri(path); + g_file_load_contents(file,NULL,&modules,&sz,NULL,NULL); + parsed = yon_char_parse(modules,size,"\n"); + return parsed; +} #endif \ No newline at end of file diff --git a/source/libublsettings-gtk3.h b/source/libublsettings-gtk3.h index 7b85550..7dbedbb 100644 --- a/source/libublsettings-gtk3.h +++ b/source/libublsettings-gtk3.h @@ -5,6 +5,7 @@ #include #include +#define _(String) gettext(String) #ifdef __GTK_H__ #ifdef VTE_INCLUDE @@ -495,4 +496,6 @@ void yon_calendar_set_date_orientation(int orientation); void yon_calendar_popover_open(GtkEntry *TargetEntry,GtkWidget *PopupTarget); -int yon_calendar_get_last_date(); \ No newline at end of file +int yon_calendar_get_last_date(); + +config_str yon_resource_open_file(const char *path, int *size); \ No newline at end of file