summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-04-18 22:01:36 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-04-18 22:02:06 +0200
commit89e61194083b1085c9a4088305ae72bf79bece1f (patch)
treef6ca0ab2006fb191dd4b350350d7227ce4b8661b
parent27093f569743eff0722da30bd464a991e2e68ffb (diff)
downloadcv-89e61194083b1085c9a4088305ae72bf79bece1f.tar.gz
cv-89e61194083b1085c9a4088305ae72bf79bece1f.tar.bz2
cv-89e61194083b1085c9a4088305ae72bf79bece1f.zip
gauss_cv: Read path to ui-file from argv[0]
So that gauss_cv doesnt need to be started from its folder.
-rw-r--r--Makefile4
-rw-r--r--gauss_cv.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d80fd4c..8d2c866 100644
--- a/Makefile
+++ b/Makefile
@@ -19,8 +19,8 @@ capture_LIBS=$(shell pkg-config --libs gtk+-3.0 opencv glib-2.0)
unvignette_CFLAGS=$(shell pkg-config --cflags cairo)
unvignette_LIBS=$(shell pkg-config --libs cairo) -lm
-gauss_cv_CFLAGS=$(shell pkg-config --cflags gtk+-3.0 gmodule-2.0 opencv)
-gauss_cv_LIBS=$(shell pkg-config --libs gtk+-3.0 gmodule-2.0 opencv)
+gauss_cv_CFLAGS=$(shell pkg-config --cflags gtk+-3.0 glib-2.0 gmodule-2.0 opencv)
+gauss_cv_LIBS=$(shell pkg-config --libs gtk+-3.0 glib-2.0 gmodule-2.0 opencv)
PROGS = wimmel wimmel_gl roi capture unvignette gauss_cv
OBJS = $(PROGS:=.o) util.o
diff --git a/gauss_cv.c b/gauss_cv.c
index da832ae..2f994b9 100644
--- a/gauss_cv.c
+++ b/gauss_cv.c
@@ -1,5 +1,6 @@
#include <string.h>
#include <gtk/gtk.h>
+#include <glib.h>
#include <cv.h>
#include <highgui.h>
@@ -208,14 +209,20 @@ main(int argc, char *argv[])
struct cvg cvg;
GtkBuilder *builder;
GObject *file_chooser;
+ gchar *path, *file;
memset(&cvg, 0, sizeof cvg);
gtk_init(&argc, &argv);
if (argc >= 2)
open_file(&cvg, argv[argc-1]);
+
builder = gtk_builder_new();
- gtk_builder_add_from_file(builder, "gauss_cv.ui", NULL);
+ path = g_path_get_dirname(argv[0]);
+ file = g_build_filename(path, "gauss_cv.ui", NULL);
+ gtk_builder_add_from_file(builder, file, NULL);
+ g_free(path);
+ g_free(file);
gtk_builder_connect_signals(builder, &cvg);
cvg.drawing_area1 = GTK_WIDGET(gtk_builder_get_object(builder,