Fixed compilation with Gtk+ 3.0
This commit is contained in:
parent
cf7be6a81f
commit
3c1abbd4a9
26
src/common.c
26
src/common.c
|
@ -58,9 +58,9 @@ static int _common_drag_data_received(GdkDragContext * context,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
size_t i;
|
size_t i;
|
||||||
GtkSelectionData * sd;
|
|
||||||
GList * selection = NULL;
|
GList * selection = NULL;
|
||||||
char * p;
|
char * p;
|
||||||
|
GdkDragAction action;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
GList * s;
|
GList * s;
|
||||||
#endif
|
#endif
|
||||||
|
@ -74,30 +74,32 @@ static int _common_drag_data_received(GdkDragContext * context,
|
||||||
return 0;
|
return 0;
|
||||||
len = seldata->length;
|
len = seldata->length;
|
||||||
#endif
|
#endif
|
||||||
for(i = 0; i < len; + 1)
|
for(i = 0; i < len; i += strlen(p) + 1)
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION(2, 14, 0)
|
#if GTK_CHECK_VERSION(2, 14, 0)
|
||||||
sd = gtk_selection_data_get_data(seldata);
|
p = (char *)gtk_selection_data_get_data(seldata);
|
||||||
sd = &sd[i];
|
p = &p[i];
|
||||||
#else
|
#else
|
||||||
sd = &seldata->data[i];
|
p = &seldata->data[i];
|
||||||
#endif
|
#endif
|
||||||
selection = g_list_append(selection, sd);
|
selection = g_list_append(selection, p);
|
||||||
p = sd;
|
|
||||||
i += strlen(p);
|
|
||||||
}
|
}
|
||||||
|
#if GTK_CHECK_VERSION(2, 22, 0)
|
||||||
|
action = gdk_drag_context_get_suggested_action(context);
|
||||||
|
#else
|
||||||
|
action = context->suggested_action;
|
||||||
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "%s%s%s%s%s", "DEBUG: ",
|
fprintf(stderr, "%s%s%s%s%s", "DEBUG: ", action == GDK_ACTION_COPY
|
||||||
context->suggested_action == GDK_ACTION_COPY
|
|
||||||
? _("copying") : _("moving"), _(" to \""), dest,
|
? _("copying") : _("moving"), _(" to \""), dest,
|
||||||
"\":\n");
|
"\":\n");
|
||||||
for(s = selection; s != NULL; s = s->next)
|
for(s = selection; s != NULL; s = s->next)
|
||||||
fprintf(stderr, "DEBUG: \"%s\"\n", (char*)s->data);
|
fprintf(stderr, "DEBUG: \"%s\"\n", (char*)s->data);
|
||||||
#else
|
#else
|
||||||
selection = g_list_append(selection, dest);
|
selection = g_list_append(selection, dest);
|
||||||
if(context->suggested_action == GDK_ACTION_COPY)
|
if(action == GDK_ACTION_COPY)
|
||||||
ret = _common_exec("copy", "-iR", selection);
|
ret = _common_exec("copy", "-iR", selection);
|
||||||
else if(context->suggested_action == GDK_ACTION_MOVE)
|
else if(action == GDK_ACTION_MOVE)
|
||||||
ret = _common_exec("move", "-i", selection);
|
ret = _common_exec("move", "-i", selection);
|
||||||
#endif
|
#endif
|
||||||
g_list_free(selection);
|
g_list_free(selection);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user