~kroq-gar78/ubuntu/precise/gnome-control-center/fix-885947

« back to all changes in this revision

Viewing changes to panels/datetime/test-endianess.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Moya
  • Date: 2011-05-17 10:47:27 UTC
  • mfrom: (0.1.11 experimental) (1.1.45 upstream)
  • Revision ID: james.westby@ubuntu.com-20110517104727-lqel6m8vhfw5jby1
Tags: 1:3.0.1.1-1ubuntu1
* Rebase on Debian, remaining Ubuntu changes:
* debian/control:
  - Build-Depend on hardening-wrapper, dpkg-dev and dh-autoreconf
  - Add dependency on ubuntu-system-service
  - Remove dependency on gnome-icon-theme-symbolic
  - Move dependency on apg, gnome-icon-theme-symbolic and accountsservice to
    be a Recommends: until we get them in main
* debian/rules:
  - Use autoreconf
  - Add binary-post-install rule for gnome-control-center-data
  - Run dh-autoreconf
* debian/gnome-control-center.dirs:
* debian/gnome-control-center.links:
  - Add a link to the control center shell for indicators
* debian/patches/00_disable-nm.patch:
  - Temporary patch to disable building with NetworkManager until we get
    the new one in the archive
* debian/patches/01_git_remove_gettext_calls.patch:
  - Remove calls to AM_GNU_GETTEXT, IT_PROG_INTLTOOL should be enough
* debian/patches/01_git_kill_warning.patch:
  - Kill warning
* debian/patches/50_ubuntu_systemwide_prefs.patch:
  - Ubuntu specific proxy preferences
* debian/patches/51_ubuntu_system_keyboard.patch:
  - Implement the global keyboard spec at https://wiki.ubuntu.com/DefaultKeyboardSettings

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <glib.h>
 
2
#include <glib/gi18n.h>
 
3
#include <locale.h>
 
4
#include "date-endian.h"
 
5
 
 
6
static int verbose = 0;
 
7
 
 
8
static void
 
9
print_endianess (const char *lang)
 
10
{
 
11
        DateEndianess endianess;
 
12
 
 
13
        if (lang != NULL) {
 
14
                setlocale (LC_TIME, lang);
 
15
                endianess = date_endian_get_for_lang (lang, verbose);
 
16
        } else {
 
17
                endianess = date_endian_get_default (verbose);
 
18
        }
 
19
        if (verbose)
 
20
                g_print ("\t\t%s\n", date_endian_to_string (endianess));
 
21
}
 
22
 
 
23
int main (int argc, char **argv)
 
24
{
 
25
        GDir *dir;
 
26
        const char *name;
 
27
 
 
28
        setlocale (LC_ALL, "");
 
29
        bind_textdomain_codeset ("libc", "UTF-8");
 
30
 
 
31
        if (argv[1] != NULL) {
 
32
                verbose = 1;
 
33
 
 
34
                if (g_str_equal (argv[1], "-c"))
 
35
                        print_endianess (NULL);
 
36
                else
 
37
                        print_endianess (argv[1]);
 
38
                return 0;
 
39
        }
 
40
 
 
41
        dir = g_dir_open ("/usr/share/i18n/locales/", 0, NULL);
 
42
        if (dir == NULL) {
 
43
                /* Try with /usr/share/locale/
 
44
                 * https://bugzilla.gnome.org/show_bug.cgi?id=646780 */
 
45
                dir = g_dir_open ("/usr/share/locale/", 0, NULL);
 
46
                if (dir == NULL) {
 
47
                        return 1;
 
48
                }
 
49
        }
 
50
 
 
51
        while ((name = g_dir_read_name (dir)) != NULL)
 
52
                print_endianess (name);
 
53
 
 
54
        return 0;
 
55
}