Beispiel #1
0
void
cheese_print_handler (char *string)
{
  static FILE *fp = NULL;
  GDir        *dir;
  char        *filename, *path;

  CheeseFileUtil *fileutil = cheese_fileutil_new ();

  if (CheeseOptions.verbose)
    fprintf (stdout, "%s", string);

  if (fp == NULL)
  {
    path = cheese_fileutil_get_log_path (fileutil);

    dir = g_dir_open (path, 0, NULL);
    if (!dir)
    {
      return;
    }

    /* remove the old logfile if it exists */
    filename = g_build_filename (path, "log", NULL);
    if (g_file_test (filename, G_FILE_TEST_EXISTS))
    {
      GFile *old = g_file_new_for_path (filename);
      g_file_delete (old, NULL, NULL);
      g_object_unref (old);
    }
    g_free (filename);

    filename = g_build_filename (path, "log.txt", NULL);
    fp       = fopen (filename, "w");
    fputs ("Cheese " VERSION "\n\n", fp);

    g_object_unref (fileutil);
    g_free (filename);
  }

  if (fp)
    fputs (string, fp);
}
Beispiel #2
0
static void
cheese_thumb_view_init (CheeseThumbView *thumb_view)
{
  CheeseThumbViewPrivate *priv = cheese_thumb_view_get_instance_private (thumb_view);

  priv->video_file_monitor = NULL;
  priv->photo_file_monitor = NULL;

  cheese_thumbnail_init ();

  priv->store   = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
  priv->n_items = 0;
  priv->idle_id = 0;
  priv->thumbnails = g_queue_new ();
  
  priv->fileutil = cheese_fileutil_new ();
  priv->factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);


  g_signal_connect (G_OBJECT (priv->store),
                    "row-inserted",
                    G_CALLBACK (cheese_thumb_view_row_inserted_cb),
                    thumb_view);
  g_signal_connect (G_OBJECT (priv->store),
                    "row-deleted",
                    G_CALLBACK (cheese_thumb_view_row_deleted_cb),
                    thumb_view);

  g_signal_connect (G_OBJECT (thumb_view), "drag-data-get",
                    G_CALLBACK (cheese_thumb_view_on_drag_data_get_cb), NULL);
                    
  /* We do the rest of the initialization in our constructed() implementation,
   * because GtkIconView may not be ready for us to do more now.
   * See https://bugzilla.gnome.org/show_bug.cgi?id=643286#c6
   */
}