summaryrefslogtreecommitdiff
path: root/src/gtk-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtk-utils.c')
-rw-r--r--src/gtk-utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index 5835eb6..ce4758b 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -26,6 +26,7 @@
#include "gtk-utils.h"
#define LOAD_BUFFER_SIZE 65536
+#define ENGRAMPA_RESOURCE_UI_PATH "/org/mate/Engrampa/ui/"
static void
count_selected (GtkTreeModel *model,
@@ -804,6 +805,24 @@ _gtk_builder_new_from_file (const char *ui_file)
return builder;
}
+GtkBuilder *
+_gtk_builder_new_from_resource (const char *resource_path)
+{
+ GtkBuilder *builder;
+ char *full_path;
+ GError *error = NULL;
+
+ builder = gtk_builder_new ();
+ full_path = g_strconcat (ENGRAMPA_RESOURCE_UI_PATH, resource_path, NULL);
+ if (! gtk_builder_add_from_resource (builder, full_path, &error)) {
+ g_warning ("%s\n", error->message);
+ g_clear_error (&error);
+ }
+ g_free (full_path);
+
+ return builder;
+}
+
GtkWidget *
_gtk_builder_get_widget (GtkBuilder *builder,