upgrading copyright year from 2015 to 2016
[hkl.git] / gui / hkl-gui-macros.h
blobde020482748ed0475f31804e5b0cb216691fb032
1 /* This file is part of the hkl library.
3 * The hkl library is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * The hkl library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright (C) 2003-2016 Synchrotron SOLEIL
17 * L'Orme des Merisiers Saint-Aubin
18 * BP 48 91192 GIF-sur-YVETTE CEDEX
20 * Authors: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
23 #ifndef __HKL_GUI_MACROS_H__
24 #define __HKL_GUI_MACROS_H__
26 #include <gtk/gtk.h>
28 #include "hkl.h"
29 #include "hkl-gui-pseudoaxes.h"
32 /* TODO put in a private common header */
33 #define get_object(builder, type, priv, name) do{ \
34 priv->name = type(gtk_builder_get_object(builder, #name)); \
35 if(priv->name == NULL) \
36 fprintf(stdout, "%s is NULL ???", #name); \
37 }while(0);
39 #define get_model(filename) \
40 (0 == access(filename, R_OK)) ? filename : \
41 ((0 == access("../data/" filename, R_OK)) ? "../data/" filename : \
42 ((0 == access(PKGDATA "/hkl3d/" filename, R_OK)) ? PKGDATA "/hkl3d/" filename : NULL))
44 static void get_ui(GtkBuilder *builder, const char *filename)
46 if (0 == access(filename, R_OK))
47 gtk_builder_add_from_file (builder, filename, NULL);
48 else{
49 char *ui = g_build_filename(PKGDATA, filename, NULL);
50 gtk_builder_add_from_file (builder, ui, NULL);
51 g_free(ui);
55 #endif /* __HKL_GUI_MACROS_H__ */