author | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 15:50:57 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 15:50:57 (UTC) |
commit | a4d1ca1dc6ff8171694d9e2280b6075a1beced0c (patch) (unidiff) | |
tree | 8ccfdd78b7fe61a54bf09c11a130cfbfa8ed50c8 /ui-commit.c | |
parent | c5984a9896b39748e61daf6e620483749654b102 (diff) | |
download | cgit-a4d1ca1dc6ff8171694d9e2280b6075a1beced0c.zip cgit-a4d1ca1dc6ff8171694d9e2280b6075a1beced0c.tar.gz cgit-a4d1ca1dc6ff8171694d9e2280b6075a1beced0c.tar.bz2 |
Add ui-shared.h
This is finally a proper headerfile for the shared ui-functions which
used to reside in cgit.h
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-commit.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ui-commit.c b/ui-commit.c index ed25824..8019e36 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -1,74 +1,75 @@ | |||
1 | /* ui-commit.c: generate commit view | 1 | /* ui-commit.c: generate commit view |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | #include "html.h" | 10 | #include "html.h" |
11 | #include "ui-shared.h" | ||
11 | 12 | ||
12 | static int files, slots; | 13 | static int files, slots; |
13 | static int total_adds, total_rems, max_changes; | 14 | static int total_adds, total_rems, max_changes; |
14 | static int lines_added, lines_removed; | 15 | static int lines_added, lines_removed; |
15 | static char *curr_rev; | 16 | static char *curr_rev; |
16 | 17 | ||
17 | static struct fileinfo { | 18 | static struct fileinfo { |
18 | char status; | 19 | char status; |
19 | unsigned char old_sha1[20]; | 20 | unsigned char old_sha1[20]; |
20 | unsigned char new_sha1[20]; | 21 | unsigned char new_sha1[20]; |
21 | unsigned short old_mode; | 22 | unsigned short old_mode; |
22 | unsigned short new_mode; | 23 | unsigned short new_mode; |
23 | char *old_path; | 24 | char *old_path; |
24 | char *new_path; | 25 | char *new_path; |
25 | unsigned int added; | 26 | unsigned int added; |
26 | unsigned int removed; | 27 | unsigned int removed; |
27 | } *items; | 28 | } *items; |
28 | 29 | ||
29 | 30 | ||
30 | void print_fileinfo(struct fileinfo *info) | 31 | void print_fileinfo(struct fileinfo *info) |
31 | { | 32 | { |
32 | char *class; | 33 | char *class; |
33 | 34 | ||
34 | switch (info->status) { | 35 | switch (info->status) { |
35 | case DIFF_STATUS_ADDED: | 36 | case DIFF_STATUS_ADDED: |
36 | class = "add"; | 37 | class = "add"; |
37 | break; | 38 | break; |
38 | case DIFF_STATUS_COPIED: | 39 | case DIFF_STATUS_COPIED: |
39 | class = "cpy"; | 40 | class = "cpy"; |
40 | break; | 41 | break; |
41 | case DIFF_STATUS_DELETED: | 42 | case DIFF_STATUS_DELETED: |
42 | class = "del"; | 43 | class = "del"; |
43 | break; | 44 | break; |
44 | case DIFF_STATUS_MODIFIED: | 45 | case DIFF_STATUS_MODIFIED: |
45 | class = "upd"; | 46 | class = "upd"; |
46 | break; | 47 | break; |
47 | case DIFF_STATUS_RENAMED: | 48 | case DIFF_STATUS_RENAMED: |
48 | class = "mov"; | 49 | class = "mov"; |
49 | break; | 50 | break; |
50 | case DIFF_STATUS_TYPE_CHANGED: | 51 | case DIFF_STATUS_TYPE_CHANGED: |
51 | class = "typ"; | 52 | class = "typ"; |
52 | break; | 53 | break; |
53 | case DIFF_STATUS_UNKNOWN: | 54 | case DIFF_STATUS_UNKNOWN: |
54 | class = "unk"; | 55 | class = "unk"; |
55 | break; | 56 | break; |
56 | case DIFF_STATUS_UNMERGED: | 57 | case DIFF_STATUS_UNMERGED: |
57 | class = "stg"; | 58 | class = "stg"; |
58 | break; | 59 | break; |
59 | default: | 60 | default: |
60 | die("bug: unhandled diff status %c", info->status); | 61 | die("bug: unhandled diff status %c", info->status); |
61 | } | 62 | } |
62 | 63 | ||
63 | html("<tr>"); | 64 | html("<tr>"); |
64 | htmlf("<td class='mode'>"); | 65 | htmlf("<td class='mode'>"); |
65 | if (is_null_sha1(info->new_sha1)) { | 66 | if (is_null_sha1(info->new_sha1)) { |
66 | cgit_print_filemode(info->old_mode); | 67 | cgit_print_filemode(info->old_mode); |
67 | } else { | 68 | } else { |
68 | cgit_print_filemode(info->new_mode); | 69 | cgit_print_filemode(info->new_mode); |
69 | } | 70 | } |
70 | 71 | ||
71 | if (info->old_mode != info->new_mode && | 72 | if (info->old_mode != info->new_mode && |
72 | !is_null_sha1(info->old_sha1) && | 73 | !is_null_sha1(info->old_sha1) && |
73 | !is_null_sha1(info->new_sha1)) { | 74 | !is_null_sha1(info->new_sha1)) { |
74 | html("<span class='modechange'>["); | 75 | html("<span class='modechange'>["); |