aboutsummaryrefslogtreecommitdiffstats
path: root/examples/viewer
diff options
context:
space:
mode:
Diffstat (limited to 'examples/viewer')
-rw-r--r--examples/viewer/CMakeLists.txt31
-rw-r--r--examples/viewer/Makefile18
-rw-r--r--examples/viewer/viewer.cpp4
3 files changed, 33 insertions, 20 deletions
diff --git a/examples/viewer/CMakeLists.txt b/examples/viewer/CMakeLists.txt
new file mode 100644
index 00000000..c8d93163
--- /dev/null
+++ b/examples/viewer/CMakeLists.txt
@@ -0,0 +1,31 @@
+
+IF(VMIME_BUILD_SAMPLES)
+
+ FIND_PACKAGE(PkgConfig REQUIRED)
+ PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0)
+
+ INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS})
+ LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS})
+ ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
+
+ ADD_EXECUTABLE(
+ viewer
+ viewer.cpp
+ )
+
+ TARGET_LINK_LIBRARIES(
+ viewer
+ ${VMIME_LIBRARY_NAME}
+ ${GTK3_LIBRARIES}
+ )
+
+ ADD_DEPENDENCIES(
+ viewer
+ ${VMIME_LIBRARY_NAME}
+ )
+
+ELSE()
+
+ MESSAGE(FATAL_ERROR "Examples are not to be built (set VMIME_BUILD_SAMPLES to YES.")
+
+ENDIF()
diff --git a/examples/viewer/Makefile b/examples/viewer/Makefile
deleted file mode 100644
index f0401c5d..00000000
--- a/examples/viewer/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-
-COMPILER=g++
-CFLAGS=-g -I ../.. `pkg-config --cflags gtk+-2.0`
-LDFLAGS=-I ../.. `pkg-config --libs gtk+-2.0` -lgnutls -lgsasl
-
-
-viewer: viewer.o ../../libvmime-debug.a
- $(COMPILER) $(LDFLAGS) -o viewer viewer.o ../../libvmime-debug.a
-
-viewer.o: viewer.cpp
- $(COMPILER) $(CFLAGS) -c -o viewer.o viewer.cpp
-
-../../libvmime-debug.a:
- @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- @echo "! You must build VMime library before compiling the example !"
- @echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- @false
-
diff --git a/examples/viewer/viewer.cpp b/examples/viewer/viewer.cpp
index c684c140..77303fa6 100644
--- a/examples/viewer/viewer.cpp
+++ b/examples/viewer/viewer.cpp
@@ -52,14 +52,14 @@ vmime::ref <vmime::message> currentMessage = NULL;
-void insertRowInModel(GtkTreeStore* model, vmime::ref <const vmime::component> comp, GtkTreeIter* parent = NULL)
+void insertRowInModel(GtkTreeStore* model, vmime::ref <vmime::component> comp, GtkTreeIter* parent = NULL)
{
GtkTreeIter iter;
gtk_tree_store_append(model, &iter, parent);
gtk_tree_store_set(model, &iter, 0, typeid(*comp).name(), 1, comp.get(), -1);
- const std::vector <vmime::ref <const vmime::component> > children = comp->getChildComponents();
+ const std::vector <vmime::ref <vmime::component> > children = comp->getChildComponents();
for (int i = 0 ; i < children.size() ; ++i)
{