2007-08-29 [colin] 2.10.0cvs183
[claws.git] / src / plugins / trayicon / trayicon.c
index a9e29eb4e6cc63c338311b8f7e59730deced5755..c2cd4e99c13cab904914f2141581191616adeab1 100644 (file)
@@ -4,7 +4,7 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifdef HAVE_CONFIG_H
@@ -318,10 +318,10 @@ static gboolean click_cb(GtkWidget * widget,
                /* initialize checkitem according to current offline state */
                gtk_check_menu_item_set_active(
                        GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(traymenu_factory,
-                       _("/Work Offline"))), prefs_common.work_offline);
+                       "/Work Offline")), prefs_common.work_offline);
                gtk_widget_set_sensitive(
                        GTK_WIDGET(gtk_item_factory_get_item(traymenu_factory,
-                       _("/Get Mail"))), mainwin->lock_count == 0);
+                       "/Get Mail")), mainwin->lock_count == 0);
                updating_menu = FALSE;
 
                gtk_menu_popup( GTK_MENU(traymenu_popup), NULL, NULL, NULL, NULL,
@@ -402,37 +402,37 @@ int plugin_init(gchar **error)
        item_hook_id = hooks_register_hook (FOLDER_ITEM_UPDATE_HOOKLIST, folder_item_update_hook, NULL);
        if (item_hook_id == -1) {
                *error = g_strdup(_("Failed to register folder item update hook"));
-               return -1;
+               goto err_out_item;
        }
 
        folder_hook_id = hooks_register_hook (FOLDER_UPDATE_HOOKLIST, folder_update_hook, NULL);
        if (folder_hook_id == -1) {
                *error = g_strdup(_("Failed to register folder update hook"));
-               return -1;
+               goto err_out_folder;
        }
 
        offline_hook_id = hooks_register_hook (OFFLINE_SWITCH_HOOKLIST, offline_update_hook, NULL);
        if (offline_hook_id == -1) {
                *error = g_strdup(_("Failed to register offline switch hook"));
-               return -1;
+               goto err_out_offline;
        }
 
        account_hook_id = hooks_register_hook (ACCOUNT_LIST_CHANGED_HOOKLIST, trayicon_set_accounts_hook, NULL);
-       if (offline_hook_id == -1) {
+       if (account_hook_id == -1) {
                *error = g_strdup(_("Failed to register account list changed hook"));
-               return -1;
+               goto err_out_account;
        }
 
        close_hook_id = hooks_register_hook (MAIN_WINDOW_CLOSE, trayicon_close_hook, NULL);
        if (close_hook_id == -1) {
                *error = g_strdup(_("Failed to register close hook"));
-               return -1;
+               goto err_out_close;
        }
 
        iconified_hook_id = hooks_register_hook (MAIN_WINDOW_GOT_ICONIFIED, trayicon_got_iconified_hook, NULL);
-       if (offline_hook_id == -1) {
+       if (iconified_hook_id == -1) {
                *error = g_strdup(_("Failed to register got iconified hook"));
-               return -1;
+               goto err_out_iconified;
        }
 
        create_trayicon();
@@ -449,6 +449,19 @@ int plugin_init(gchar **error)
        }
 
        return 0;
+
+err_out_iconified:
+       hooks_unregister_hook(MAIN_WINDOW_CLOSE, close_hook_id);
+err_out_close:
+       hooks_unregister_hook(ACCOUNT_LIST_CHANGED_HOOKLIST, account_hook_id);
+err_out_account:
+       hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, offline_hook_id);
+err_out_offline:
+       hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, folder_hook_id);
+err_out_folder:
+       hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, item_hook_id);
+err_out_item:
+       return -1;
 }
 
 gboolean plugin_done(void)
@@ -497,7 +510,7 @@ const gchar *plugin_type(void)
 
 const gchar *plugin_licence(void)
 {
-       return "GPL";
+       return "GPL3+";
 }
 
 const gchar *plugin_version(void)