Commit 217ebdc4 authored by Ziirish's avatar Ziirish

fixing drag'n'drop of one image at a time

parent f82b20cd
......@@ -169,6 +169,8 @@ on_dragNdrop_data_received (GtkWidget *wgt, GdkDragContext *context, int x, int
if (cReceivedData[length-1] == '\r')
cReceivedData[--length] = '\0';
fprintf (stdout, "before: %s\n", cReceivedData);
gchar **cReceivedDataList = g_strsplit(cReceivedData,"\n",0);
//g_free (cReceivedData);
......@@ -183,6 +185,8 @@ on_dragNdrop_data_received (GtkWidget *wgt, GdkDragContext *context, int x, int
|| g_str_has_suffix(*cReceivedDataList,"png")
|| g_str_has_suffix(*cReceivedDataList,"SVG")
|| g_str_has_suffix(*cReceivedDataList,"svg");
fprintf (stdout, "POUET: '%s' (%s)\n", *cReceivedDataList, isImage ? "TRUE" : "FALSE");
if(isImage)
{
if(musicData.playing_artist != NULL && musicData.playing_album != NULL)
......@@ -200,7 +204,7 @@ on_dragNdrop_data_received (GtkWidget *wgt, GdkDragContext *context, int x, int
else
{
cid_debug("Le fichier est local");
gchar *cFileSrc = (**cReceivedDataList == '/' ? *cReceivedDataList : g_filename_from_uri (*cReceivedDataList, NULL, NULL));
gchar *cFileSrc = (**cReceivedDataList == '/' ? g_strdup(*cReceivedDataList) : g_filename_from_uri (*cReceivedDataList, NULL, NULL));
gchar *cFileDst = g_strdup_printf ("/tmp/\"%s - %s.jpg\"",musicData.playing_artist,musicData.playing_album);
cid_file_copy (cFileSrc,cFileDst);
g_free (cFileSrc);
......@@ -215,9 +219,13 @@ on_dragNdrop_data_received (GtkWidget *wgt, GdkDragContext *context, int x, int
}
else
{
cid_display_image((**cReceivedDataList == '/' ? *cReceivedDataList : g_filename_from_uri (*cReceivedDataList, NULL, NULL)));
gchar *cTmpImagePath = (**cReceivedDataList == '/' ? g_strdup(*cReceivedDataList) : g_filename_from_uri (*cReceivedDataList, NULL, NULL));
cid_display_image(cTmpImagePath);
cid_animation(cid->config->iAnimationType);
g_free (cTmpImagePath);
}
gtk_main_quit ();
gtk_main ();
}
else
{
......@@ -225,13 +233,14 @@ on_dragNdrop_data_received (GtkWidget *wgt, GdkDragContext *context, int x, int
if (cid->runtime->pMonitorList->p_fAddToQueue!=NULL)
cid->runtime->pMonitorList->p_fAddToQueue(*cReceivedDataList);
}
g_free (*cReceivedDataList);
cReceivedDataList++;
}
//g_print("d&d >>> %s\n",cReceivedData);
//system (g_strdup_printf("nautilus %s &",cReceivedData));
g_strfreev (cReceivedDataList);
//g_free (cReceivedData);
//g_strfreev (cReceivedDataList);
g_free (cReceivedData);
}
......
......@@ -637,6 +637,7 @@ cid_set_render (cairo_t *pContext, gpointer *pData)
}
///\___ On s'amuse avec des petits dessins o/
/*
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_save(cr);
cairo_move_to (cr, 0, 0);
......@@ -645,6 +646,7 @@ cid_set_render (cairo_t *pContext, gpointer *pData)
cairo_paint (cr);
cairo_restore (cr);
*/
}
void
......
......@@ -214,7 +214,7 @@ cid_display_init(CidMainContainer **pCid, int *argc, char ***argv)
int
main ( int argc, char **argv )
{
/*
struct sigaction action;
cid = g_malloc0 (sizeof(*cid));
......@@ -250,6 +250,7 @@ main ( int argc, char **argv )
// La on lance la boucle GTK
cid_display_init (&cid,&argc,&argv);
//cid_display_init (&cid,0,NULL);
// Si on est ici, c'est qu'on a coupé la boucle GTK
// Du coup, on en profite pour faire un peu de ménage
......@@ -257,7 +258,7 @@ main ( int argc, char **argv )
cid_key_file_free(&cid);
cid_free_musicData();
cid_free_main_structure (cid);
*/
/*
GError *error = NULL;
GMatchInfo *match_info;
......@@ -347,6 +348,7 @@ main ( int argc, char **argv )
cid_clear_datatable (&table);
*/
/*
CidDataTable *table = cid_create_datatable (G_TYPE_INT,
1,
2,
......@@ -363,7 +365,7 @@ main ( int argc, char **argv )
fprintf (stdout, "table[%d] = %d\n", ind, cid_datatable_get_id (table, ind)->content->iNumber);
cid_clear_datatable (&table);
*/
fprintf (stdout,"Bye !\n");
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment