0.9.3claws23
[claws.git] / src / plugins / trayicon / trayicon.c
index f788ce074615cc32f157a3a0a515c1b8a40c0e20..56f185955a4f11fbbefda31b5a1b857fce369c0f 100644 (file)
@@ -35,7 +35,7 @@
 #include "unreadmail.xpm"
 #include "nomail.xpm"
 
 #include "unreadmail.xpm"
 #include "nomail.xpm"
 
-static gint hook_id;
+static guint hook_id;
 
 static GdkPixmap *newmail_pixmap;
 static GdkPixmap *newmail_bitmap;
 
 static GdkPixmap *newmail_pixmap;
 static GdkPixmap *newmail_bitmap;
@@ -48,6 +48,7 @@ static EggTrayIcon *trayicon;
 static GtkWidget *eventbox;
 static GtkWidget *image;
 static GtkTooltips *tooltips;
 static GtkWidget *eventbox;
 static GtkWidget *image;
 static GtkTooltips *tooltips;
+guint destroy_signal_id;
 
 typedef enum
 {
 
 typedef enum
 {
@@ -108,16 +109,14 @@ static gboolean folder_item_update_hook(gpointer source, gpointer data)
 static gboolean click_cb(GtkWidget * widget,
                         GdkEventButton * event, gpointer user_data)
 {
 static gboolean click_cb(GtkWidget * widget,
                         GdkEventButton * event, gpointer user_data)
 {
-/*
        MainWindow *mainwin;
 
        mainwin = mainwindow_get_mainwindow();
        if (GTK_WIDGET_VISIBLE(GTK_WIDGET(mainwin->window))) {
        MainWindow *mainwin;
 
        mainwin = mainwindow_get_mainwindow();
        if (GTK_WIDGET_VISIBLE(GTK_WIDGET(mainwin->window))) {
-               gtk_widget_hide_all(mainwin->window);
+               main_window_hide(mainwin);
        } else {
        } else {
-               gtk_widget_show_all(mainwin->window);
+               main_window_show(mainwin);
         }
         }
-*/
        return TRUE;
 }
 
        return TRUE;
 }
 
@@ -160,6 +159,7 @@ static void create_trayicon()
         image = gtk_pixmap_new(nomail_pixmap, nomail_bitmap);
         gtk_packer_add_defaults(GTK_PACKER(packer), GTK_WIDGET(image), GTK_SIDE_TOP, GTK_ANCHOR_CENTER, GTK_PACK_EXPAND);
 
         image = gtk_pixmap_new(nomail_pixmap, nomail_bitmap);
         gtk_packer_add_defaults(GTK_PACKER(packer), GTK_WIDGET(image), GTK_SIDE_TOP, GTK_ANCHOR_CENTER, GTK_PACK_EXPAND);
 
+       destroy_signal_id =
        gtk_signal_connect(GTK_OBJECT(trayicon), "destroy",
                      GTK_SIGNAL_FUNC(destroy_cb), NULL);
        gtk_signal_connect(GTK_OBJECT(trayicon), "size_allocate",
        gtk_signal_connect(GTK_OBJECT(trayicon), "destroy",
                      GTK_SIGNAL_FUNC(destroy_cb), NULL);
        gtk_signal_connect(GTK_OBJECT(trayicon), "size_allocate",
@@ -191,6 +191,8 @@ int plugin_init(gchar **error)
 
 void plugin_done(void)
 {
 
 void plugin_done(void)
 {
+       gtk_signal_disconnect(GTK_OBJECT(trayicon), destroy_signal_id);
+
        gtk_widget_destroy(GTK_WIDGET(trayicon));
        hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_id);
 }
        gtk_widget_destroy(GTK_WIDGET(trayicon));
        hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_id);
 }