static void
file_info_ready (GObject      *object,
                 GAsyncResult *res,
                 gpointer      user_data)
{
  GFileInfo *info;
  GError *error = NULL;
  GFile *file = G_FILE (object);

  info = g_file_query_info_finish (file, res, &error);

  if (!info)
    {
      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
        g_warning ("Problem looking up file info: %s", error->message);
      g_clear_error (&error);
      return;
    }

  /* Up the ref count so we can re-use the add_single_item code path which
   * reduces the ref count.
   */
  g_object_ref (file);
  add_single_file (BG_PICTURES_SOURCE (user_data), file, info, NULL);
}
static gboolean
add_single_file_from_info (BgPicturesSource     *bg_source,
                           GFile                *file,
                           GFileInfo            *info,
                           GtkTreeRowReference **ret_row_ref)
{
  const gchar *content_type;
  guint64 mtime;

  content_type = g_file_info_get_content_type (info);
  mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
  return add_single_file (bg_source, file, content_type, mtime, ret_row_ref);
}
예제 #3
0
int main()
{

	struct _database_ db;
    char command[20], username[20], password[20], name[20];

	printf("Done check 0\n");
    scanf("%s",&command);
    if(!strcmp(command,"create"))
    {
       printf("Enter Username and Password\n");
       printf("Username: "******"%s", &username);
       printf("Password: "******"%s", &password);
    }
	initialize_database(&db,username,password);
	printf("Done check 1\n");
	create_schema(&db);
	printf("Done check 2\n");
    printf("Enter Project Name: ")
	scanf("%s", name);
    int id=create_new_project(&db,name);
	printf("id = %d SUCCESS\n",id);
	add_single_file(&db,1,"C:\\Users\\Jatinder Dhawan\\Desktop\\git\\abc.png",3);
	printf("=======================\n");
	find_in_database(&db,"C:\\Users\\Jatinder Dhawan\\Desktop\\git\\abc.png","C:\\Users\\Jatinder Dhawan\\Desktop\\git\\abc.png");
	printf("=======================\n");
	get_project_id(&db,"git_pro");

	struct file_list* start=(struct file_list*)malloc(sizeof(struct file_list));
	struct file_list*make=start;
	start->_version =5;
	start->number_of_files=3;
	start->name="sjvndfjv";
	start->path="C:\\Users\\Jatinder Dhawan\\Desktop\\database\\credentials.txt";
	start->next=(struct file_list*)malloc(sizeof(struct file_list));
	start=start->next;
	start->_version =5;
	start->number_of_files=3;
	start->name="sjvndfjv";
	start->path="C:\\Users\\Jatinder Dhawan\\Desktop\\database\\tempo.txt";
	start->next=NULL;
	add_multiple_file(&db,make,1,3);

	update_project_version(&db,"git_pro");
	return 0 ;
}
gboolean
bg_pictures_source_add (BgPicturesSource *bg_source,
			const char       *uri)
{
  GFile *file;
  GFileInfo *info;
  gboolean retval;

  file = g_file_new_for_uri (uri);
  info = g_file_query_info (file, ATTRIBUTES, G_FILE_QUERY_INFO_NONE, NULL, NULL);
  if (info == NULL)
    return FALSE;

  retval = add_single_file (bg_source, file, info, uri);

  return retval;
}
static void
file_info_async_ready (GObject      *source,
                       GAsyncResult *res,
                       gpointer      user_data)
{
  BgPicturesSource *bg_source;
  GList *files, *l;
  GError *err = NULL;
  GFile *parent;

  files = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (source),
                                               res,
                                               &err);
  if (err)
    {
      if (!g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED))
        g_warning ("Could not get pictures file information: %s", err->message);
      g_error_free (err);

      g_list_foreach (files, (GFunc) g_object_unref, NULL);
      g_list_free (files);
      return;
    }

  bg_source = BG_PICTURES_SOURCE (user_data);

  parent = g_file_enumerator_get_container (G_FILE_ENUMERATOR (source));

  files = g_list_sort (files, file_sort_func);

  /* iterate over the available files */
  for (l = files; l; l = g_list_next (l))
    {
      GFileInfo *info = l->data;
      GFile *file;

      file = g_file_get_child (parent, g_file_info_get_name (info));

      add_single_file (bg_source, file, info, NULL);
    }

  g_list_foreach (files, (GFunc) g_object_unref, NULL);
  g_list_free (files);
}
static gboolean
add_single_file_from_media (BgPicturesSource *bg_source,
                            GFile            *file,
                            GrlMedia         *media)
{
  GDateTime *mtime;
  const gchar *content_type;
  gint64 mtime_unix;

  content_type = grl_media_get_mime (media);

  /* only GRL_METADATA_KEY_CREATION_DATE is implemented in the Flickr
   * plugin, GRL_METADATA_KEY_MODIFICATION_DATE is not
   */
  mtime = grl_media_get_creation_date (media);
  if (!mtime)
    mtime = grl_media_get_modification_date (media);
  if (mtime)
    mtime_unix = g_date_time_to_unix (mtime);
  else
    mtime_unix = g_get_real_time () / G_USEC_PER_SEC;

  return add_single_file (bg_source, file, content_type, (guint64) mtime_unix, NULL);
}