~stevenk/shotwell/fix-changelog

« back to all changes in this revision

Viewing changes to plugins/shotwell-publishing/FacebookPublishing.vala

  • Committer: Clint Rogers
  • Date: 2011-10-19 00:37:05 UTC
  • Revision ID: git-v1:fbbd826f405a00b144b4b2ac7cf8abc861a3546f
Closes #4201 by changing all structs with reference members to classes
to work around a change to the way Vala handles structs passed as arguments;
please see https://bugzilla.gnome.org/show_bug.cgi?id=661041 for details.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
internal const string PRIVACY_OBJECT_EVERYONE = "{ 'value' : 'EVERYONE' }";
78
78
internal const string USER_AGENT = "Java/1.6.0_16";
79
79
 
80
 
internal struct FacebookAlbum {
81
 
    string name;
82
 
    string id;
 
80
internal class FacebookAlbum {
 
81
    public string name;
 
82
    public string id;
83
83
 
84
 
    FacebookAlbum(string creator_name, string creator_id) {
 
84
    public FacebookAlbum(string creator_name, string creator_id) {
85
85
        name = creator_name;
86
86
        id = creator_id;
87
87
    }
325
325
 
326
326
                if (name_val != "Profile Pictures")
327
327
                    if (lookup_album(name_val) == NO_ALBUM)
328
 
                        extracted += FacebookAlbum(name_val, aid_val);
 
328
                        extracted += new FacebookAlbum(name_val, aid_val);
329
329
 
330
330
            }
331
331
        } catch (Spit.Publishing.PublishingError err) {
445
445
 
446
446
    private void do_create_album(string album_name) {
447
447
        debug("ACTION: creating new photo album with name '%s'", album_name);
448
 
        albums += FacebookAlbum(album_name, "");
 
448
        albums += new FacebookAlbum(album_name, "");
449
449
 
450
450
        host.set_service_locked(true);
451
451
 
949
949
    }
950
950
}
951
951
 
952
 
internal struct FacebookRESTArgument {
 
952
internal class FacebookRESTArgument {
953
953
    public string key;
954
954
    public string value;
955
955
 
1116
1116
    }
1117
1117
 
1118
1118
    public void add_argument(string name, string value) {
1119
 
        arguments += FacebookRESTArgument(name, value);
 
1119
        arguments += new FacebookRESTArgument(name, value);
1120
1120
    }
1121
1121
 
1122
1122
    public string get_endpoint_url() {
1326
1326
        pane_widget.add(webview_frame);
1327
1327
    }
1328
1328
    
1329
 
    private struct LocaleLookup {
 
1329
    private class LocaleLookup {
1330
1330
        public string prefix;
1331
1331
        public string translation;
1332
1332
        public string? exception_code;
1333
1333
        public string? exception_translation;
1334
1334
        public string? exception_code_2;
1335
1335
        public string? exception_translation_2;
 
1336
        
 
1337
        public LocaleLookup(string prefix, string translation, string? exception_code = null, 
 
1338
            string? exception_translation  = null, string? exception_code_2  = null, 
 
1339
            string? exception_translation_2 = null) {
 
1340
            this.prefix = prefix;
 
1341
            this.translation = translation;
 
1342
            this.exception_code = exception_code;
 
1343
            this.exception_translation = exception_translation;
 
1344
            this.exception_code_2 = exception_code_2;
 
1345
            this.exception_translation_2 = exception_translation_2;
 
1346
        }
 
1347
        
1336
1348
    }
1337
1349
    
1338
 
    private const LocaleLookup[] locale_lookup_table = {
1339
 
        { "es", "es-la", "ES", "es-es" },
1340
 
        { "en", "en-gb", "US", "en-us" },
1341
 
        { "fr", "fr-fr", "CA", "fr-ca" },
1342
 
        { "pt", "pt-br", "PT", "pt-pt" },
1343
 
        { "zh", "zh-cn", "HK", "zh-hk", "TW", "zh-tw" },
1344
 
        { "af", "af-za" },
1345
 
        { "ar", "ar-ar" },
1346
 
        { "nb", "nb-no" },
1347
 
        { "no", "nb-no" },
1348
 
        { "id", "id-id" },
1349
 
        { "ms", "ms-my" },
1350
 
        { "ca", "ca-es" },
1351
 
        { "cs", "cs-cz" },
1352
 
        { "cy", "cy-gb" },
1353
 
        { "da", "da-dk" },
1354
 
        { "de", "de-de" },
1355
 
        { "tl", "tl-ph" },
1356
 
        { "ko", "ko-kr" },
1357
 
        { "hr", "hr-hr" },
1358
 
        { "it", "it-it" },
1359
 
        { "lt", "lt-lt" },
1360
 
        { "hu", "hu-hu" },
1361
 
        { "nl", "nl-nl" },
1362
 
        { "ja", "ja-jp" },
1363
 
        { "nb", "nb-no" },
1364
 
        { "no", "nb-no" },
1365
 
        { "pl", "pl-pl" },
1366
 
        { "ro", "ro-ro" },
1367
 
        { "ru", "ru-ru" },
1368
 
        { "sk", "sk-sk" },
1369
 
        { "sl", "sl-sl" },
1370
 
        { "sv", "sv-se" },
1371
 
        { "th", "th-th" },
1372
 
        { "vi", "vi-vn" },
1373
 
        { "tr", "tr-tr" },
1374
 
        { "el", "el-gr" },
1375
 
        { "bg", "bg-bg" },
1376
 
        { "sr", "sr-rs" },
1377
 
        { "he", "he-il" },
1378
 
        { "hi", "hi-in" },
1379
 
        { "bn", "bn-in" },
1380
 
        { "pa", "pa-in" },
1381
 
        { "ta", "ta-in" },
1382
 
        { "te", "te-in" },
1383
 
        { "ml", "ml-in" }
 
1350
    private LocaleLookup[] locale_lookup_table = {
 
1351
        new LocaleLookup( "es", "es-la", "ES", "es-es" ),
 
1352
        new LocaleLookup( "en", "en-gb", "US", "en-us" ),
 
1353
        new LocaleLookup( "fr", "fr-fr", "CA", "fr-ca" ),
 
1354
        new LocaleLookup( "pt", "pt-br", "PT", "pt-pt" ),
 
1355
        new LocaleLookup( "zh", "zh-cn", "HK", "zh-hk", "TW", "zh-tw" ),
 
1356
        new LocaleLookup( "af", "af-za" ),
 
1357
        new LocaleLookup( "ar", "ar-ar" ),
 
1358
        new LocaleLookup( "nb", "nb-no" ),
 
1359
        new LocaleLookup( "no", "nb-no" ),
 
1360
        new LocaleLookup( "id", "id-id" ),
 
1361
        new LocaleLookup( "ms", "ms-my" ),
 
1362
        new LocaleLookup( "ca", "ca-es" ),
 
1363
        new LocaleLookup( "cs", "cs-cz" ),
 
1364
        new LocaleLookup( "cy", "cy-gb" ),
 
1365
        new LocaleLookup( "da", "da-dk" ),
 
1366
        new LocaleLookup( "de", "de-de" ),
 
1367
        new LocaleLookup( "tl", "tl-ph" ),
 
1368
        new LocaleLookup( "ko", "ko-kr" ),
 
1369
        new LocaleLookup( "hr", "hr-hr" ),
 
1370
        new LocaleLookup( "it", "it-it" ),
 
1371
        new LocaleLookup( "lt", "lt-lt" ),
 
1372
        new LocaleLookup( "hu", "hu-hu" ),
 
1373
        new LocaleLookup( "nl", "nl-nl" ),
 
1374
        new LocaleLookup( "ja", "ja-jp" ),
 
1375
        new LocaleLookup( "nb", "nb-no" ),
 
1376
        new LocaleLookup( "no", "nb-no" ),
 
1377
        new LocaleLookup( "pl", "pl-pl" ),
 
1378
        new LocaleLookup( "ro", "ro-ro" ),
 
1379
        new LocaleLookup( "ru", "ru-ru" ),
 
1380
        new LocaleLookup( "sk", "sk-sk" ),
 
1381
        new LocaleLookup( "sl", "sl-sl" ),
 
1382
        new LocaleLookup( "sv", "sv-se" ),
 
1383
        new LocaleLookup( "th", "th-th" ),
 
1384
        new LocaleLookup( "vi", "vi-vn" ),
 
1385
        new LocaleLookup( "tr", "tr-tr" ),
 
1386
        new LocaleLookup( "el", "el-gr" ),
 
1387
        new LocaleLookup( "bg", "bg-bg" ),
 
1388
        new LocaleLookup( "sr", "sr-rs" ),
 
1389
        new LocaleLookup( "he", "he-il" ),
 
1390
        new LocaleLookup( "hi", "hi-in" ),
 
1391
        new LocaleLookup( "bn", "bn-in" ),
 
1392
        new LocaleLookup( "pa", "pa-in" ),
 
1393
        new LocaleLookup( "ta", "ta-in" ),
 
1394
        new LocaleLookup( "te", "te-in" ),
 
1395
        new LocaleLookup( "ml", "ml-in" )
1384
1396
    };
1385
1397
    
1386
1398
    private string get_system_locale_as_facebook_locale() {
1512
1524
}
1513
1525
 
1514
1526
internal class LegacyPublishingOptionsPane : Gtk.VBox {
1515
 
    private struct PrivacyDescription {
1516
 
        private string description;
1517
 
        private string privacy_setting;
 
1527
    private class PrivacyDescription {
 
1528
        public string description;
 
1529
        public string privacy_setting;
1518
1530
 
1519
 
        PrivacyDescription(string description, string privacy_setting) {
 
1531
        public PrivacyDescription(string description, string privacy_setting) {
1520
1532
            this.description = description;
1521
1533
            this.privacy_setting = privacy_setting;
1522
1534
        }
1799
1811
    private PrivacyDescription[] create_privacy_descriptions() {
1800
1812
        PrivacyDescription[] result = new PrivacyDescription[0];
1801
1813
 
1802
 
        result += PrivacyDescription(_("Just me"), PRIVACY_OBJECT_JUST_ME);
1803
 
        result += PrivacyDescription(_("All friends"), PRIVACY_OBJECT_ALL_FRIENDS);
1804
 
        result += PrivacyDescription(_("Friends of friends"), PRIVACY_OBJECT_FRIENDS_OF_FRIENDS);
1805
 
        result += PrivacyDescription(_("Everyone"), PRIVACY_OBJECT_EVERYONE);
 
1814
        result += new PrivacyDescription(_("Just me"), PRIVACY_OBJECT_JUST_ME);
 
1815
        result += new PrivacyDescription(_("All friends"), PRIVACY_OBJECT_ALL_FRIENDS);
 
1816
        result += new PrivacyDescription(_("Friends of friends"), PRIVACY_OBJECT_FRIENDS_OF_FRIENDS);
 
1817
        result += new PrivacyDescription(_("Everyone"), PRIVACY_OBJECT_EVERYONE);
1806
1818
 
1807
1819
        return result;
1808
1820
    }