~ubuntu-branches/debian/jessie/cheese/jessie

« back to all changes in this revision

Viewing changes to libcheese/cheese-fileutil.c

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2014-04-02 21:39:33 UTC
  • mfrom: (1.5.1) (15.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20140402213933-r0w3gna0pv7q7085
Tags: 3.12.0-1
* New upstream release.
* Revert changes done in 3.10.1-3
  - i.e. lower gnome-desktop build-dependency again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 * for photos and videos.
40
40
 */
41
41
 
42
 
G_DEFINE_TYPE (CheeseFileUtil, cheese_fileutil, G_TYPE_OBJECT)
43
 
 
44
 
#define CHEESE_FILEUTIL_GET_PRIVATE(o) \
45
 
  (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHEESE_TYPE_FILEUTIL, CheeseFileUtilPrivate))
46
 
 
47
42
struct _CheeseFileUtilPrivate
48
43
{
49
44
  gchar *video_path;
52
47
  gchar *burst_raw_name;
53
48
};
54
49
 
 
50
G_DEFINE_TYPE_WITH_PRIVATE (CheeseFileUtil, cheese_fileutil, G_TYPE_OBJECT)
 
51
 
55
52
static gchar *
56
53
cheese_fileutil_get_path_before_224 (CheeseFileUtil *fileutil);
57
54
 
241
238
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
242
239
 
243
240
  object_class->finalize = cheese_fileutil_finalize;
244
 
 
245
 
  g_type_class_add_private (klass, sizeof (CheeseFileUtilPrivate));
246
241
}
247
242
 
248
243
static void
249
244
cheese_fileutil_init (CheeseFileUtil *fileutil)
250
245
{
251
 
  CheeseFileUtilPrivate *priv = fileutil->priv = CHEESE_FILEUTIL_GET_PRIVATE (fileutil);
 
246
  CheeseFileUtilPrivate *priv = fileutil->priv = cheese_fileutil_get_instance_private (fileutil);
252
247
 
253
248
  GSettings *settings;
254
249
 
257
252
 
258
253
  settings = g_settings_new ("org.gnome.Cheese");
259
254
 
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");
262
257
 
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'))
265
260
  {
 
261
    g_free (priv->video_path);
 
262
 
266
263
    /* get xdg */
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')
269
266
    {
 
267
      g_free (priv->video_path);
 
268
 
270
269
      /* get "~/.gnome2/cheese/media" */
271
270
      priv->video_path = cheese_fileutil_get_path_before_224 (fileutil);
272
271
    }
273
272
  }
274
273
 
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
276
  {
 
277
    g_free (priv->photo_path);
 
278
 
278
279
    /* get xdg */
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')
281
282
    {
282
283
      /* get "~/.gnome2/cheese/media" */
 
284
      g_free (priv->photo_path);
283
285
      priv->photo_path = cheese_fileutil_get_path_before_224 (fileutil);
284
286
    }
285
287
  }