{"action":"created","comment":{"url":"https://api.github.com/repos/gtk-rs/gir/pulls/comments/57416928","id":57416928,"diff_hunk":"@@ -0,0 +1,154 @@\n+use analysis::namespaces;\n+use case::CaseExt;\n+use codegen::general::{self, version_condition, version_condition_string};\n+use env::Env;\n+use file_saver;\n+use library::*;\n+use std::collections::HashSet;\n+use std::io::prelude::*;\n+use std::io::Result;\n+use std::path::Path;\n+use traits::*;\n+use version::Version;\n+\n+pub fn generate(env: &Env, root_path: &Path, mod_rs: &mut Vec<String>) {\n+    let path = root_path.join(\"enums.rs\");\n+    mod_rs.push(\"\\nmod enums;\".into());\n+    file_saver::save_to_file(path, env.config.make_backup, |w| {\n+        try!(general::start_comments(w, &env.config));\n+        try!(writeln!(w, \"{}\", r#\"\n+use ffi;\n+use glib_ffi;\n+use glib::error::ErrorDomain;\n+use glib::translate::*;\n+\"#));\n+\n+        for (_, type_) in env.library.namespace_types(namespaces::MAIN) {\n+            if let Type::Enumeration(ref enum_) = *type_ {\n+                try!(generate_enum(env, w, enum_));\n+                if let Some (cfg) = version_condition_string(env.config.min_cfg_version,","path":"src/codegen/enums.rs","position":29,"original_position":29,"commit_id":"6a7e820d0c2e6733075f7a3a9060cb3408ebbb4d","original_commit_id":"6a7e820d0c2e6733075f7a3a9060cb3408ebbb4d","user":{"login":"EPashkin","id":584258,"avatar_url":"https://avatars.githubusercontent.com/u/584258?v=3","gravatar_id":"","url":"https://api.github.com/users/EPashkin","html_url":"https://github.com/EPashkin","followers_url":"https://api.github.com/users/EPashkin/followers","following_url":"https://api.github.com/users/EPashkin/following{/other_user}","gists_url":"https://api.github.com/users/EPashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/EPashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EPashkin/subscriptions","organizations_url":"https://api.github.com/users/EPashkin/orgs","repos_url":"https://api.github.com/users/EPashkin/repos","events_url":"https://api.github.com/users/EPashkin/events{/privacy}","received_events_url":"https://api.github.com/users/EPashkin/received_events","type":"User","site_admin":false},"body":"Too many calls `version_condition_string` with these parameters, maybe its time to add new function with parameters `(env: &Env, version: Option<Version>)`?","created_at":"2016-03-25T03:54:15Z","updated_at":"2016-03-25T03:54:15Z","html_url":"https://github.com/gtk-rs/gir/pull/229#discussion_r57416928","pull_request_url":"https://api.github.com/repos/gtk-rs/gir/pulls/229","_links":{"self":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/comments/57416928"},"html":{"href":"https://github.com/gtk-rs/gir/pull/229#discussion_r57416928"},"pull_request":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/229"}}},"pull_request":{"url":"https://api.github.com/repos/gtk-rs/gir/pulls/229","id":64099510,"html_url":"https://github.com/gtk-rs/gir/pull/229","diff_url":"https://github.com/gtk-rs/gir/pull/229.diff","patch_url":"https://github.com/gtk-rs/gir/pull/229.patch","issue_url":"https://api.github.com/repos/gtk-rs/gir/issues/229","number":229,"state":"open","locked":false,"title":"Generate bitflags and enums in high-level crates","user":{"login":"gkoz","id":4260361,"avatar_url":"https://avatars.githubusercontent.com/u/4260361?v=3","gravatar_id":"","url":"https://api.github.com/users/gkoz","html_url":"https://github.com/gkoz","followers_url":"https://api.github.com/users/gkoz/followers","following_url":"https://api.github.com/users/gkoz/following{/other_user}","gists_url":"https://api.github.com/users/gkoz/gists{/gist_id}","starred_url":"https://api.github.com/users/gkoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkoz/subscriptions","organizations_url":"https://api.github.com/users/gkoz/orgs","repos_url":"https://api.github.com/users/gkoz/repos","events_url":"https://api.github.com/users/gkoz/events{/privacy}","received_events_url":"https://api.github.com/users/gkoz/received_events","type":"User","site_admin":false},"body":"Before generating any more crates I'd like to start generating enums.\r\n\r\nSome things to decide there are:\r\n\r\n* Do we want to list all generated enums in the config? We probably should either change \"object\" to something more generic or add `enumeration`, `record` etc.\r\n\r\n* The `__Nonexhaustive` variant protects from breakage caused by adding variants. This implementation always adds it but we may want a different policy. Adding `__Nonexhaustive` everywhere could potentially be a serious breaking change for gtk.\r\n\r\n* The working assumption here is that in the future the sys crates won't have any enums or bitflags, just `c_int` and `c_uint` newtypes or type aliases and constants. But perhaps not?\r\n\r\nRelevant issues: #108, #124.","created_at":"2016-03-24T21:10:42Z","updated_at":"2016-03-25T03:54:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7cdc411adb299dddb59e1d0f74c1fb1f28a8184b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gtk-rs/gir/pulls/229/commits","review_comments_url":"https://api.github.com/repos/gtk-rs/gir/pulls/229/comments","review_comment_url":"https://api.github.com/repos/gtk-rs/gir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gtk-rs/gir/issues/229/comments","statuses_url":"https://api.github.com/repos/gtk-rs/gir/statuses/6a7e820d0c2e6733075f7a3a9060cb3408ebbb4d","head":{"label":"gkoz:enums","ref":"enums","sha":"6a7e820d0c2e6733075f7a3a9060cb3408ebbb4d","user":{"login":"gkoz","id":4260361,"avatar_url":"https://avatars.githubusercontent.com/u/4260361?v=3","gravatar_id":"","url":"https://api.github.com/users/gkoz","html_url":"https://github.com/gkoz","followers_url":"https://api.github.com/users/gkoz/followers","following_url":"https://api.github.com/users/gkoz/following{/other_user}","gists_url":"https://api.github.com/users/gkoz/gists{/gist_id}","starred_url":"https://api.github.com/users/gkoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkoz/subscriptions","organizations_url":"https://api.github.com/users/gkoz/orgs","repos_url":"https://api.github.com/users/gkoz/repos","events_url":"https://api.github.com/users/gkoz/events{/privacy}","received_events_url":"https://api.github.com/users/gkoz/received_events","type":"User","site_admin":false},"repo":{"id":49890198,"name":"gir","full_name":"gkoz/gir","owner":{"login":"gkoz","id":4260361,"avatar_url":"https://avatars.githubusercontent.com/u/4260361?v=3","gravatar_id":"","url":"https://api.github.com/users/gkoz","html_url":"https://github.com/gkoz","followers_url":"https://api.github.com/users/gkoz/followers","following_url":"https://api.github.com/users/gkoz/following{/other_user}","gists_url":"https://api.github.com/users/gkoz/gists{/gist_id}","starred_url":"https://api.github.com/users/gkoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkoz/subscriptions","organizations_url":"https://api.github.com/users/gkoz/orgs","repos_url":"https://api.github.com/users/gkoz/repos","events_url":"https://api.github.com/users/gkoz/events{/privacy}","received_events_url":"https://api.github.com/users/gkoz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gkoz/gir","description":"","fork":true,"url":"https://api.github.com/repos/gkoz/gir","forks_url":"https://api.github.com/repos/gkoz/gir/forks","keys_url":"https://api.github.com/repos/gkoz/gir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gkoz/gir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gkoz/gir/teams","hooks_url":"https://api.github.com/repos/gkoz/gir/hooks","issue_events_url":"https://api.github.com/repos/gkoz/gir/issues/events{/number}","events_url":"https://api.github.com/repos/gkoz/gir/events","assignees_url":"https://api.github.com/repos/gkoz/gir/assignees{/user}","branches_url":"https://api.github.com/repos/gkoz/gir/branches{/branch}","tags_url":"https://api.github.com/repos/gkoz/gir/tags","blobs_url":"https://api.github.com/repos/gkoz/gir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gkoz/gir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gkoz/gir/git/refs{/sha}","trees_url":"https://api.github.com/repos/gkoz/gir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gkoz/gir/statuses/{sha}","languages_url":"https://api.github.com/repos/gkoz/gir/languages","stargazers_url":"https://api.github.com/repos/gkoz/gir/stargazers","contributors_url":"https://api.github.com/repos/gkoz/gir/contributors","subscribers_url":"https://api.github.com/repos/gkoz/gir/subscribers","subscription_url":"https://api.github.com/repos/gkoz/gir/subscription","commits_url":"https://api.github.com/repos/gkoz/gir/commits{/sha}","git_commits_url":"https://api.github.com/repos/gkoz/gir/git/commits{/sha}","comments_url":"https://api.github.com/repos/gkoz/gir/comments{/number}","issue_comment_url":"https://api.github.com/repos/gkoz/gir/issues/comments{/number}","contents_url":"https://api.github.com/repos/gkoz/gir/contents/{+path}","compare_url":"https://api.github.com/repos/gkoz/gir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gkoz/gir/merges","archive_url":"https://api.github.com/repos/gkoz/gir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gkoz/gir/downloads","issues_url":"https://api.github.com/repos/gkoz/gir/issues{/number}","pulls_url":"https://api.github.com/repos/gkoz/gir/pulls{/number}","milestones_url":"https://api.github.com/repos/gkoz/gir/milestones{/number}","notifications_url":"https://api.github.com/repos/gkoz/gir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gkoz/gir/labels{/name}","releases_url":"https://api.github.com/repos/gkoz/gir/releases{/id}","deployments_url":"https://api.github.com/repos/gkoz/gir/deployments","created_at":"2016-01-18T16:46:07Z","updated_at":"2016-01-18T16:46:07Z","pushed_at":"2016-03-24T20:53:44Z","git_url":"git://github.com/gkoz/gir.git","ssh_url":"git@github.com:gkoz/gir.git","clone_url":"https://github.com/gkoz/gir.git","svn_url":"https://github.com/gkoz/gir","homepage":null,"size":646,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gtk-rs:master","ref":"master","sha":"0d8699e6cf233d8d3d4ffde918ea82dc05f4f08a","user":{"login":"gtk-rs","id":11757045,"avatar_url":"https://avatars.githubusercontent.com/u/11757045?v=3","gravatar_id":"","url":"https://api.github.com/users/gtk-rs","html_url":"https://github.com/gtk-rs","followers_url":"https://api.github.com/users/gtk-rs/followers","following_url":"https://api.github.com/users/gtk-rs/following{/other_user}","gists_url":"https://api.github.com/users/gtk-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/gtk-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtk-rs/subscriptions","organizations_url":"https://api.github.com/users/gtk-rs/orgs","repos_url":"https://api.github.com/users/gtk-rs/repos","events_url":"https://api.github.com/users/gtk-rs/events{/privacy}","received_events_url":"https://api.github.com/users/gtk-rs/received_events","type":"Organization","site_admin":false},"repo":{"id":37824715,"name":"gir","full_name":"gtk-rs/gir","owner":{"login":"gtk-rs","id":11757045,"avatar_url":"https://avatars.githubusercontent.com/u/11757045?v=3","gravatar_id":"","url":"https://api.github.com/users/gtk-rs","html_url":"https://github.com/gtk-rs","followers_url":"https://api.github.com/users/gtk-rs/followers","following_url":"https://api.github.com/users/gtk-rs/following{/other_user}","gists_url":"https://api.github.com/users/gtk-rs/gists{/gist_id}","starred_url":"https://api.github.com/users/gtk-rs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtk-rs/subscriptions","organizations_url":"https://api.github.com/users/gtk-rs/orgs","repos_url":"https://api.github.com/users/gtk-rs/repos","events_url":"https://api.github.com/users/gtk-rs/events{/privacy}","received_events_url":"https://api.github.com/users/gtk-rs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gtk-rs/gir","description":"","fork":false,"url":"https://api.github.com/repos/gtk-rs/gir","forks_url":"https://api.github.com/repos/gtk-rs/gir/forks","keys_url":"https://api.github.com/repos/gtk-rs/gir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gtk-rs/gir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gtk-rs/gir/teams","hooks_url":"https://api.github.com/repos/gtk-rs/gir/hooks","issue_events_url":"https://api.github.com/repos/gtk-rs/gir/issues/events{/number}","events_url":"https://api.github.com/repos/gtk-rs/gir/events","assignees_url":"https://api.github.com/repos/gtk-rs/gir/assignees{/user}","branches_url":"https://api.github.com/repos/gtk-rs/gir/branches{/branch}","tags_url":"https://api.github.com/repos/gtk-rs/gir/tags","blobs_url":"https://api.github.com/repos/gtk-rs/gir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gtk-rs/gir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gtk-rs/gir/git/refs{/sha}","trees_url":"https://api.github.com/repos/gtk-rs/gir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gtk-rs/gir/statuses/{sha}","languages_url":"https://api.github.com/repos/gtk-rs/gir/languages","stargazers_url":"https://api.github.com/repos/gtk-rs/gir/stargazers","contributors_url":"https://api.github.com/repos/gtk-rs/gir/contributors","subscribers_url":"https://api.github.com/repos/gtk-rs/gir/subscribers","subscription_url":"https://api.github.com/repos/gtk-rs/gir/subscription","commits_url":"https://api.github.com/repos/gtk-rs/gir/commits{/sha}","git_commits_url":"https://api.github.com/repos/gtk-rs/gir/git/commits{/sha}","comments_url":"https://api.github.com/repos/gtk-rs/gir/comments{/number}","issue_comment_url":"https://api.github.com/repos/gtk-rs/gir/issues/comments{/number}","contents_url":"https://api.github.com/repos/gtk-rs/gir/contents/{+path}","compare_url":"https://api.github.com/repos/gtk-rs/gir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gtk-rs/gir/merges","archive_url":"https://api.github.com/repos/gtk-rs/gir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gtk-rs/gir/downloads","issues_url":"https://api.github.com/repos/gtk-rs/gir/issues{/number}","pulls_url":"https://api.github.com/repos/gtk-rs/gir/pulls{/number}","milestones_url":"https://api.github.com/repos/gtk-rs/gir/milestones{/number}","notifications_url":"https://api.github.com/repos/gtk-rs/gir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gtk-rs/gir/labels{/name}","releases_url":"https://api.github.com/repos/gtk-rs/gir/releases{/id}","deployments_url":"https://api.github.com/repos/gtk-rs/gir/deployments","created_at":"2015-06-21T20:29:55Z","updated_at":"2016-03-20T03:34:39Z","pushed_at":"2016-03-25T03:14:34Z","git_url":"git://github.com/gtk-rs/gir.git","ssh_url":"git@github.com:gtk-rs/gir.git","clone_url":"https://github.com/gtk-rs/gir.git","svn_url":"https://github.com/gtk-rs/gir","homepage":null,"size":674,"stargazers_count":8,"watchers_count":8,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":17,"forks":4,"open_issues":17,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/229"},"html":{"href":"https://github.com/gtk-rs/gir/pull/229"},"issue":{"href":"https://api.github.com/repos/gtk-rs/gir/issues/229"},"comments":{"href":"https://api.github.com/repos/gtk-rs/gir/issues/229/comments"},"review_comments":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/229/comments"},"review_comment":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gtk-rs/gir/pulls/229/commits"},"statuses":{"href":"https://api.github.com/repos/gtk-rs/gir/statuses/6a7e820d0c2e6733075f7a3a9060cb3408ebbb4d"}}}}