* src/folderview.[ch]
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 17 Jul 2003 08:39:41 +0000 (08:39 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Thu, 17 Jul 2003 08:39:41 +0000 (08:39 +0000)
* src/summaryview.[ch]
* src/mimeview.[ch]
plug DnD leaks

ChangeLog.claws
configure.ac
src/folderview.c
src/folderview.h
src/mimeview.c
src/mimeview.h
src/summaryview.c
src/summaryview.h

index c2c0130..3db0ce8 100644 (file)
@@ -1,3 +1,10 @@
+2003-07-17 [alfons]    0.9.3claws15
+
+       * src/folderview.[ch]
+       * src/summaryview.[ch]
+       * src/mimeview.[ch]
+               plug DnD leaks 
+
 2003-07-17 [paul]      0.9.3claws14
 
        * src/inc.c
index 1a16fba..758768b 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws14
+EXTRA_VERSION=claws15
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index d153922..b4973d2 100644 (file)
@@ -352,6 +352,10 @@ static GtkItemFactoryEntry folderview_news_popup_entries[] =
        {N_("/S_coring..."),            NULL, folderview_scoring_cb, 0, NULL}
 };
 
+GtkTargetEntry folderview_drag_types[] =
+{
+       {"text/plain", GTK_TARGET_SAME_APP, TARGET_DUMMY}
+};
 
 FolderView *folderview_create(void)
 {
@@ -486,10 +490,9 @@ FolderView *folderview_create(void)
                           folderview);
 
         /* drop callback */
-       gtk_drag_dest_set(ctree, GTK_DEST_DEFAULT_ALL &
-                         ~GTK_DEST_DEFAULT_HIGHLIGHT,
+       gtk_drag_dest_set(ctree, GTK_DEST_DEFAULT_ALL & ~GTK_DEST_DEFAULT_HIGHLIGHT,
                          summary_drag_types, 1,
-                         GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_DEFAULT);
+                         GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_DEFAULT);
        gtk_signal_connect(GTK_OBJECT(ctree), "drag_motion",
                           GTK_SIGNAL_FUNC(folderview_drag_motion_cb),
                           folderview);
@@ -518,6 +521,7 @@ FolderView *folderview_create(void)
 
        gtk_widget_show_all(scrolledwin);
 
+       folderview->target_list = gtk_target_list_new(folderview_drag_types, 1);
        folderview_list = g_list_append(folderview_list, folderview);
 
        return folderview;
@@ -2799,26 +2803,17 @@ void folderview_reflect_prefs_pixmap_theme(FolderView *folderview)
        folderview_set_all();
 }
 
-GtkTargetEntry folderview_drag_types[1] =
-{
-       {"text/plain", GTK_TARGET_SAME_APP, TARGET_DUMMY}
-};
-
-
 static void folderview_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
                                  FolderView       *folderview)
 {
-       GtkTargetList *list;
        GdkDragContext *context;
 
        g_return_if_fail(folderview != NULL);
        if (folderview->selected == NULL) return;
 
-       list = gtk_target_list_new(folderview_drag_types, 1);
-
        folderview->nodes_to_recollapse = NULL; /* in case the last drag has been cancelled */
        
-       context = gtk_drag_begin(widget, list,
+       context = gtk_drag_begin(widget, folderview->target_list,
                                 GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_DEFAULT, button, event);
        gtk_drag_set_icon_default(context);
 }
index bfec50a..530e113 100644 (file)
@@ -61,6 +61,7 @@ struct _FolderView
        
        /* for drag and drop */
        GSList *nodes_to_recollapse;
+       GtkTargetList *target_list; /* DnD */
 };
 
 FolderView *folderview_create          (void);
index 95cb33f..eee0f61 100644 (file)
@@ -228,6 +228,8 @@ MimeView *mimeview_create(MainWindow *mainwin)
        mimeview->popupfactory  = popupfactory;
        mimeview->type          = -1;
 
+       mimeview->target_list   = gtk_target_list_new(mimeview_mime_types, 1); 
+       
        mimeviews = g_slist_prepend(mimeviews, mimeview);
 
        return mimeview;
@@ -362,6 +364,7 @@ void mimeview_destroy(MimeView *mimeview)
                viewer->destroy_viewer(viewer);
        }
        g_slist_free(mimeview->viewers);
+       gtk_target_list_unref(mimeview->target_list);
 
        procmime_mimeinfo_free_all(mimeview->mimeinfo);
        g_free(mimeview->file);
@@ -682,7 +685,6 @@ static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column,
 static void mimeview_start_drag(GtkWidget *widget, gint button,
                                GdkEvent *event, MimeView *mimeview)
 {
-       GtkTargetList *list;
        GdkDragContext *context;
        MimeInfo *partinfo;
 
@@ -691,8 +693,7 @@ static void mimeview_start_drag(GtkWidget *widget, gint button,
        partinfo = mimeview_get_selected_part(mimeview);
        if (partinfo->filename == NULL && partinfo->name == NULL) return;
 
-       list = gtk_target_list_new(mimeview_mime_types, 1);
-       context = gtk_drag_begin(widget, list,
+       context = gtk_drag_begin(widget, mimeview->target_list,
                                 GDK_ACTION_COPY, button, event);
        gtk_drag_set_icon_default(context);
 }
index 6420950..997c5c7 100644 (file)
@@ -70,6 +70,8 @@ struct _MimeView
        gchar *file;
 
        GSList *viewers;
+
+       GtkTargetList *target_list; /* DnD */
 };
 
 struct _MimeViewerFactory
index 8263731..6c3558c 100644 (file)
@@ -709,6 +709,8 @@ SummaryView *summary_create(void)
        summaryview->msginfo_update_callback_id =
                hooks_register_hook(MSGINFO_UPDATE_HOOKLIST, summary_update_msg, (gpointer) summaryview);
 
+       summaryview->target_list = gtk_target_list_new(summary_drag_types, 1);
+
        /* CLAWS: need this to get the SummaryView * from
         * the CList */
        gtk_object_set_data(GTK_OBJECT(ctree), "summaryview", (gpointer)summaryview); 
@@ -4836,7 +4838,6 @@ static void summary_locked_clicked(GtkWidget *button,
 static void summary_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
                               SummaryView *summaryview)
 {
-       GtkTargetList *list;
        GdkDragContext *context;
 
        g_return_if_fail(summaryview != NULL);
@@ -4844,9 +4845,7 @@ static void summary_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
        g_return_if_fail(summaryview->folder_item->folder != NULL);
        if (summaryview->selected == NULL) return;
 
-       list = gtk_target_list_new(summary_drag_types, 1);
-
-       context = gtk_drag_begin(widget, list,
+       context = gtk_drag_begin(widget, summaryview->target_list,
                                 GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_DEFAULT, button, event);
        gtk_drag_set_icon_default(context);
 }
index d0b35a7..d3d2d5b 100644 (file)
@@ -165,6 +165,8 @@ private:
        /* list for moving/deleting messages */
        GSList *mlist;
        int msginfo_update_callback_id;
+
+       GtkTargetList *target_list; /* DnD */
 };
 
 SummaryView    *summary_create(void);