39
39
* for photos and videos.
42
G_DEFINE_TYPE (CheeseFileUtil, cheese_fileutil, G_TYPE_OBJECT)
44
#define CHEESE_FILEUTIL_GET_PRIVATE(o) \
45
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_FILEUTIL, CheeseFileUtilPrivate))
47
42
struct _CheeseFileUtilPrivate
241
238
GObjectClass *object_class = G_OBJECT_CLASS (klass);
243
240
object_class->finalize = cheese_fileutil_finalize;
245
g_type_class_add_private (klass, sizeof (CheeseFileUtilPrivate));
249
244
cheese_fileutil_init (CheeseFileUtil *fileutil)
251
CheeseFileUtilPrivate *priv = fileutil->priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
246
CheeseFileUtilPrivate *priv = fileutil->priv = cheese_fileutil_get_instance_private (fileutil);
253
248
GSettings *settings;
258
253
settings = g_settings_new ("org.gnome.Cheese");
260
g_settings_get (settings, "video-path", "s", &priv->video_path);
261
g_settings_get (settings, "photo-path", "s", &priv->photo_path);
255
priv->video_path = g_settings_get_string (settings, "video-path");
256
priv->photo_path = g_settings_get_string (settings, "photo-path");
263
258
/* get the video path from gsettings, xdg or hardcoded */
264
if (!priv->video_path || strcmp (priv->video_path, "") == 0)
259
if (!priv->video_path || (*priv->video_path == '\0'))
261
g_free (priv->video_path);
267
264
priv->video_path = g_build_filename (g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS), "Webcam", NULL);
268
if (strcmp (priv->video_path, "") == 0)
265
if (priv->video_path == '\0')
267
g_free (priv->video_path);
270
269
/* get "~/.gnome2/cheese/media" */
271
270
priv->video_path = cheese_fileutil_get_path_before_224 (fileutil);
275
274
/* get the photo path from gsettings, xdg or hardcoded */
276
if (!priv->photo_path || strcmp (priv->photo_path, "") == 0)
275
if (!priv->photo_path || (*priv->photo_path == '\0'))
277
g_free (priv->photo_path);
279
280
priv->photo_path = g_build_filename (g_get_user_special_dir (G_USER_DIRECTORY_PICTURES), "Webcam", NULL);
280
if (strcmp (priv->photo_path, "") == 0)
281
if (priv->photo_path == '\0')
282
283
/* get "~/.gnome2/cheese/media" */
284
g_free (priv->photo_path);
283
285
priv->photo_path = cheese_fileutil_get_path_before_224 (fileutil);