~ubuntu-branches/ubuntu/vivid/cairo-dock-plug-ins/vivid

« back to all changes in this revision

Viewing changes to mail/src/cd-mail-applet-accounts.c

  • Committer: Matthieu Baerts
  • Date: 2013-08-27 14:46:47 UTC
  • mto: (53.1.4 cairo-dock-plug-ins)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: matttbe@gmail.com-20130827144647-wm0kyawa8vcg0cso
Tags: upstream-3.2.99.beta1.1~20130827~bzr2928
ImportĀ upstreamĀ versionĀ 3.2.99.beta1.1~20130827~bzr2928

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#define _add_icon(pMailAccount)\
29
29
        pIcon = cairo_dock_create_dummy_launcher (g_strdup (pMailAccount->name),\
30
 
                g_strdup (myConfig.cNoMailUserImage),\
 
30
                pMailAccount->cIconName ? g_strdup (pMailAccount->cIconName) : g_strdup (myConfig.cNoMailUserImage),\
31
31
                g_strdup (pMailAccount->cMailApp),\
32
32
                g_strdup ("..."),\
33
33
                i);\
36
36
        pMailAccount->icon = pIcon;
37
37
 
38
38
// Translation Hack:
39
 
const char *strings_to_translate[20] = {N_("Server address:"), N_("myHost"), N_("Username:"), N_("Password:"), N_("The password will be crypted."), N_("Port:"), N_("Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S."), N_("Enter 0 to use the default port. Default ports are 143 for IMAP4 and 993 for IMAP4 over SSL."), N_("Use a secure connection (SSL)"), N_("Refresh time:"), N_("In minutes."), N_("Specific mail application"), N_("Leave empty to use the default mail application."), N_("Directory on server:"), N_("Path of mbox file:"), N_("Path to Mail directory:"), N_("Address of feed:"), N_("Remove this account"), N_("Don't forget to enable IMAP (or POP) service from settings of your mail account.")};
 
39
const char *strings_to_translate[20] = {N_("Server address:"), N_("myHost"), N_("Username:"), N_("Password:"), N_("The password will be crypted."), N_("Port:"), N_("Enter 0 to use the default port. Default ports are 110 for POP3 or APOP and 995 for POP3S."), N_("Enter 0 to use the default port. Default ports are 143 for IMAP4 and 993 for IMAP4 over SSL."), N_("Use a secure connection (SSL)"), N_("Refresh time:"), N_("In minutes."), N_("Specific mail application"), N_("Leave empty to use the default mail application."), N_("Specific icon file when using multiple accounts"), N_("Directory on server:"), N_("Path of mbox file:"), N_("Path to Mail directory:"), N_("Address of feed:"), N_("Remove this account"), N_("Don't forget to enable IMAP (or POP) service from settings of your mail account.")};
40
40
 
41
41
// Default parameters (to not copy these parameters each time)
42
42
void _add_default_create_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
52
52
 
53
53
        g_key_file_set_string (pKeyFile, pMailAccountName, "mail application", "");
54
54
        g_key_file_set_comment (pKeyFile, pMailAccountName, "mail application", "s0 Specific mail application\n{Leave empty to use the default mail application.}", NULL);
 
55
 
 
56
        g_key_file_set_string (pKeyFile, pMailAccountName, "icon name", "");
 
57
        g_key_file_set_comment (pKeyFile, pMailAccountName, "icon name", "g0 Specific icon file when using multiple accounts\n{Leave empty to use the default icon.}", NULL);
55
58
}
56
59
 
57
60
void _retrieve_user_password (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
512
515
        _retrieve_user_password( mailaccount, pKeyFile, mailbox_name );
513
516
}
514
517
 
515
 
void cd_mail_create_uclouvain_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
516
 
{
517
 
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "uclouvain");
518
 
        g_key_file_set_comment (pKeyFile, pMailAccountName, "type", ">0 ", NULL);
519
 
 
520
 
        _add_default_create_params( pKeyFile, pMailAccountName );
521
 
}
522
 
 
523
 
void cd_mail_retrieve_uclouvain_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, const gchar *mailbox_name)
524
 
{       // IMAP
525
 
        if( !mailaccount || !pKeyFile || !mailbox_name )
526
 
                return;
527
 
 
528
 
        mailaccount->driver = IMAP_STORAGE;
529
 
        mailaccount->storage = mailstorage_new(NULL);
530
 
        mailaccount->server = g_strdup("mail.sipr.ucl.ac.be");
531
 
        mailaccount->port = 993;
532
 
        mailaccount->connection_type = CONNECTION_TYPE_TLS;
533
 
        mailaccount->auth_type = IMAP_AUTH_TYPE_PLAIN;
534
 
        mailaccount->path = g_strdup("Inbox");
535
 
        
536
 
        _retrieve_user_password( mailaccount, pKeyFile, mailbox_name );
537
 
}
538
 
 
539
518
void cd_mail_create_skynet_params( GKeyFile *pKeyFile, const gchar *pMailAccountName )
540
519
{
541
520
        g_key_file_set_string (pKeyFile, pMailAccountName, "type", "skynet");
571
550
};*/
572
551
 
573
552
 
574
 
void cd_mail_init_accounts(CairoDockModuleInstance *myApplet)
 
553
void cd_mail_init_accounts(GldiModuleInstance *myApplet)
575
554
{
576
555
        if (myData.pMailAccounts == NULL)
577
556
                return ;
581
560
        CDMailAccount *pMailAccount;
582
561
        GList *pIconList = NULL;
583
562
        Icon *pIcon;
584
 
        CairoContainer *pContainer;
585
563
        int iNbIcons = 0;
586
564
        int r;
587
565
        gboolean bIsGettingMail = FALSE;
641
619
                if (myData.pMailAccounts->len == 1)  // 1 seul compte
642
620
                {
643
621
                        pIcon = myIcon;
644
 
                        pContainer = myContainer;
645
622
                }
646
623
                else
647
624
                {
648
625
                        _add_icon (pMailAccount);
649
 
                        pContainer = CD_APPLET_MY_ICONS_LIST_CONTAINER;
650
626
                }
651
627
                iNbIcons ++;
652
628
                
653
629
                //  if all is OK, then set a timeout for this mail account
654
630
                if (r == MAIL_NO_ERROR)
655
631
                {
656
 
                        cairo_dock_set_quick_info (pIcon, pContainer, "..."); // on the current icon
 
632
                        gldi_icon_set_quick_info (pIcon, "..."); // on the current icon
657
633
                        pMailAccount->pAccountMailTimer = cairo_dock_new_task (pMailAccount->timeout * 60,
658
634
                                (CairoDockGetDataAsyncFunc) cd_mail_get_folder_data,
659
635
                                (CairoDockUpdateSyncFunc) cd_mail_update_account_status,
664
640
                else
665
641
                {
666
642
                        cd_warning ("mail : the mail account %s couldn't be initialized !", pMailAccount->name);
667
 
                        CairoContainer *pContainer = (myData.pMailAccounts->len == 1 ? myContainer : CD_APPLET_MY_ICONS_LIST_CONTAINER);
668
 
                        cairo_dock_set_quick_info (pIcon, pContainer, "N/A");
 
643
                        gldi_icon_set_quick_info (pIcon, "N/A");
669
644
                }
670
645
        }
671
646
        
699
674
        g_free( pMailAccount->password );
700
675
        g_free( pMailAccount->path );
701
676
        g_free( pMailAccount->cMailApp );
 
677
        g_free( pMailAccount->cIconName );
702
678
 
703
679
        if( pMailAccount->folder )
704
680
                mailfolder_free(pMailAccount->folder);
714
690
        g_free( pMailAccount );
715
691
}
716
692
 
717
 
void cd_mail_free_all_accounts (CairoDockModuleInstance *myApplet)
 
693
void cd_mail_free_all_accounts (GldiModuleInstance *myApplet)
718
694
{
719
695
        if (myData.pMailAccounts == NULL)
720
696
                return ;