Ignore:
Timestamp:
Mar 6, 2007, 8:06:16 PM (18 years ago)
Author:
cinc
Message:

Synching before applying WC2007 patches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/desktop/class_c/wpfolderwindow.c

    r237 r240  
    1616* The Initial Developer of the Original Code is
    1717* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
    18 * Portions created by the Initial Developer are Copyright (C) 2005-2006
     18* Portions created by the Initial Developer are Copyright (C) 2005-2007
    1919* the Initial Developer. All Rights Reserved.
    2020*
     
    166166}
    167167
    168 static gboolean fldrWindowHandleDragDrop(GtkWidget * widget, GdkDragContext* dragContext, gint x, gint y,
     168/* FIXME: move to an include file */
     169enum{
     170  WPOBJECT_TARGET_OBJECT,
     171  WPOBJECT_TARGET_CPATH,
     172  WPOBJECT_TARGET_PATH,
     173  WPOBJECT_TARGET_STRING
     174};
     175
     176static GtkTargetEntry targetEntries[]=
     177{
     178  {"WPObject", 0, WPOBJECT_TARGET_OBJECT},
     179  {"WPObject-C-path", 0, WPOBJECT_TARGET_CPATH},
     180  {"WPObject-path", 0, WPOBJECT_TARGET_PATH},
     181  {"STRING", 0, WPOBJECT_TARGET_STRING},
     182};
     183
     184
     185/*
     186  This callback handles the drop of an item on an object.
     187 */
     188static gboolean fldrWindowHandleDragDrop(GtkWidget * wgtThis, GdkDragContext* dragContext, gint x, gint y,
    169189                         guint t, gpointer ptrUserData)
    170190{
    171   DosBeep(2500, 10);
    172191  DosBeep(500, 10);
    173   DosBeep(2500, 10);
    174192  g_message("%s", __FUNCTION__);
     193  g_message("  action: %d", dragContext->action );
     194
     195  if(dragContext->targets)
     196    {
     197      GdkAtom targetType;
     198      targetType=GDK_POINTER_TO_ATOM(g_list_nth_data(dragContext->targets, WPOBJECT_TARGET_OBJECT));
     199      g_message("  calling gtk_drag_get_data()..." );
     200      gtk_drag_get_data(wgtThis, dragContext, targetType, t);
     201    }
    175202  return FALSE;
    176203}
     
    199226
    200227/*
    201   Callback which loads a pixmap into the drag widget as soon as it#s realized.
     228  Callback which loads a pixmap into the drag widget as soon as it's realized.
    202229 */
    203230static void fldrWidgetRealize(GtkWidget * wgtDrag, gpointer ptrUserData)
     
    208235  return;
    209236}
    210 
     237/**
     238   Callback for the drag-begin signal.
     239 */
    211240static void fldrWindowHandleDragBegin(GtkWidget * widget, GdkDragContext* dragContext,
    212241                    gpointer ptrUserData)
     
    272301  if((wgtSource=gtk_drag_get_source_widget(dragContext))==NULLHANDLE)
    273302    return FALSE;
     303
     304  /* This does not work for some reason */
     305  gtk_drag_highlight(wgtThis);
     306  gtk_widget_queue_draw(wgtThis);
     307
     308  if(dragContext)
     309    {
     310      g_message("  Actions: %x %x" , dragContext->actions, dragContext->suggested_action);
     311    }
    274312
    275313#if 0
     
    348386}
    349387
     388
     389static void fldrWindowHandleDragDataReceived(GtkWidget * widget, GdkDragContext* dragContext, int x, int y, GtkSelectionData *selData,
     390                          guint info, guint uiTime, gpointer ptrUserData)
     391{
     392  DosBeep(5000, 100);
     393  g_message("%s", __FUNCTION__);
     394  //  gdk_drag_status(dragContext, GDK_ACTION_COPY, uiTime);
     395  return;
     396}
     397
     398
     399
     400/*
     401
     402  \param uiInfo the entry in the GtkTargetList used in gtk_drag_source_set().
     403
     404 */
     405static void fldrWindowHandleDragDataGet(GtkWidget * widget, GdkDragContext* dragContext, GtkSelectionData *selData,
     406                    guint uiTargetInfo, guint t, gpointer ptrUserData)
     407{
     408  DosBeep(100, 100);
     409  g_message("%s", __FUNCTION__);
     410  g_message("  info: %d, userData: %x", uiTargetInfo, ptrUserData);
     411
     412  switch(uiTargetInfo)
     413    {
     414    case WPOBJECT_TARGET_OBJECT:
     415      {
     416        gpointer wpObject=1234;
     417
     418        g_message("WPOBJECT_TARGET_OBJECT requested");
     419        gtk_selection_data_set(selData, selData->target, 8, (guchar*) &wpObject, sizeof(wpObject));
     420        break;
     421      }
     422    default:
     423
     424      break;
     425    };
     426  // 
     427  return;
     428}
    350429
    351430NOM_Scope void NOMLINK impl_WPFolderWindow_nomInit(WPFolderWindow* nomSelf, CORBA_Environment *ev)
     
    439518
    440519  /* Handle folder DnD */
    441   g_signal_connect(GTK_WIDGET(icon_view),"drag-begin",
     520  g_signal_connect(GTK_WIDGET(icon_view), "drag-begin",
    442521                   G_CALLBACK(fldrWindowHandleDragBegin), nomSelf);
    443   g_signal_connect(GTK_WIDGET(icon_view),"drag-motion",
     522  g_signal_connect(GTK_WIDGET(icon_view), "drag-motion",
    444523                   G_CALLBACK(fldrWindowHandleDragMotion), nomSelf);
    445   g_signal_connect(GTK_WIDGET(icon_view),"drag-drop",
     524  g_signal_connect(GTK_WIDGET(icon_view), "drag-drop",
    446525                   G_CALLBACK(fldrWindowHandleDragDrop), nomSelf);
    447 
     526  g_signal_connect(GTK_WIDGET(icon_view), "drag_data_received",
     527                   G_CALLBACK(fldrWindowHandleDragDataReceived), NULL);
     528  g_signal_connect(GTK_WIDGET(icon_view), "drag_data_get",
     529                   G_CALLBACK(fldrWindowHandleDragDataGet), NULL);
     530
     531  /* Prepare drag and drop */
     532  gtk_drag_source_set(GTK_WIDGET(icon_view), GDK_BUTTON3_MASK, targetEntries,
     533                      G_N_ELEMENTS(targetEntries) ,
     534                      GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE);
     535  gtk_drag_dest_set(GTK_WIDGET(icon_view), GTK_DEST_DEFAULT_ALL, targetEntries, 1 ,
     536                      GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE);
    448537
    449538#if 0
Note: See TracChangeset for help on using the changeset viewer.