summaryrefslogtreecommitdiff
path: root/src/util/system.c
blob: 958256c0a53368320ca1425d4c2eac42e37773e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* system.c generated by valac 0.40.4, the Vala compiler
 * generated from system.vala, do not modify */

/* Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU LGPL (version 2.1 or later).
 * See the COPYING file in this distribution.
 */
/* Return the directory in which Shotwell is installed, or null if uninstalled.*/


#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))



GFile* get_sys_install_dir (GFile* exec_dir);
#define RESOURCES_PREFIX _PREFIX
gchar* get_nautilus_install_location (void);
void sys_show_uri (GdkScreen* screen,
                   const gchar* uri,
                   GError** error);
void show_file_in_nautilus (const gchar* filename,
                            GError** error);


GFile*
get_sys_install_dir (GFile* exec_dir)
{
	GFile* result = NULL;
	GFile* child = NULL;
	GFile* _tmp0_;
	GFile* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
#line 8 "/home/jens/Source/shotwell/src/util/system.vala"
	g_return_val_if_fail (G_IS_FILE (exec_dir), NULL);
#line 10 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp0_ = g_file_get_child (exec_dir, "ui");
#line 10 "/home/jens/Source/shotwell/src/util/system.vala"
	child = _tmp0_;
#line 12 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp1_ = child;
#line 12 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp2_ = g_file_get_path (_tmp1_);
#line 12 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp3_ = _tmp2_;
#line 12 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp4_ = !g_file_test (_tmp3_, G_FILE_TEST_IS_DIR | G_FILE_TEST_EXISTS);
#line 12 "/home/jens/Source/shotwell/src/util/system.vala"
	_g_free0 (_tmp3_);
#line 12 "/home/jens/Source/shotwell/src/util/system.vala"
	if (_tmp4_) {
#line 65 "system.c"
		gchar* _tmp5_;
		gchar* _tmp6_;
		gboolean _tmp7_;
		GFile* _tmp8_;
#line 14 "/home/jens/Source/shotwell/src/util/system.vala"
		_tmp5_ = g_file_get_basename (exec_dir);
#line 14 "/home/jens/Source/shotwell/src/util/system.vala"
		_tmp6_ = _tmp5_;
#line 14 "/home/jens/Source/shotwell/src/util/system.vala"
		_tmp7_ = g_strcmp0 (_tmp6_, "src") == 0;
#line 14 "/home/jens/Source/shotwell/src/util/system.vala"
		_g_free0 (_tmp6_);
#line 14 "/home/jens/Source/shotwell/src/util/system.vala"
		if (_tmp7_) {
#line 15 "/home/jens/Source/shotwell/src/util/system.vala"
			result = NULL;
#line 15 "/home/jens/Source/shotwell/src/util/system.vala"
			_g_object_unref0 (child);
#line 15 "/home/jens/Source/shotwell/src/util/system.vala"
			return result;
#line 86 "system.c"
		}
#line 18 "/home/jens/Source/shotwell/src/util/system.vala"
		_tmp8_ = g_file_new_for_path (RESOURCES_PREFIX);
#line 18 "/home/jens/Source/shotwell/src/util/system.vala"
		result = _tmp8_;
#line 18 "/home/jens/Source/shotwell/src/util/system.vala"
		_g_object_unref0 (child);
#line 18 "/home/jens/Source/shotwell/src/util/system.vala"
		return result;
#line 96 "system.c"
	}
#line 21 "/home/jens/Source/shotwell/src/util/system.vala"
	result = NULL;
#line 21 "/home/jens/Source/shotwell/src/util/system.vala"
	_g_object_unref0 (child);
#line 21 "/home/jens/Source/shotwell/src/util/system.vala"
	return result;
#line 104 "system.c"
}


gchar*
get_nautilus_install_location (void)
{
	gchar* result = NULL;
	gchar* _tmp0_;
#line 25 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp0_ = g_find_program_in_path ("nautilus");
#line 25 "/home/jens/Source/shotwell/src/util/system.vala"
	result = _tmp0_;
#line 25 "/home/jens/Source/shotwell/src/util/system.vala"
	return result;
#line 119 "system.c"
}


void
sys_show_uri (GdkScreen* screen,
              const gchar* uri,
              GError** error)
{
	GError * _inner_error_ = NULL;
#line 28 "/home/jens/Source/shotwell/src/util/system.vala"
	g_return_if_fail (GDK_IS_SCREEN (screen));
#line 28 "/home/jens/Source/shotwell/src/util/system.vala"
	g_return_if_fail (uri != NULL);
#line 29 "/home/jens/Source/shotwell/src/util/system.vala"
	gtk_show_uri (screen, uri, (guint32) GDK_CURRENT_TIME, &_inner_error_);
#line 29 "/home/jens/Source/shotwell/src/util/system.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 29 "/home/jens/Source/shotwell/src/util/system.vala"
		g_propagate_error (error, _inner_error_);
#line 29 "/home/jens/Source/shotwell/src/util/system.vala"
		return;
#line 141 "system.c"
	}
}


void
show_file_in_nautilus (const gchar* filename,
                       GError** error)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError * _inner_error_ = NULL;
#line 32 "/home/jens/Source/shotwell/src/util/system.vala"
	g_return_if_fail (filename != NULL);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp0_ = get_nautilus_install_location ();
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp1_ = _tmp0_;
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp2_ = g_strconcat (_tmp1_, " ", NULL);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp3_ = _tmp2_;
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp4_ = g_strconcat (_tmp3_, filename, NULL);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_tmp5_ = _tmp4_;
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	g_spawn_command_line_async (_tmp5_, &_inner_error_);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_g_free0 (_tmp5_);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_g_free0 (_tmp3_);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	_g_free0 (_tmp1_);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
		g_propagate_error (error, _inner_error_);
#line 33 "/home/jens/Source/shotwell/src/util/system.vala"
		return;
#line 185 "system.c"
	}
}