2 * This file is part of hildon-libs
4 * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
6 * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; version 2.1 of
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 gcc `pkg-config --cflags gtk+-2.0 hildon-libs` `pkg-config --libs gtk+-2.0 hildon-libs` -o tc_banner_truncate tc_banner_truncate.c && DISPLAY=:2 run-standalone.sh ./tc_banner_truncate 1
29 Usage 1: tc_banner_truncate <case #>
30 Usage 2: tc_banner_truncate <1|2|3> the string you like to be displayed
31 1 -> information banner
38 #include <hildon-widgets/hildon-banner.h>
40 #define WAIT g_timeout_add(3000, (GSourceFunc)(gtk_main_quit), NULL);
42 #define TC_INFO(string) hildon_banner_show_information(window, NULL, string); WAIT;
43 #define TC_ANIM(string) banner = hildon_banner_show_animation(NULL, NULL, string);
44 #define TC_PROG(string) banner = hildon_banner_show_progress (NULL, NULL, string);
46 static void get_argv_string(int argc, char ** argv, char *text);
48 int main(int argc, char **argv)
55 if(argc < 2){ fprintf(stderr, "Add case # as parameter.\n"); return 1;}
56 if(argc >= 2){ if(sscanf(argv[1], "%d", &n) == 0) n = 1;}
57 if(argc > 2){ get_argv_string(argc, argv, text);}
59 gtk_init(&argc, &argv);
61 window = gtk_dialog_new();
64 /* text is given in the command line */
66 case 1: TC_INFO(text); break;
67 case 2: TC_PROG(text); break;
68 case 3: TC_ANIM(text); break;
69 default:TC_INFO(text); break;
75 /* NOTE: comments (*) are given for 0.12.12, with default theme (orange)
76 * (*) "truncated", WRAPPED", etc.
79 case 0: TC_INFO(""); break;
80 case 1: TC_INFO("loading..."); break;
82 case 11: TC_INFO("mmmmmmmmmmmmmmmmmm m.." ); break; //1 line
83 case 12: TC_INFO("mmmmmmmmmmmmmmmmmm m..." ); break; //truncated
84 case 13: TC_INFO("mmmmmmmmmmmmmmmmmm m...." ); break; //truncated
85 case 14: TC_INFO("mmmmmmmmmmmmmmmmmm m....." ); break; //truncated
86 case 15: TC_INFO("mmmmmmmmmmmmmmmmmm m......" ); break; //truncated
87 case 16: TC_INFO("mmmmmmmmmmmmmmmmmm m......." ); break; //truncated
88 case 17: TC_INFO("mmmmmmmmmmmmmmmmmm m........" ); break; //truncated
89 case 18: TC_INFO("mmmmmmmmmmmmmmmmmm m........."); break; //WRAPPED
91 case 21: TC_INFO("maximum number of characters xxxxxxxx"); break; //WRAPPED
92 case 22: TC_INFO("maximum number of characters xxxxxxxi"); break; //truncated
94 case 23: TC_INFO("Maximum number of characters reache" ); break; //1 line
95 case 24: TC_INFO("Maximum number of characters reached" ); break; //truncated
96 case 25: TC_INFO("Maximum number of characters reached." ); break; //truncated
97 case 26: TC_INFO("Maximum number of characters reached " ); break; //truncated
98 case 27: TC_INFO("Maximum number of characters reached a"); break; //WRAPPED
100 /* progress banners */
101 case 101: TC_PROG("" ); break;
102 case 102: TC_PROG("hello" ); break;
103 case 103: TC_PROG("hello progress" ); break;
105 /* Bugzilla related TC */
106 case -1: case 25305: TC_INFO("Maximum number of characters reached"); break;
107 case -2: case 23430: TC_INFO("Unable to manage folders during searching"); break; //PASSED
108 case -3: case 26624: TC_ANIM("Connection Manager - Loading"); break;
109 case -4: case 26161: TC_ANIM("Painel de Controle - carregando"); break;
110 case -5: case 26203: TC_ANIM("Caricamento di Pannello di controllo"); break;
111 case -6: case 27875: TC_ANIM("Instant messaging - loading"); break;
112 case -7: case 28760: TC_ANIM("Teach Handwriting- Loading"); break;
114 /* word longer than max width */
115 case 201: TC_INFO("mmmmmmmmmmmmmmmmmmmmmmmmmmmmm 1 2 3 4"); break;
118 case 202: TC_INFO("Maximum number of characters reached osaidfh galds hgdslf helius grkdsz vfliesdfrjaesfrszri os o ozx oyli l ilij ero worjw aeowaijf osijf a jfaowijef aoweijf s faoij flsaijf sajfd oaijfe aosi e 1 2 3 4"); break; /* TRUNCATED after last 'e' */
121 /* TC for plain GTK (no theme) */
122 case -1031: TC_INFO("iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiil i."); break; //1 line
123 case -1032: TC_INFO("iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiil i."); break; //WRAPPED
125 case -1033: TC_INFO("mmmmmmmmmmmmmmmmmm m................................................i" ); break; //1 line
126 case -1034: TC_INFO("mmmmmmmmmmmmmmmmmm m.................................................i"); break; //WRAPPED
144 /* ############################################################################## */
145 /* ############################################################################## */
146 /* ############################################################################## */
148 static void get_argv_string(int argc, char ** argv, char *text){
152 for(i=2; i<argc; i++){
153 for(j=0; argv[i][j] != '\0'; j++){