0.8.11claws18
authorChristoph Hohmann <reboot@gmx.ch>
Sun, 16 Mar 2003 17:11:03 +0000 (17:11 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Sun, 16 Mar 2003 17:11:03 +0000 (17:11 +0000)
* src/mimeview.c
* src/plugins/dillo_viewer/dillo_viewer.c
* src/plugins/mathml_viewer/mathml_viewer.c
        make unregistering of MimeViewerFactorys possible

ChangeLog.claws
configure.ac
src/mimeview.c
src/plugins/dillo_viewer/dillo_viewer.c
src/plugins/mathml_viewer/mathml_viewer.c

index 0d68ca6ee8f36621a430c360317abb15251695f0..94248fa529d35457aaaaa5d29321efd394a5fb52 100644 (file)
@@ -1,3 +1,10 @@
+2003-03-16 [christoph] 0.8.11claws18
+
+       * src/mimeview.c
+       * src/plugins/dillo_viewer/dillo_viewer.c
+       * src/plugins/mathml_viewer/mathml_viewer.c
+               make unregistering of MimeViewerFactorys possible
+
 2003-03-16 [alfons]    0.8.11claws17
 
        * configure.ac
index 8bd7fa9d2a2eb5364957d670faab753ce3044983..815490fbc26a8b5de7cf04cb0d312cf6b8684bac 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws17
+EXTRA_VERSION=claws18
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index d823ad1e2043834c8fdb9b42ab7369bf984818bb..db5e0a1165de98e6c9576fab283bdf4fb7c4995d 100644 (file)
@@ -130,6 +130,7 @@ static GtkTargetEntry mimeview_mime_types[] =
 };
 
 GSList *mimeviewer_factories;
+GSList *mimeviews;
 
 MimeView *mimeview_create(void)
 {
@@ -219,6 +220,8 @@ MimeView *mimeview_create(void)
        mimeview->popupfactory = popupfactory;
        mimeview->type         = -1;
 
+       mimeviews = g_slist_prepend(mimeviews, mimeview);
+
        return mimeview;
 }
 
@@ -360,6 +363,8 @@ void mimeview_destroy(MimeView *mimeview)
        procmime_mimeinfo_free_all(mimeview->mimeinfo);
        g_free(mimeview->file);
        g_free(mimeview);
+
+       mimeviews = g_slist_remove(mimeviews, mimeview);
 }
 
 static void mimeview_set_multipart_tree(MimeView *mimeview,
@@ -1189,7 +1194,30 @@ void mimeview_register_viewer_factory(MimeViewerFactory *factory)
        mimeviewer_factories = g_slist_append(mimeviewer_factories, factory);
 }
 
+static gint cmp_viewer_by_factroy(gconstpointer a, gconstpointer b)
+{
+       return ((MimeViewer *) a)->factory == (MimeViewerFactory *) b ? 0 : -1;
+}
+
 void mimeview_unregister_viewer_factory(MimeViewerFactory *factory)
 {
+       GSList *mimeview_list, *viewer_list;
+
+       for (mimeview_list = mimeviews; mimeview_list != NULL; mimeview_list = g_slist_next(mimeview_list)) {
+               MimeView *mimeview = (MimeView *) mimeview_list->data;
+               
+               if (mimeview->mimeviewer && mimeview->mimeviewer->factory == factory) {
+                       mimeview_change_view_type(mimeview, MIMEVIEW_TEXT);
+                       mimeview->mimeviewer = NULL;
+               }
+
+               while ((viewer_list = g_slist_find_custom(mimeview->viewers, factory, cmp_viewer_by_factroy)) != NULL) {
+                       MimeViewer *mimeviewer = (MimeViewer *) viewer_list->data;
+
+                       mimeviewer->destroy_viewer(mimeviewer);
+                       mimeview->viewers = g_slist_remove(mimeview->viewers, mimeviewer);
+               }
+       }
+
        mimeviewer_factories = g_slist_remove(mimeviewer_factories, factory);
 }
index fa222f741c02d2f85b38c5c7c8dc36d61b14a045..f28db52868eae2e416104814f94f6d86d99f9fd8 100644 (file)
@@ -84,7 +84,7 @@ static void dillo_show_mimepart(MimeViewer *_viewer, const gchar *infile, MimeIn
                                   GTK_SIGNAL_FUNC(socket_destroy_cb),
                                   viewer);
                cmd = g_strdup_printf("dillo -f -l -x %d \"%s\"", 
-                               GDK_WINDOW_XWINDOW(viewer->socket->window),
+                               (gint) GDK_WINDOW_XWINDOW(viewer->socket->window),
                                viewer->filename);
                execute_command_line(cmd, TRUE);
                g_free(cmd);
@@ -153,11 +153,12 @@ gint plugin_init(gchar **error)
 
 void plugin_done()
 {
+       mimeview_unregister_viewer_factory(&dillo_viewer_factory);
 }
 
 const gchar *plugin_name()
 {
-       return "View HTML mail with Dillo";
+       return "Dillo HTML Viewer";
 }
 
 const gchar *plugin_desc()
index acd22262e3c509ac62dcb46c0decabfda8a5b61c..4f8836eae09e0b1bbc8dfcb000f09df77104dfc7 100644 (file)
@@ -135,6 +135,7 @@ gint plugin_init(gchar **error)
 
 void plugin_done()
 {
+       mimeview_unregister_viewer_factory(&mathml_viewer_factory);
 }
 
 const gchar *plugin_name()