2
* externdiff.h - Plugin to geany light IDE to work with vc
4
* Copyright 2008 Yura Siamashka <yurand2@gmail.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
#include "plugindata.h"
27
#include "filetypes.h"
32
#include "geanyfunctions.h"
37
extern GeanyFunctions *geany_functions;
42
EXTERNAL_DIFF_KOMPARE,
44
EXTERNAL_DIFF_DIFFUSE,
49
static gchar *viewers[EXTERNAL_DIFF_COUNT] = { "meld", "kompare", "kdiff3", "diffuse", "tkdiff" };
51
static gchar *extern_diff_viewer = NULL;
53
get_external_diff_viewer()
57
if (extern_diff_viewer)
58
return extern_diff_viewer;
60
for (i = 0; i < EXTERNAL_DIFF_COUNT; i++)
62
if (g_find_program_in_path(viewers[i]))
64
extern_diff_viewer = viewers[i];
65
return extern_diff_viewer;
72
vc_external_diff(const gchar * src, const gchar * dest)
74
gchar *argv[4] = { NULL, NULL, NULL, NULL };
76
const gchar *diff = get_external_diff_viewer();
80
argv[0] = (gchar *) diff;
81
argv[1] = (gchar *) src;
82
argv[2] = (gchar *) dest;
84
utils_spawn_sync(NULL, argv, NULL,
85
G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL |
86
G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL, NULL, NULL);