To implement a "Facebook" like quiz using GTK at frontend and MYSQL database at backend. More...
#include <glib.h>
#include <gtk/gtk.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <mysql/mysql.h>
Go to the source code of this file.
Functions | |
void | create_database () |
create_database creates database. | |
void | display_row () |
display_row used to retreive data from database. | |
static gboolean | close_application (GtkWidget *widget, GdkEvent *event, gpointer data) |
void | answer_hb (GtkWidget *widget1, gpointer data) |
answer_hb calculates percentage of marks after calculating correct answers. | |
void | callback_hb (GtkWidget *widget, gpointer data) |
void | callback_hb1 (GtkWidget *widget, gpointer data) |
void | callback_hb2 (GtkWidget *widget, gpointer data) |
void | callback_hb3 (GtkWidget *widget, gpointer data) |
void | callback_hb4 (GtkWidget *widget, gpointer data) |
void | callback_hb5 (GtkWidget *widget, gpointer data) |
void | callback_hb6 (GtkWidget *widget, gpointer data) |
void | callback_hb7 (GtkWidget *widget, gpointer data) |
void | callback_hb8 (GtkWidget *widget, gpointer data) |
void | callback_hb9 (GtkWidget *widget, gpointer data) |
void | destroy (GtkWidget *widget, gpointer data) |
void | create_human () |
create_human creates the human body quiz. | |
void | answer_comp (GtkWidget *widget1, gpointer data) |
answer_comp calculates percentage of marks after calculating correct answers. | |
void | callback_comp (GtkWidget *widget, gpointer data) |
void | callback_comp1 (GtkWidget *widget, gpointer data) |
void | callback_comp2 (GtkWidget *widget, gpointer data) |
void | callback_comp3 (GtkWidget *widget, gpointer data) |
void | callback_comp4 (GtkWidget *widget, gpointer data) |
void | callback_comp5 (GtkWidget *widget, gpointer data) |
void | callback_comp6 (GtkWidget *widget, gpointer data) |
void | callback_comp7 (GtkWidget *widget, gpointer data) |
void | callback_comp8 (GtkWidget *widget, gpointer data) |
void | callback_comp9 (GtkWidget *widget, gpointer data) |
void | create_computer () |
create_computer creates the computer quiz. | |
void | callback_gen (GtkWidget *widget1, gpointer data) |
callback_gen handles the radio buttons. | |
void | answer_gen (GtkWidget *widget, gpointer data) |
answer_gen redirects user to the selected quiz after clicking. | |
void | create_general () |
create_general creates the general knowledge quiz page. | |
void | answer_toon (GtkWidget *widget1, gpointer data) |
answer_toon calculates percentage of marks after calculating correct answers. | |
void | callback_toon (GtkWidget *widget, gpointer data) |
void | callback_toon1 (GtkWidget *widget, gpointer data) |
void | callback_toon2 (GtkWidget *widget, gpointer data) |
void | callback_toon3 (GtkWidget *widget, gpointer data) |
void | callback_toon4 (GtkWidget *widget, gpointer data) |
void | callback_toon5 (GtkWidget *widget, gpointer data) |
void | callback_toon6 (GtkWidget *widget, gpointer data) |
void | callback_toon7 (GtkWidget *widget, gpointer data) |
void | callback_toon8 (GtkWidget *widget, gpointer data) |
void | callback_toon9 (GtkWidget *widget, gpointer data) |
void | create_cartoon () |
create_cartoon creates the cartoon quiz. | |
void | answer_epic (GtkWidget *widget1, gpointer data) |
answer_epic calculates percentage of marks after calculating correct answers. | |
void | callback_epic (GtkWidget *widget, gpointer data) |
void | callback_epic1 (GtkWidget *widget, gpointer data) |
void | callback_epic2 (GtkWidget *widget, gpointer data) |
void | callback_epic3 (GtkWidget *widget, gpointer data) |
void | callback_epic4 (GtkWidget *widget, gpointer data) |
void | callback_epic5 (GtkWidget *widget, gpointer data) |
void | callback_epic6 (GtkWidget *widget, gpointer data) |
void | callback_epic7 (GtkWidget *widget, gpointer data) |
void | callback_epic8 (GtkWidget *widget, gpointer data) |
void | callback_epic9 (GtkWidget *widget, gpointer data) |
void | create_epic () |
create_epic creates the epic quiz. | |
void | answer_com (GtkWidget *widget1, gpointer data) |
answer_com calculates percentage of marks after calculating correct answers. | |
void | callback_com (GtkWidget *widget, gpointer data) |
void | callback_com1 (GtkWidget *widget, gpointer data) |
void | callback_com2 (GtkWidget *widget, gpointer data) |
void | callback_com3 (GtkWidget *widget, gpointer data) |
void | callback_com4 (GtkWidget *widget, gpointer data) |
void | callback_com5 (GtkWidget *widget, gpointer data) |
void | callback_com6 (GtkWidget *widget, gpointer data) |
void | callback_com7 (GtkWidget *widget, gpointer data) |
void | callback_com8 (GtkWidget *widget, gpointer data) |
void | callback_com9 (GtkWidget *widget, gpointer data) |
void | create_comedy () |
create_comedy creates the comedy quiz. | |
void | answer_m (GtkWidget *widget1, gpointer data) |
answer_m redirects user to the selected quiz after clicking. | |
void | callback_m (GtkWidget *widget, gpointer data) |
callback_m handles the radio buttons. | |
void | create_movie () |
create_movie creates the movie quiz. | |
void | answer_crick (GtkWidget *widget1, gpointer data) |
answer_crick calculates percentage of marks after calculating correct answers. | |
void | callback_crick (GtkWidget *widget, gpointer data) |
void | callback_crick1 (GtkWidget *widget, gpointer data) |
void | callback_crick2 (GtkWidget *widget, gpointer data) |
void | callback_crick3 (GtkWidget *widget, gpointer data) |
void | callback_crick4 (GtkWidget *widget, gpointer data) |
void | callback_crick5 (GtkWidget *widget, gpointer data) |
void | callback_crick6 (GtkWidget *widget, gpointer data) |
void | callback_crick7 (GtkWidget *widget, gpointer data) |
void | callback_crick8 (GtkWidget *widget, gpointer data) |
void | callback_crick9 (GtkWidget *widget, gpointer data) |
void | create_cricket () |
create_cricket creates the cricket quiz. | |
void | callback_sport (GtkWidget *widget, gpointer data) |
callback_sport redirects user to the cricket quiz he selected after clicking. | |
void | answer_sport (GtkWidget *widget1, gpointer data) |
answer_sport handles the radio button cricket. | |
void | create_sports () |
create_main creates the main page of sports category. | |
void | callback_cat (GtkWidget *widget1, gpointer data) |
callback_cat handles radio button in quiz category page. | |
void | answer_cat (GtkWidget *widget, gpointer data) |
answer_cat redirects user to the quiz category he selected after clicking. | |
void | create_main () |
create_main creates the main page of quiz category. | |
static void | callback_reg (GtkWidget *widget, gpointer data) |
callback_reg used to store user's details in database. | |
static gboolean | delete_event_reg (GtkWidget *widget, GdkEvent *event, gpointer data) |
gboolean | delete_cancel (GtkWidget *widget, gpointer data) |
static void | enter_callback_register (GtkWidget *widget, GtkWidget *entry) |
enter_callback_register is for text entry in text area in register page. | |
static void | callback_clear (GtkWidget *widget, GtkWidget *entry) |
callback_clear clears everything to blank in register page. | |
void | create_register () |
create_register creates a register page for new user to register. | |
static void | callback_login (GtkWidget *widget, gpointer data) |
This is called when button is clicked to login to play quiz. | |
static void | callback_register (GtkWidget *widget, gpointer data) |
static gboolean | delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) |
It is called when user tries to close window using window manager. | |
static void | enter_callback (GtkWidget *widget, GtkWidget *entry) |
int | main (int argc, char *argv[]) |
This is where program execution starts. | |
Variables | |
MYSQL * | connection1 |
MYSQL * | connection2 |
MYSQL_RES * | result |
MYSQL_ROW | sqlrow |
int | cnt = 0 |
char | user [100] |
char | ans [100] |
char | subans [100] |
char | n [10] |
char | r [100] |
char | r5 [100] |
char | u [100] |
char | p [100] |
GtkWidget * | window |
GtkWidget * | button |
GtkWidget * | table |
GtkWidget * | entry |
GtkWidget * | entry_username |
GtkWidget * | entry_password |
GtkWidget * | label |
GtkWidget * | check |
GtkWidget * | entry_name |
GtkWidget * | entry_roll |
GtkWidget * | entry_usernamer |
GtkWidget * | entry_passwordr |
int | flag_gk = 0 |
char | option_hb [50] |
char | option_hb1 [50] |
char | option_hb2 [50] |
char | option_hb3 [50] |
char | option_hb4 [50] |
char | option_hb5 [50] |
char | option_hb6 [50] |
char | option_hb7 [50] |
char | option_hb8 [50] |
char | option_hb9 [50] |
char | option_comp [50] |
char | option_comp1 [50] |
char | option_comp2 [50] |
char | option_comp3 [50] |
char | option_comp4 [50] |
char | option_comp5 [50] |
char | option_comp6 [50] |
char | option_comp7 [50] |
char | option_comp8 [50] |
char | option_comp9 [50] |
int | flag_cat = 0 |
char | option_gen [50] |
int | flag_toon = 0 |
char | option_toon [50] |
char | option_toon1 [50] |
char | option_toon2 [50] |
char | option_toon3 [50] |
char | option_toon4 [50] |
char | option_toon5 [50] |
char | option_toon6 [50] |
char | option_toon7 [50] |
char | option_toon8 [50] |
char | option_toon9 [50] |
char | option_epic [50] |
char | option_epic1 [50] |
char | option_epic2 [50] |
char | option_epic3 [50] |
char | option_epic4 [50] |
char | option_epic5 [50] |
char | option_epic6 [50] |
char | option_epic7 [50] |
char | option_epic8 [50] |
char | option_epic9 [50] |
char | option_com [50] |
char | option_com1 [50] |
char | option_com2 [50] |
char | option_com3 [50] |
char | option_com4 [50] |
char | option_com5 [50] |
char | option_com6 [50] |
char | option_com7 [50] |
char | option_com8 [50] |
char | option_com9 [50] |
char | option_m [50] |
int | flag_sport = 0 |
char | option_crick [50] |
char | option_crick1 [50] |
char | option_crick2 [50] |
char | option_crick3 [50] |
char | option_crick4 [50] |
char | option_crick5 [50] |
char | option_crick6 [50] |
char | option_crick7 [50] |
char | option_crick8 [50] |
char | option_crick9 [50] |
char | option_sport [50] |
char | option_cat [50] |
To implement a "Facebook" like quiz using GTK at frontend and MYSQL database at backend.
Definition in file quiz.c.
void answer_cat | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
answer_cat redirects user to the quiz category he selected after clicking.
of enter button in quiz category page.
widget | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 3817 of file quiz.c.
References create_general(), create_movie(), create_sports(), and flag_cat.
Referenced by create_main().
03818 { 03819 if(flag_cat==0) 03820 create_general(); 03821 if(flag_cat==1) 03822 create_movie(); 03823 if(flag_cat==2) 03824 create_sports(); 03825 }
void answer_com | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_com calculates percentage of marks after calculating correct answers.
and after playing comedy quiz.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 2440 of file quiz.c.
References ans, connection1, display_row(), option_com, option_com1, option_com2, option_com3, option_com4, option_com5, option_com6, option_com7, option_com8, option_com9, r5, result, sqlrow, subans, and user.
Referenced by create_comedy().
02441 { 02442 int i=0, a; 02443 02444 GtkWidget *dialog; 02445 02446 if(strcmp(option_com, "Drew Barrymore")==0) 02447 { 02448 i++; 02449 } 02450 02451 if(strcmp(option_com1, "Sea Life Park")==0) 02452 { 02453 i++; 02454 } 02455 02456 if(strcmp(option_com2, "Basketball")==0) 02457 { 02458 i++; 02459 } 02460 02461 if(strcmp(option_com3, "1989")==0) 02462 { 02463 i++; 02464 } 02465 02466 if(strcmp(option_com4, "Bridesmaid Dresses")==0) 02467 { 02468 i++; 02469 } 02470 02471 if(strcmp(option_com5, "Boat Club House")==0) 02472 { 02473 i++; 02474 } 02475 02476 if(strcmp(option_com6, "Seth and Evan")==0) 02477 { 02478 i++; 02479 } 02480 02481 if(strcmp(option_com7, "Two")==0) 02482 { 02483 i++; 02484 } 02485 02486 if(strcmp(option_com8, "Scotty Doesn't Know")==0) 02487 { 02488 i++; 02489 } 02490 02491 if(strcmp(option_com9, "Southampton")==0) 02492 { 02493 i++; 02494 } 02495 02496 if(i==0) 02497 a=0; 02498 02499 if(i==1) 02500 a=10; 02501 02502 if(i==2) 02503 a=20; 02504 02505 if(i==3) 02506 a=30; 02507 02508 if(i==4) 02509 a=40; 02510 02511 if(i==5) 02512 a=50; 02513 02514 if(i==6) 02515 a=60; 02516 02517 if(i==7) 02518 a=70; 02519 02520 if(i==8) 02521 a=80; 02522 02523 if(i==9) 02524 a=90; 02525 02526 if(i==10) 02527 a=100; 02528 02529 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Username --> %s Category --> %s Movie --> %s Score --> %d percent",user,ans,subans,a); 02530 gtk_dialog_run (GTK_DIALOG (dialog)); 02531 02532 int return_value; 02533 char qry[100],qry1[100],l1[50],l2[50]; 02534 sprintf(qry,"select * from quiz where roll_number='%s'",r5); 02535 02536 return_value=mysql_query(connection1,qry); 02537 if(return_value) 02538 { 02539 printf("Select command failed"); 02540 } 02541 else 02542 { 02543 02544 result=mysql_use_result(connection1); 02545 if(result) 02546 { 02547 while((sqlrow=mysql_fetch_row(result))) 02548 { 02549 display_row(); 02550 strcpy(l1,sqlrow[4]); 02551 strcpy(l2,sqlrow[5]); 02552 02553 if(strcmp(l1,"empty")==0 && strcmp(l2,"empty")==0) 02554 { 02555 sprintf(qry1,"update quiz set level1='%s',level2='%s',score=%d where roll_number='%s'",ans,subans,a,r5); 02556 } 02557 else if(strcmp(l1,"Movie")==0 && strcmp(l2,"Comedy")==0) 02558 { 02559 sprintf(qry1,"update quiz set score=%d where roll_number='%s'",a,r5); 02560 } 02561 } 02562 02563 } 02564 mysql_free_result(result); 02565 } 02566 02567 int re=0; 02568 re=mysql_query(connection1,qry1); 02569 if(re==0) 02570 printf("Update succeded!!"); 02571 02572 if(return_value) 02573 g_print("Update Failed"); 02574 gtk_widget_destroy (dialog); 02575 }
void answer_comp | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_comp calculates percentage of marks after calculating correct answers.
and after playing computer quiz.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 684 of file quiz.c.
References ans, connection1, display_row(), option_comp, option_comp1, option_comp2, option_comp3, option_comp4, option_comp5, option_comp6, option_comp7, option_comp8, option_comp9, r5, result, sqlrow, subans, and user.
Referenced by create_computer().
00685 { 00686 int i=0, a; 00687 00688 GtkWidget *dialog; 00689 00690 if(strcmp(option_comp, "8")==0) 00691 { 00692 i++; 00693 } 00694 00695 if(strcmp(option_comp1, "binary")==0) 00696 { 00697 i++; 00698 } 00699 00700 if(strcmp(option_comp2, "Random Access Memory")==0) 00701 { 00702 i++; 00703 } 00704 00705 if(strcmp(option_comp3, "Read Only Memory")==0) 00706 { 00707 i++; 00708 } 00709 00710 if(strcmp(option_comp4, "Turing")==0) 00711 { 00712 i++; 00713 } 00714 00715 if(strcmp(option_comp5, "World Wide Web")==0) 00716 { 00717 i++; 00718 } 00719 00720 if(strcmp(option_comp6, "STP")==0) 00721 { 00722 i++; 00723 } 00724 00725 if(strcmp(option_comp7, "BRAINIAC")==0) 00726 { 00727 i++; 00728 } 00729 00730 if(strcmp(option_comp8, "RAM")==0) 00731 { 00732 i++; 00733 } 00734 00735 if(strcmp(option_comp9, "1971")==0) 00736 { 00737 i++; 00738 } 00739 00740 if(i==0) 00741 a=0; 00742 00743 if(i==1) 00744 a=10; 00745 00746 if(i==2) 00747 a=20; 00748 00749 if(i==3) 00750 a=30; 00751 00752 if(i==4) 00753 a=40; 00754 00755 if(i==5) 00756 a=50; 00757 00758 if(i==6) 00759 a=60; 00760 00761 if(i==7) 00762 a=70; 00763 00764 if(i==8) 00765 a=80; 00766 00767 if(i==9) 00768 a=90; 00769 00770 if(i==10) 00771 a=100; 00772 00773 00774 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Username --> %s Category --> %s Type --> %s Score --> %d percent",user,ans,subans,a); 00775 gtk_dialog_run (GTK_DIALOG (dialog)); 00776 00777 int return_value; 00778 char qry[100],qry1[100],l1[50],l2[50]; 00779 00780 sprintf(qry,"select * from quiz where roll_number='%s'",r5); 00781 00782 return_value=mysql_query(connection1,qry); 00783 if(return_value) 00784 { 00785 printf("Select command failed"); 00786 } 00787 else 00788 { 00789 result=mysql_use_result(connection1); 00790 if(result) 00791 { 00792 while((sqlrow=mysql_fetch_row(result))) 00793 { 00794 display_row(); 00795 strcpy(l1,sqlrow[4]); 00796 strcpy(l2,sqlrow[5]); 00797 00798 if(strcmp(l1,"empty")==0 && strcmp(l2,"empty")==0) 00799 { 00800 sprintf(qry1,"update quiz set level1='%s',level2='%s',score=%d where roll_number='%s'",ans,subans,a,r5); 00801 00802 } 00803 else if(strcmp(l1,"General Knowledge")==0 && strcmp(l2,"Computers")==0) 00804 { 00805 sprintf(qry1,"update quiz set score=%d where roll_number='%s'",a,r5); 00806 } 00807 } 00808 00809 } 00810 mysql_free_result(result); 00811 } 00812 00813 int re=0; 00814 re=mysql_query(connection1,qry1); 00815 if(re==0) 00816 printf("Update succeded!!"); 00817 00818 //return_value=mysql_query(connection1,qry1); 00819 if(return_value) 00820 g_print("Update Failed"); 00821 00822 /*End of code*/ 00823 gtk_widget_destroy (dialog); 00824 }
void answer_crick | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_crick calculates percentage of marks after calculating correct answers.
after playing cricket quiz.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 3129 of file quiz.c.
References ans, connection1, display_row(), option_crick, option_crick1, option_crick2, option_crick3, option_crick4, option_crick5, option_crick6, option_crick7, option_crick8, option_crick9, r5, result, sqlrow, subans, and user.
Referenced by create_cricket().
03130 { 03131 int i=0, a; 03132 03133 GtkWidget *dialog; 03134 03135 if(strcmp(option_crick, "Yuvraj")==0) 03136 { 03137 i++; 03138 } 03139 03140 if(strcmp(option_crick1, "Pakistan")==0) 03141 { 03142 i++; 03143 } 03144 03145 if(strcmp(option_crick2, "1988-89")==0) 03146 { 03147 i++; 03148 } 03149 03150 if(strcmp(option_crick3, "Sehwag")==0) 03151 { 03152 i++; 03153 } 03154 03155 if(strcmp(option_crick4, "Adam Gilchrist")==0) 03156 { 03157 i++; 03158 } 03159 03160 if(strcmp(option_crick5, "Brett Lee")==0) 03161 { 03162 i++; 03163 } 03164 03165 if(strcmp(option_crick6, "Mumbai")==0) 03166 { 03167 i++; 03168 } 03169 03170 if(strcmp(option_crick7, "Shilpa")==0) 03171 { 03172 i++; 03173 } 03174 03175 if(strcmp(option_crick8, "1935")==0) 03176 { 03177 i++; 03178 } 03179 03180 if(strcmp(option_crick9, "Anil")==0) 03181 { 03182 i++; 03183 } 03184 03185 03186 03187 03188 03189 if(i==0) 03190 a=0; 03191 03192 if(i==1) 03193 a=10; 03194 03195 if(i==2) 03196 a=20; 03197 03198 if(i==3) 03199 a=30; 03200 03201 if(i==4) 03202 a=40; 03203 03204 if(i==5) 03205 a=50; 03206 03207 if(i==6) 03208 a=60; 03209 03210 if(i==7) 03211 a=70; 03212 03213 if(i==8) 03214 a=80; 03215 03216 if(i==9) 03217 a=90; 03218 03219 if(i==10) 03220 a=100; 03221 03222 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Username --> %s Category --> %s Game --> %s Score --> %d percent",user,ans,subans,a); 03223 03224 gtk_dialog_run (GTK_DIALOG (dialog)); 03225 03226 int return_value; 03227 char qry[100],qry1[100],l1[50],l2[50]; 03228 03229 sprintf(qry,"select * from quiz where roll_number='%s'",r5); 03230 03231 return_value=mysql_query(connection1,qry); 03232 if(return_value) 03233 { 03234 printf("Select command failed"); 03235 } 03236 else 03237 { 03238 result=mysql_use_result(connection1); 03239 if(result) 03240 { 03241 while((sqlrow=mysql_fetch_row(result))) 03242 { 03243 display_row(); 03244 strcpy(l1,sqlrow[4]); 03245 strcpy(l2,sqlrow[5]); 03246 03247 if(strcmp(l1,"empty")==0 && strcmp(l2,"empty")==0) 03248 { 03249 sprintf(qry1,"update quiz set level1='%s',level2='%s',score=%d where roll_number='%s'",ans,subans,a,r5); 03250 } 03251 else if(strcmp(l1,"Sports")==0 && strcmp(l2,"Cricket")==0) 03252 { 03253 sprintf(qry1,"update quiz set score=%d where roll_number='%s'",a,r5); 03254 } 03255 } 03256 03257 } 03258 mysql_free_result(result); 03259 } 03260 03261 int re=0; 03262 re=mysql_query(connection1,qry1); 03263 if(re==0) 03264 printf("Update succeded!!"); 03265 03266 if(return_value) 03267 g_print("Update Failed"); 03268 03269 03270 gtk_widget_destroy (dialog); 03271 }
void answer_epic | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_epic calculates percentage of marks after calculating correct answers.
and after playing epic quiz.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 1901 of file quiz.c.
References ans, connection1, display_row(), option_epic, option_epic1, option_epic2, option_epic3, option_epic4, option_epic5, option_epic6, option_epic7, option_epic8, option_epic9, r5, result, sqlrow, subans, and user.
Referenced by create_epic().
01902 { 01903 int i=0, a; 01904 01905 GtkWidget *dialog; 01906 01907 if(strcmp(option_epic, "Johnny Depp")==0) 01908 { 01909 i++; 01910 } 01911 01912 if(strcmp(option_epic1, "Captain Barbossa")==0) 01913 { 01914 i++; 01915 } 01916 01917 if(strcmp(option_epic2, "Hobbits")==0) 01918 { 01919 i++; 01920 } 01921 01922 if(strcmp(option_epic3, "Gollum")==0) 01923 { 01924 i++; 01925 } 01926 01927 if(strcmp(option_epic4, "Gryffindor")==0) 01928 { 01929 i++; 01930 } 01931 01932 if(strcmp(option_epic5, "Cho Chang")==0) 01933 { 01934 i++; 01935 } 01936 01937 if(strcmp(option_epic6, "To study the Avatars!")==0) 01938 { 01939 i++; 01940 } 01941 01942 if(strcmp(option_epic7, "Neytiri")==0) 01943 { 01944 i++; 01945 } 01946 01947 if(strcmp(option_epic8, "Salt mine")==0) 01948 { 01949 i++; 01950 } 01951 01952 if(strcmp(option_epic9, "SPQR")==0) 01953 { 01954 i++; 01955 } 01956 01957 if(i==0) 01958 a=0; 01959 01960 if(i==1) 01961 a=10; 01962 01963 if(i==2) 01964 a=20; 01965 01966 if(i==3) 01967 a=30; 01968 01969 if(i==4) 01970 a=40; 01971 01972 if(i==5) 01973 a=50; 01974 01975 if(i==6) 01976 a=60; 01977 01978 if(i==7) 01979 a=70; 01980 01981 if(i==8) 01982 a=80; 01983 01984 if(i==9) 01985 a=90; 01986 01987 if(i==10) 01988 a=100; 01989 01990 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Username --> %s Category --> %s Movie --> %s Score --> %d percent",user,ans,subans,a); 01991 gtk_dialog_run (GTK_DIALOG (dialog)); 01992 01993 int return_value; 01994 char qry[100],qry1[100],l1[50],l2[50]; 01995 01996 sprintf(qry,"select * from quiz where roll_number='%s'",r5); 01997 01998 return_value=mysql_query(connection1,qry); 01999 if(return_value) 02000 { 02001 printf("Select command failed"); 02002 } 02003 else 02004 { 02005 result=mysql_use_result(connection1); 02006 if(result) 02007 { 02008 while((sqlrow=mysql_fetch_row(result))) 02009 { 02010 display_row(); 02011 strcpy(l1,sqlrow[4]); 02012 strcpy(l2,sqlrow[5]); 02013 02014 if(strcmp(l1,"empty")==0 && strcmp(l2,"empty")==0) 02015 { 02016 sprintf(qry1,"update quiz set level1='%s',level2='%s',score=%d where roll_number='%s'",ans,subans,a,r5); 02017 } 02018 else if(strcmp(l1,"Movies")==0 && strcmp(l2,"Epic")==0) 02019 { 02020 sprintf(qry1,"update quiz set score=%d where roll_number='%s'",a,r5); 02021 } 02022 } 02023 02024 } 02025 mysql_free_result(result); 02026 } 02027 02028 02029 int re=0; 02030 re=mysql_query(connection1,qry1); 02031 if(re==0) 02032 printf("Update succeded!!"); 02033 02034 if(return_value) 02035 g_print("Update Failed"); 02036 02037 02038 gtk_widget_destroy (dialog); 02039 }
void answer_gen | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
answer_gen redirects user to the selected quiz after clicking.
of enter button in general knowledge category page.
widget | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 1243 of file quiz.c.
References create_computer(), create_human(), flag_gk, and subans.
Referenced by create_general().
01244 { 01245 if(flag_gk==0) 01246 { 01247 strcpy(subans,"Human Body"); 01248 printf("%s\n",subans); 01249 create_human(); 01250 } 01251 01252 if(flag_gk==1) 01253 { 01254 strcpy(subans,"Computers"); 01255 printf("%s\n",subans); 01256 create_computer(); 01257 } 01258 }
void answer_hb | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_hb calculates percentage of marks after calculating correct answers.
and after playing human body quiz.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 137 of file quiz.c.
References ans, connection1, display_row(), option_hb, option_hb1, option_hb2, option_hb3, option_hb4, option_hb5, option_hb6, option_hb7, option_hb8, option_hb9, r5, result, sqlrow, subans, and user.
Referenced by create_human().
00138 { 00139 int i=0, a; 00140 00141 GtkWidget *dialog; 00142 00143 if(strcmp(option_hb, "skin")==0) 00144 { 00145 i++; 00146 } 00147 00148 if(strcmp(option_hb1, "206")==0) 00149 { 00150 i++; 00151 } 00152 00153 if(strcmp(option_hb2, "pressure")==0) 00154 { 00155 i++; 00156 } 00157 00158 if(strcmp(option_hb3, "protection")==0) 00159 { 00160 i++; 00161 } 00162 00163 if(strcmp(option_hb4, "wrist")==0) 00164 { 00165 i++; 00166 } 00167 00168 if(strcmp(option_hb5, "mouth")==0) 00169 { 00170 i++; 00171 } 00172 00173 if(strcmp(option_hb6, "12-20")==0) 00174 { 00175 i++; 00176 } 00177 00178 if(strcmp(option_hb7, "10,000")==0) 00179 { 00180 i++; 00181 } 00182 00183 if(strcmp(option_hb8, "tongue")==0) 00184 { 00185 i++; 00186 } 00187 00188 if(strcmp(option_hb9, "middle")==0) 00189 { 00190 i++; 00191 } 00192 00193 00194 if(i==0) 00195 a=0; 00196 00197 if(i==1) 00198 a=10; 00199 00200 if(i==2) 00201 a=20; 00202 00203 if(i==3) 00204 a=30; 00205 00206 if(i==4) 00207 a=40; 00208 00209 if(i==5) 00210 a=50; 00211 00212 if(i==6) 00213 a=60; 00214 00215 if(i==7) 00216 a=70; 00217 00218 if(i==8) 00219 a=80; 00220 00221 if(i==9) 00222 a=90; 00223 00224 if(i==10) 00225 a=100; 00226 00227 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Username --> %s Category --> %s Type --> %s Score --> %d percent",user,ans,subans,a); 00228 gtk_dialog_run (GTK_DIALOG (dialog)); 00229 int return_value; 00230 char qry[100],qry1[100],l1[50],l2[50]; 00231 00232 00233 00234 00235 sprintf(qry,"select * from quiz where roll_number='%s'",r5); 00236 00237 return_value=mysql_query(connection1,qry); 00238 if(return_value) 00239 { 00240 printf("Select command failed"); 00241 } 00242 else 00243 { 00244 00245 result=mysql_use_result(connection1); 00246 if(result) 00247 { 00248 while((sqlrow=mysql_fetch_row(result))) 00249 { 00250 display_row(); 00251 strcpy(l1,sqlrow[4]); 00252 strcpy(l2,sqlrow[5]); 00253 00254 if(strcmp(l1,"empty")==0 && strcmp(l2,"empty")==0) 00255 { 00256 sprintf(qry1,"update quiz set level1='%s',level2='%s',score=%d where roll_number='%s'",ans,subans,a,r5); 00257 00258 } 00259 else if(strcmp(l1,"General Knowledge")==0 && strcmp(l2,"Human Body")==0) 00260 { 00261 sprintf(qry1,"update quiz set score=%d where roll_number='%s'",a,r5); 00262 } 00263 } 00264 00265 } 00266 mysql_free_result(result); 00267 } 00268 00269 00270 int re=0; 00271 re=mysql_query(connection1,qry1); 00272 if(re==0) 00273 printf("Update succeded!!"); 00274 00275 00276 if(return_value) 00277 g_print("Update Failed"); 00278 00279 00280 gtk_widget_destroy (dialog); 00281 00282 }
void answer_m | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_m redirects user to the selected quiz after clicking.
of enter button in movie category page.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 2974 of file quiz.c.
References create_cartoon(), create_comedy(), create_epic(), flag_toon, and subans.
Referenced by create_movie().
02975 { 02976 if(flag_toon==0) 02977 { 02978 strcpy(subans,"Cartoons"); 02979 printf("%s\n",subans); 02980 create_cartoon(); 02981 02982 } 02983 02984 if(flag_toon==1) 02985 { 02986 strcpy(subans,"Epic"); 02987 printf("%s\n",subans); 02988 create_epic(); 02989 02990 } 02991 02992 if(flag_toon==2) 02993 { 02994 strcpy(subans,"Comedy"); 02995 printf("%s\n",subans); 02996 create_comedy(); 02997 02998 } 02999 03000 03001 }
void answer_sport | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_sport handles the radio button cricket.
in sports category page.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 3693 of file quiz.c.
References flag_sport.
Referenced by create_sports().
03694 { 03695 char temp_sport[50]; 03696 strcpy(temp_sport,(char *)data); 03697 if(strcmp(temp_sport,"Cricket")==0) 03698 flag_sport=0; 03699 03700 }
void answer_toon | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
answer_toon calculates percentage of marks after calculating correct answers.
and after playing cartoon quiz.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 1352 of file quiz.c.
References ans, connection1, display_row(), option_toon, option_toon1, option_toon2, option_toon3, option_toon4, option_toon5, option_toon6, option_toon7, option_toon8, option_toon9, r5, result, sqlrow, subans, and user.
Referenced by create_cartoon().
01353 { 01354 int i=0, a; 01355 01356 GtkWidget *dialog; 01357 01358 if(strcmp(option_toon, "Clown")==0) 01359 { 01360 i++; 01361 } 01362 01363 if(strcmp(option_toon1, "Dory")==0) 01364 { 01365 i++; 01366 } 01367 01368 if(strcmp(option_toon2, "Ogre")==0) 01369 { 01370 i++; 01371 } 01372 01373 if(strcmp(option_toon3, "Antonio Banderas")==0) 01374 { 01375 i++; 01376 } 01377 01378 if(strcmp(option_toon4, "Car Wash")==0) 01379 { 01380 i++; 01381 } 01382 01383 if(strcmp(option_toon5, "Angie")==0) 01384 { 01385 i++; 01386 } 01387 01388 if(strcmp(option_toon6, "Sally")==0) 01389 { 01390 i++; 01391 } 01392 01393 if(strcmp(option_toon7, "Radiator Springs")==0) 01394 { 01395 i++; 01396 } 01397 01398 if(strcmp(option_toon8, "Waste Allocation Load Lifter Earth")==0) 01399 { 01400 i++; 01401 } 01402 01403 if(strcmp(option_toon9, "Eva")==0) 01404 { 01405 i++; 01406 } 01407 01408 01409 01410 01411 01412 if(i==0) 01413 a=0; 01414 01415 if(i==1) 01416 a=10; 01417 01418 if(i==2) 01419 a=20; 01420 01421 if(i==3) 01422 a=30; 01423 01424 if(i==4) 01425 a=40; 01426 01427 if(i==5) 01428 a=50; 01429 01430 if(i==6) 01431 a=60; 01432 01433 if(i==7) 01434 a=70; 01435 01436 if(i==8) 01437 a=80; 01438 01439 if(i==9) 01440 a=90; 01441 01442 if(i==10) 01443 a=100; 01444 01445 01446 01447 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Username --> %s Category --> %s Movie --> %s Score --> %d percent",user,ans,subans,a); 01448 gtk_dialog_run (GTK_DIALOG (dialog)); 01449 01450 int return_value; 01451 char qry[100],qry1[100],l1[50],l2[50]; 01452 sprintf(qry,"select * from quiz where roll_number='%s'",r5); 01453 01454 return_value=mysql_query(connection1,qry); 01455 if(return_value) 01456 { 01457 printf("Select command failed"); 01458 } 01459 else 01460 { 01461 printf("\n\n\nIN ELSE LOOP\n\n\n"); 01462 result=mysql_use_result(connection1); 01463 if(result) 01464 { 01465 while((sqlrow=mysql_fetch_row(result))) 01466 { 01467 display_row(); 01468 strcpy(l1,sqlrow[4]); 01469 strcpy(l2,sqlrow[5]); 01470 01471 if(strcmp(l1,"empty")==0 && strcmp(l2,"empty")==0) 01472 { 01473 sprintf(qry1,"update quiz set level1='%s',level2='%s',score=%d where roll_number='%s'",ans,subans,a,r5); 01474 01475 } 01476 else if(strcmp(l1,"Movies")==0 && strcmp(l2,"Comedy")==0) 01477 { 01478 sprintf(qry1,"update quiz set score=%d where roll_number='%s'",a,r5); 01479 } 01480 } 01481 01482 } 01483 mysql_free_result(result); 01484 } 01485 01486 01487 int re=0; 01488 re=mysql_query(connection1,qry1); 01489 if(re==0) 01490 printf("Update succeded!!"); 01491 01492 if(return_value) 01493 g_print("Update Failed"); 01494 01495 gtk_widget_destroy (dialog); 01496 }
void callback_cat | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
callback_cat handles radio button in quiz category page.
helps in selecting the correct subcategory of selected quiz.
widget | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 3788 of file quiz.c.
Referenced by create_main().
03789 { 03790 char temp_cat[50]; 03791 strcpy(temp_cat,(char *)data); 03792 if(strcmp(temp_cat,"General Knowledge")==0) 03793 { 03794 flag_cat=0; 03795 strcpy(ans,"General Knowledge"); 03796 } 03797 if(strcmp(temp_cat,"Movies")==0) 03798 { 03799 flag_cat=1; 03800 strcpy(ans,"Movies"); 03801 } 03802 if(strcmp(temp_cat,"Sports")==0) 03803 { 03804 flag_cat=2; 03805 strcpy(ans,"Sports"); 03806 } 03807 03808 03809 }
static void callback_clear | ( | GtkWidget * | widget, | |
GtkWidget * | entry | |||
) | [static] |
callback_clear clears everything to blank in register page.
if clear button pressed.
entry | is a pointer to the textbox(GTK_ENTRY) used to get data from the user. |
Definition at line 3994 of file quiz.c.
References entry_name, entry_passwordr, entry_roll, and entry_usernamer.
Referenced by create_register().
03996 { 03997 gtk_entry_set_text (GTK_ENTRY (entry_name), ""); 03998 gtk_entry_set_text (GTK_ENTRY (entry_roll), ""); 03999 gtk_entry_set_text (GTK_ENTRY (entry_usernamer), ""); 04000 gtk_entry_set_text (GTK_ENTRY (entry_passwordr), ""); 04001 }
void callback_com | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2577 of file quiz.c.
References option_com.
Referenced by create_comedy().
02578 { 02579 strcpy(option_com, (char *)data); 02580 02581 }
void callback_com1 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2583 of file quiz.c.
References option_com1.
Referenced by create_comedy().
02584 { 02585 strcpy(option_com1, (char *)data); 02586 02587 }
void callback_com2 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2589 of file quiz.c.
References option_com2.
Referenced by create_comedy().
02590 { 02591 strcpy(option_com2, (char *)data); 02592 02593 }
void callback_com3 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2595 of file quiz.c.
References option_com3.
Referenced by create_comedy().
02596 { 02597 strcpy(option_com3, (char *)data); 02598 02599 }
void callback_com4 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2601 of file quiz.c.
References option_com4.
Referenced by create_comedy().
02602 { 02603 strcpy(option_com4, (char *)data); 02604 02605 }
void callback_com5 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2607 of file quiz.c.
References option_com5.
Referenced by create_comedy().
02608 { 02609 strcpy(option_com5, (char *)data); 02610 02611 }
void callback_com6 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2613 of file quiz.c.
References option_com6.
Referenced by create_comedy().
02614 { 02615 strcpy(option_com6, (char *)data); 02616 02617 }
void callback_com7 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2619 of file quiz.c.
References option_com7.
Referenced by create_comedy().
02620 { 02621 strcpy(option_com7, (char *)data); 02622 02623 }
void callback_com8 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2624 of file quiz.c.
References option_com8.
Referenced by create_comedy().
02625 { 02626 strcpy(option_com8, (char *)data); 02627 02628 }
void callback_com9 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2630 of file quiz.c.
References option_com9.
Referenced by create_comedy().
02631 { 02632 strcpy(option_com9, (char *)data); 02633 02634 }
void callback_comp | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 826 of file quiz.c.
References option_comp.
Referenced by create_computer().
00827 { 00828 strcpy(option_comp, (char *)data); 00829 00830 }
void callback_comp1 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 832 of file quiz.c.
References option_comp1.
Referenced by create_computer().
00833 { 00834 strcpy(option_comp1, (char *)data); 00835 00836 }
void callback_comp2 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 838 of file quiz.c.
References option_comp2.
Referenced by create_computer().
00839 { 00840 strcpy(option_comp2, (char *)data); 00841 00842 }
void callback_comp3 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 844 of file quiz.c.
References option_comp3.
Referenced by create_computer().
00845 { 00846 strcpy(option_comp3, (char *)data); 00847 00848 }
void callback_comp4 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 850 of file quiz.c.
References option_comp4.
Referenced by create_computer().
00851 { 00852 strcpy(option_comp4, (char *)data); 00853 00854 }
void callback_comp5 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 856 of file quiz.c.
References option_comp5.
Referenced by create_computer().
00857 { 00858 strcpy(option_comp5, (char *)data); 00859 00860 }
void callback_comp6 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 862 of file quiz.c.
References option_comp6.
Referenced by create_computer().
00863 { 00864 strcpy(option_comp6, (char *)data); 00865 00866 }
void callback_comp7 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 868 of file quiz.c.
References option_comp7.
Referenced by create_computer().
00869 { 00870 strcpy(option_comp7, (char *)data); 00871 00872 }
void callback_comp8 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 873 of file quiz.c.
References option_comp8.
Referenced by create_computer().
00874 { 00875 strcpy(option_comp8, (char *)data); 00876 00877 }
void callback_comp9 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 879 of file quiz.c.
References option_comp9.
Referenced by create_computer().
00880 { 00881 strcpy(option_comp9, (char *)data); 00882 00883 }
void callback_crick | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3273 of file quiz.c.
References option_crick.
Referenced by create_cricket().
03274 { 03275 strcpy(option_crick, (char *)data); 03276 03277 }
void callback_crick1 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3279 of file quiz.c.
References option_crick1.
Referenced by create_cricket().
03280 { 03281 strcpy(option_crick1, (char *)data); 03282 03283 }
void callback_crick2 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3285 of file quiz.c.
References option_crick2.
Referenced by create_cricket().
03286 { 03287 strcpy(option_crick2, (char *)data); 03288 03289 }
void callback_crick3 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3291 of file quiz.c.
References option_crick3.
Referenced by create_cricket().
03292 { 03293 strcpy(option_crick3, (char *)data); 03294 03295 }
void callback_crick4 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3297 of file quiz.c.
References option_crick4.
Referenced by create_cricket().
03298 { 03299 strcpy(option_crick4, (char *)data); 03300 03301 }
void callback_crick5 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3303 of file quiz.c.
References option_crick5.
Referenced by create_cricket().
03304 { 03305 strcpy(option_crick5, (char *)data); 03306 03307 }
void callback_crick6 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3309 of file quiz.c.
References option_crick6.
Referenced by create_cricket().
03310 { 03311 strcpy(option_crick6, (char *)data); 03312 03313 }
void callback_crick7 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3315 of file quiz.c.
References option_crick7.
Referenced by create_cricket().
03316 { 03317 strcpy(option_crick7, (char *)data); 03318 03319 }
void callback_crick8 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3320 of file quiz.c.
References option_crick8.
Referenced by create_cricket().
03321 { 03322 strcpy(option_crick8, (char *)data); 03323 03324 }
void callback_crick9 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3326 of file quiz.c.
References option_crick9.
Referenced by create_cricket().
03327 { 03328 strcpy(option_crick9, (char *)data); 03329 03330 }
void callback_epic | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2041 of file quiz.c.
References option_epic.
Referenced by create_epic().
02042 { 02043 strcpy(option_epic, (char *)data); 02044 02045 }
void callback_epic1 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2047 of file quiz.c.
References option_epic1.
Referenced by create_epic().
02048 { 02049 strcpy(option_epic1, (char *)data); 02050 02051 }
void callback_epic2 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2053 of file quiz.c.
References option_epic2.
Referenced by create_epic().
02054 { 02055 strcpy(option_epic2, (char *)data); 02056 02057 }
void callback_epic3 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2059 of file quiz.c.
References option_epic3.
Referenced by create_epic().
02060 { 02061 strcpy(option_epic3, (char *)data); 02062 02063 }
void callback_epic4 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2065 of file quiz.c.
References option_epic4.
Referenced by create_epic().
02066 { 02067 strcpy(option_epic4, (char *)data); 02068 02069 }
void callback_epic5 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2071 of file quiz.c.
References option_epic5.
Referenced by create_epic().
02072 { 02073 strcpy(option_epic5, (char *)data); 02074 02075 }
void callback_epic6 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2077 of file quiz.c.
References option_epic6.
Referenced by create_epic().
02078 { 02079 strcpy(option_epic6, (char *)data); 02080 02081 }
void callback_epic7 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2083 of file quiz.c.
References option_epic7.
Referenced by create_epic().
02084 { 02085 strcpy(option_epic7, (char *)data); 02086 02087 }
void callback_epic8 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2088 of file quiz.c.
References option_epic8.
Referenced by create_epic().
02089 { 02090 strcpy(option_epic8, (char *)data); 02091 02092 }
void callback_epic9 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 2094 of file quiz.c.
References option_epic9.
Referenced by create_epic().
02095 { 02096 strcpy(option_epic9, (char *)data); 02097 02098 }
void callback_gen | ( | GtkWidget * | widget1, | |
gpointer | data | |||
) |
callback_gen handles the radio buttons.
in general knowledge category page.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 1224 of file quiz.c.
References flag_gk.
Referenced by create_general().
void callback_hb | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 284 of file quiz.c.
References option_hb.
Referenced by create_human().
00285 { 00286 strcpy(option_hb, (char *)data); 00287 00288 }
void callback_hb1 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 290 of file quiz.c.
References option_hb1.
Referenced by create_human().
00291 { 00292 strcpy(option_hb1, (char *)data); 00293 00294 }
void callback_hb2 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 296 of file quiz.c.
References option_hb2.
Referenced by create_human().
00297 { 00298 strcpy(option_hb2, (char *)data); 00299 00300 }
void callback_hb3 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 302 of file quiz.c.
References option_hb3.
Referenced by create_human().
00303 { 00304 strcpy(option_hb3, (char *)data); 00305 00306 }
void callback_hb4 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 308 of file quiz.c.
References option_hb4.
Referenced by create_human().
00309 { 00310 strcpy(option_hb4, (char *)data); 00311 00312 }
void callback_hb5 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 314 of file quiz.c.
References option_hb5.
Referenced by create_human().
00315 { 00316 strcpy(option_hb5, (char *)data); 00317 00318 }
void callback_hb6 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 320 of file quiz.c.
References option_hb6.
Referenced by create_human().
00321 { 00322 strcpy(option_hb6, (char *)data); 00323 00324 }
void callback_hb7 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 326 of file quiz.c.
References option_hb7.
Referenced by create_human().
00327 { 00328 strcpy(option_hb7, (char *)data); 00329 00330 }
void callback_hb8 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 331 of file quiz.c.
References option_hb8.
Referenced by create_human().
00332 { 00333 strcpy(option_hb8, (char *)data); 00334 00335 }
void callback_hb9 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 337 of file quiz.c.
References option_hb9.
Referenced by create_human().
00338 { 00339 strcpy(option_hb9, (char *)data); 00340 00341 }
static void callback_login | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static] |
This is called when button is clicked to login to play quiz.
widget1 | Widegt which generated the signal | |
data | Data passed while generating signal |
This is called when button is clicked to register as a new user.
widget1 | Widegt which generated the signal | |
data | Data passed while generating signal |
Definition at line 4125 of file quiz.c.
References cnt, connection1, create_main(), display_row(), entry_password, entry_username, p, result, sqlrow, and u.
Referenced by main().
04127 { 04128 g_print (" %s \n", (char *) data); 04129 04130 int r1=0; 04131 char u[100]; 04132 char p[100]; 04133 04134 strcpy(u,gtk_entry_get_text (GTK_ENTRY(entry_username))); 04135 strcpy(p,gtk_entry_get_text (GTK_ENTRY(entry_password))); 04136 04137 g_print ("Uname, Password %s %s\n",u,p); 04138 char query[1000]; 04139 sprintf(query,"select * from quiz where username='%s' and password='%s'",u,p); 04140 printf("QUERY %s",query); 04141 04142 connection1 = mysql_init(NULL); 04143 if (mysql_real_connect (connection1, "localhost", "ankur_user", "ankur_password", "ankur_database", 0, NULL, 0)) 04144 04145 { 04146 04147 r1=mysql_query(connection1,query); 04148 if(r1!=0) 04149 { 04150 printf("Failure"); 04151 } 04152 else 04153 { 04154 result = mysql_use_result (connection1); 04155 if (result) 04156 { 04157 while ((sqlrow = mysql_fetch_row (result))) 04158 display_row (); 04159 04160 if (mysql_errno (connection1)) 04161 { 04162 printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1)); 04163 } 04164 } 04165 if(cnt==0) 04166 printf("No records exist in the table!!\n"); 04167 else 04168 { 04169 04170 create_main(); 04171 04172 04173 } 04174 cnt=0; 04175 } 04176 04177 } 04178 mysql_close (connection1); 04179 04180 g_print("QUERY %s",query); 04181 04186 }
void callback_m | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
callback_m handles the radio buttons.
in movie category page.
widget | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 3010 of file quiz.c.
References flag_toon.
Referenced by create_movie().
static void callback_reg | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static] |
callback_reg used to store user's details in database.
when register button is pressed in register page.
widget | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 3909 of file quiz.c.
References connection1, entry_name, entry_passwordr, entry_roll, entry_usernamer, n, p, r5, and u.
Referenced by create_register().
03911 { 03912 GtkWidget *dialog; 03913 int r1=0,flag=0; 03914 const char *name,*roll,*usernamer,*passwordr; 03915 03916 name=gtk_entry_get_text (GTK_ENTRY(entry_name)); 03917 roll=gtk_entry_get_text (GTK_ENTRY(entry_roll)); 03918 usernamer=gtk_entry_get_text (GTK_ENTRY(entry_usernamer)); 03919 passwordr=gtk_entry_get_text (GTK_ENTRY(entry_passwordr)); 03920 03921 strcpy(n,name); 03922 strcpy(r5,roll); 03923 strcpy(u,usernamer); 03924 strcpy(p,passwordr); 03925 03926 g_print ("Name Roll Uname Password %s %s %s %s\n",n,r5,u,p); 03927 char query[1000]; 03928 03929 if(strlen(n)==0 ||strlen(r5)==0||strlen(u)==0||strlen(p)==0) 03930 { 03931 flag=1; 03932 } 03933 if(flag==0) 03934 { 03935 sprintf(query,"insert into quiz values('%s','%s','%s','%s','empty','empty',0)",r5,n,u,p); 03936 03937 connection1 = mysql_init(NULL); 03938 if (mysql_real_connect (connection1, "localhost", "ankur_user", "ankur_password", "ankur_database", 0, NULL, 0)) 03939 03940 { 03941 r1=mysql_query(connection1,query); 03942 if(r1==0) 03943 printf("success"); 03944 else 03945 fprintf (stderr, "could not insert data as %d: %s\n", 03946 mysql_errno (connection1), 03947 mysql_error (connection1)); 03948 } 03949 03950 g_print("QUERY %s",query); 03951 03952 } 03953 else 03954 { 03955 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Null entries not allowed \n"); 03956 gtk_dialog_run (GTK_DIALOG (dialog)); 03957 gtk_widget_destroy (dialog); 03958 } 03959 }
static void callback_register | ( | GtkWidget * | widget, | |
gpointer | data | |||
) | [static] |
Definition at line 4187 of file quiz.c.
References create_register().
Referenced by main().
04189 { 04190 g_print (" %s \n", (char *) data); 04191 create_register(); 04192 }
void callback_sport | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
callback_sport redirects user to the cricket quiz he selected after clicking.
of enter button in sports category page.
widget | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 3674 of file quiz.c.
References create_cricket(), flag_sport, and subans.
Referenced by create_sports().
03675 { 03676 if(flag_sport==0) 03677 { 03678 strcpy(subans,"Cricket"); 03679 printf("%s\n",subans); 03680 create_cricket(); 03681 03682 } 03683 }
void callback_toon | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1498 of file quiz.c.
References option_toon.
Referenced by create_cartoon().
01499 { 01500 strcpy(option_toon, (char *)data); 01501 01502 }
void callback_toon1 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1504 of file quiz.c.
References option_toon1.
Referenced by create_cartoon().
01505 { 01506 strcpy(option_toon1, (char *)data); 01507 01508 }
void callback_toon2 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1510 of file quiz.c.
References option_toon2.
Referenced by create_cartoon().
01511 { 01512 strcpy(option_toon2, (char *)data); 01513 01514 }
void callback_toon3 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1516 of file quiz.c.
References option_toon3.
Referenced by create_cartoon().
01517 { 01518 strcpy(option_toon3, (char *)data); 01519 01520 }
void callback_toon4 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1522 of file quiz.c.
References option_toon4.
Referenced by create_cartoon().
01523 { 01524 strcpy(option_toon4, (char *)data); 01525 01526 }
void callback_toon5 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1528 of file quiz.c.
References option_toon5.
Referenced by create_cartoon().
01529 { 01530 strcpy(option_toon5, (char *)data); 01531 01532 }
void callback_toon6 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1534 of file quiz.c.
References option_toon6.
Referenced by create_cartoon().
01535 { 01536 strcpy(option_toon6, (char *)data); 01537 01538 }
void callback_toon7 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1540 of file quiz.c.
References option_toon7.
Referenced by create_cartoon().
01541 { 01542 strcpy(option_toon7, (char *)data); 01543 01544 }
void callback_toon8 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1545 of file quiz.c.
References option_toon8.
Referenced by create_cartoon().
01546 { 01547 strcpy(option_toon8, (char *)data); 01548 01549 }
void callback_toon9 | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 1551 of file quiz.c.
References option_toon9.
Referenced by create_cartoon().
01552 { 01553 strcpy(option_toon9, (char *)data); 01554 01555 }
static gboolean close_application | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) | [static] |
Definition at line 104 of file quiz.c.
Referenced by create_cartoon(), create_comedy(), create_computer(), create_cricket(), create_epic(), create_general(), create_human(), create_main(), create_movie(), create_register(), create_sports(), and main().
void create_cartoon | ( | ) |
create_cartoon creates the cartoon quiz.
after selection of cartoon in movie page and clicking click button.
void |
Definition at line 1564 of file quiz.c.
References answer_toon(), button, callback_toon(), callback_toon1(), callback_toon2(), callback_toon3(), callback_toon4(), callback_toon5(), callback_toon6(), callback_toon7(), callback_toon8(), callback_toon9(), close_application(), destroy(), table, and window.
Referenced by answer_m().
01565 { 01566 01567 static GtkWidget *window; 01568 01569 GtkWidget *button; 01570 GtkWidget *question; 01571 GtkWidget *scrolled_window; 01572 GtkWidget *table; 01573 01574 01575 //Create a new dialog window for the scrolled window to be packed into. 01576 window = gtk_dialog_new (); 01577 gtk_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); 01578 gtk_window_set_title (GTK_WINDOW (window), "Cartoons Quiz"); 01579 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 01580 gtk_widget_set_usize(window, 300, 300); 01581 01582 //create a new scrolled window. 01583 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 01584 01585 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10); 01586 01587 /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. 01588 * GTK_POLICY_AUTOMATIC will automatically decide whether you need 01589 * scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars 01590 * there. The first one is the horizontal scrollbar, the second, 01591 * the vertical. */ 01592 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); 01593 01594 //The dialog window is created with a vbox packed into it. 01595 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, TRUE, TRUE, 0); 01596 gtk_widget_show (scrolled_window); 01597 01598 //create a table of 10 by 10 squares. 01599 table = gtk_table_new (10, 10, FALSE); 01600 01601 //set the spacing to 45 on x and 1 on y 01602 gtk_table_set_row_spacings (GTK_TABLE (table), 45); 01603 gtk_table_set_col_spacings (GTK_TABLE (table), 1); 01604 01605 //pack the table into the scrolled window 01606 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table); 01607 gtk_widget_show (table); 01608 01609 //Question 1 01610 question=gtk_label_new("1. Which is not from Finding Nemo?"); 01611 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 1); 01612 gtk_widget_show(question); 01613 01614 button = gtk_radio_button_new_with_label (NULL, "Marlin"); 01615 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 2); 01616 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon), (gpointer) "Marlin"); 01617 gtk_widget_show (button); 01618 01619 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Dory"); 01620 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0,3); 01621 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon), (gpointer) "Dory"); 01622 gtk_widget_show (button); 01623 01624 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Crush"); 01625 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 4); 01626 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon), (gpointer) "Crush"); 01627 gtk_widget_show (button); 01628 01629 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Clown"); 01630 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 5); 01631 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon), (gpointer) "Clown"); 01632 gtk_widget_show (button); 01633 01634 01635 //Question 2 01636 question=gtk_label_new("2. Who has a short term memory loss?"); 01637 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 6); 01638 gtk_widget_show(question); 01639 01640 button = gtk_radio_button_new_with_label (NULL, "Marlin"); 01641 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 7); 01642 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon1), (gpointer) "Marlin"); 01643 gtk_widget_show (button); 01644 01645 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Dory"); 01646 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 8); 01647 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon1), (gpointer) "Dory"); 01648 gtk_widget_show (button); 01649 01650 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Bruce"); 01651 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 9); 01652 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon1), (gpointer) "Bruce"); 01653 gtk_widget_show (button); 01654 01655 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Bubbles"); 01656 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 10); 01657 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon1), (gpointer) "Bubbles"); 01658 gtk_widget_show (button); 01659 01660 01661 //Question 3 01662 question=gtk_label_new("3. What is Shrek?"); 01663 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 11); 01664 gtk_widget_show(question); 01665 01666 button = gtk_radio_button_new_with_label (NULL, "Monster"); 01667 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 12); 01668 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon2), (gpointer) "Monster"); 01669 gtk_widget_show (button); 01670 01671 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Dragon"); 01672 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 13); 01673 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon2), (gpointer) "Dragon"); 01674 gtk_widget_show (button); 01675 01676 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Ogre"); 01677 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 14); 01678 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon2), (gpointer) "Ogre"); 01679 gtk_widget_show (button); 01680 01681 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Donkey"); 01682 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 15); 01683 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon2), (gpointer) "Donkey"); 01684 gtk_widget_show (button); 01685 01686 01687 //Question 4 01688 question=gtk_label_new("4. Who is Puss in Boot?"); 01689 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 16); 01690 gtk_widget_show(question); 01691 01692 button = gtk_radio_button_new_with_label (NULL, "Mike Myers"); 01693 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 17); 01694 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon3), (gpointer) "Mike Myers"); 01695 gtk_widget_show (button); 01696 01697 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Justin Timberlake"); 01698 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 18); 01699 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon3), (gpointer) "Justin Timberlake"); 01700 gtk_widget_show (button); 01701 01702 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Eddie Murphy"); 01703 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 19); 01704 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon3), (gpointer) "Eddie Murphy"); 01705 gtk_widget_show (button); 01706 01707 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Antonio Banderas"); 01708 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 20); 01709 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon3), (gpointer) "Antonio Banderas"); 01710 gtk_widget_show (button); 01711 01712 01713 //Question 5 01714 question=gtk_label_new("5. Where does Oscar works at in Shark Tale?"); 01715 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 21); 01716 gtk_widget_show(question); 01717 01718 button = gtk_radio_button_new_with_label (NULL, "Sushi Restaurant"); 01719 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 22); 01720 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon4), (gpointer) "Sushi Restaurant"); 01721 gtk_widget_show (button); 01722 01723 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Seahorse Track"); 01724 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 23); 01725 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon4), (gpointer) "Seahorse Track"); 01726 gtk_widget_show (button); 01727 01728 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Car Wash"); 01729 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 24); 01730 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon4), (gpointer) "Car Wash"); 01731 gtk_widget_show (button); 01732 01733 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Don Lino's Office"); 01734 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 25); 01735 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon4), (gpointer) "Don Lino's office"); 01736 gtk_widget_show (button); 01737 01738 01739 //Question 6 01740 question=gtk_label_new("6. Who is in love with Oscar?"); 01741 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 26); 01742 gtk_widget_show(question); 01743 01744 button = gtk_radio_button_new_with_label (NULL, "Lenny"); 01745 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 27); 01746 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon5), (gpointer) "Lenny"); 01747 gtk_widget_show (button); 01748 01749 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Lola"); 01750 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 28); 01751 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon5), (gpointer) "Lola"); 01752 gtk_widget_show (button); 01753 01754 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sykes"); 01755 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 29); 01756 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon5), (gpointer) "Sykes"); 01757 gtk_widget_show (button); 01758 01759 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Angie"); 01760 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 30); 01761 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon5), (gpointer) "Angie"); 01762 gtk_widget_show (button); 01763 01764 01765 //Question 7 01766 question=gtk_label_new("7. In Cars, Lightning McQueen ends up in love with who?"); 01767 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 31); 01768 gtk_widget_show(question); 01769 01770 button = gtk_radio_button_new_with_label (NULL, "Sally"); 01771 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 32); 01772 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon6), (gpointer) "Sally"); 01773 gtk_widget_show (button); 01774 01775 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Flo");; 01776 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 33); 01777 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon6), (gpointer) "Flo"); 01778 gtk_widget_show (button); 01779 01780 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Lizzie"); 01781 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 34); 01782 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon6), (gpointer) "Lizzie"); 01783 gtk_widget_show (button); 01784 01785 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Mater"); 01786 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 35); 01787 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon6), (gpointer) "Mater"); 01788 gtk_widget_show (button); 01789 01790 01791 //Question 8 01792 question=gtk_label_new("8. What is the name of the place McQueen was stranded at?"); 01793 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 36); 01794 gtk_widget_show(question); 01795 01796 button = gtk_radio_button_new_with_label (NULL, "Piston Valley"); 01797 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 37); 01798 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon7), (gpointer) "Piston Valley"); 01799 gtk_widget_show (button); 01800 ; 01801 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Carburetor Village"); 01802 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 38); 01803 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon7), (gpointer) "Carburetor Village"); 01804 gtk_widget_show (button); 01805 01806 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Rims City"); 01807 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 39); 01808 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon7), (gpointer) "Rims City"); 01809 gtk_widget_show (button); 01810 01811 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Radiator Springs"); 01812 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 40); 01813 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon7), (gpointer) "Radiator Springs"); 01814 gtk_widget_show (button); 01815 01816 01817 //Question 9 01818 question=gtk_label_new("9. What does Wall E stands for?"); 01819 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 41); 01820 gtk_widget_show(question); 01821 01822 button = gtk_radio_button_new_with_label (NULL, "Waste Allocation Load Lifter Earth"); 01823 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 42); 01824 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon8), (gpointer) "Waste Allocation Load Lifter Earth"); 01825 gtk_widget_show (button); 01826 ; 01827 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Weight Allocation Load Lifter Earth"); 01828 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 43); 01829 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon8), (gpointer) "Weight Allocation Load Lifter Earth"); 01830 gtk_widget_show (button); 01831 01832 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Waste Allocation Load Litterer Earth"); 01833 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 44); 01834 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon8), (gpointer) "Waste Allocation Load Litterer Earth"); 01835 gtk_widget_show (button); 01836 01837 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Waste Allocation Land Lifter Earth"); 01838 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 45); 01839 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon8), (gpointer) "Waste Allocation Land Lifter Earth"); 01840 gtk_widget_show (button); 01841 01842 01843 //Question 10 01844 question=gtk_label_new("10. What does Wall E calls Eve?"); 01845 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 46); 01846 gtk_widget_show(question); 01847 01848 button = gtk_radio_button_new_with_label (NULL, "Eve"); 01849 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 47); 01850 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon9), (gpointer) "Eve"); 01851 gtk_widget_show (button); 01852 01853 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Evee"); 01854 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 48); 01855 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon9), (gpointer) "Evee"); 01856 gtk_widget_show (button); 01857 01858 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Eva"); 01859 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 49); 01860 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon9), (gpointer) "Eva"); 01861 gtk_widget_show (button); 01862 01863 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Eee"); 01864 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 50); 01865 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_toon9), (gpointer) "Eee"); 01866 gtk_widget_show (button); 01867 01868 01869 //Enter button to calculate marks 01870 button = gtk_button_new_with_label ("Enter"); 01871 g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (close_application), G_OBJECT (window)); 01872 01873 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 01874 01875 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0); 01876 01877 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_toon), (gpointer) "button"); 01878 gtk_widget_grab_default (button); 01879 gtk_widget_show (button); 01880 gtk_widget_show (window); 01881 01882 gtk_main (); 01883 01884 01885 }
void create_comedy | ( | ) |
create_comedy creates the comedy quiz.
after selection of comedy in movie page and clicking click button.
void |
Definition at line 2642 of file quiz.c.
References answer_com(), button, callback_com(), callback_com1(), callback_com2(), callback_com3(), callback_com4(), callback_com5(), callback_com6(), callback_com7(), callback_com8(), callback_com9(), close_application(), destroy(), table, and window.
Referenced by answer_m().
02643 { 02644 02645 static GtkWidget *window; 02646 02647 GtkWidget *button; 02648 GtkWidget *question; 02649 GtkWidget *scrolled_window; 02650 GtkWidget *table; 02651 02652 //Create a new dialog window for the scrolled window to be packed into. 02653 window = gtk_dialog_new (); 02654 gtk_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); 02655 gtk_window_set_title (GTK_WINDOW (window), "Love Comedy Quiz"); 02656 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 02657 gtk_widget_set_usize(window, 300, 300); 02658 02659 //create a new scrolled window. 02660 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 02661 02662 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10); 02663 02664 /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. 02665 * GTK_POLICY_AUTOMATIC will automatically decide whether you need 02666 * scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars 02667 * there. The first one is the horizontal scrollbar, the second, 02668 * the vertical. */ 02669 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); 02670 02671 //The dialog window is created with a vbox packed into it. 02672 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, TRUE, TRUE, 0); 02673 gtk_widget_show (scrolled_window); 02674 02675 //create a table of 10 by 10 squares. 02676 table = gtk_table_new (10, 10, FALSE); 02677 02678 //set the spacing to 45 on x and 1 on y 02679 gtk_table_set_row_spacings (GTK_TABLE (table), 45); 02680 gtk_table_set_col_spacings (GTK_TABLE (table), 1); 02681 02682 //pack the table into the scrolled window 02683 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table); 02684 gtk_widget_show (table); 02685 02686 //Question 1 02687 question=gtk_label_new("1. Who is Lucy Whitmore in 50 First Dates?"); 02688 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 1); 02689 gtk_widget_show(question); 02690 02691 button = gtk_radio_button_new_with_label (NULL, "Keira Knightley"); 02692 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 2); 02693 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com), (gpointer) "Keira Knightley"); 02694 gtk_widget_show (button); 02695 02696 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sarah Jessica Parker"); 02697 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0,3); 02698 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com), (gpointer) "Sarah Jessica Parker"); 02699 gtk_widget_show (button); 02700 02701 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Jennifer Aniston"); 02702 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 4); 02703 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com), (gpointer) "Jennifer Aniston"); 02704 gtk_widget_show (button); 02705 02706 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Drew Barrymore"); 02707 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 5); 02708 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com), (gpointer) "Drew Barrymore"); 02709 gtk_widget_show (button); 02710 02711 02712 //Question 2 02713 question=gtk_label_new("2. Where does Henry Roth works in Hawaii?"); 02714 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 6); 02715 gtk_widget_show(question); 02716 02717 button = gtk_radio_button_new_with_label (NULL, "Sea Life Park"); 02718 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 7); 02719 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com1), (gpointer) "Sea Life Park"); 02720 gtk_widget_show (button); 02721 02722 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Turtles Hatchery"); 02723 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 8); 02724 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com1), (gpointer) "Turtles Hatchery"); 02725 gtk_widget_show (button); 02726 02727 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Zoo"); 02728 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 9); 02729 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com1), (gpointer) "Zoo"); 02730 gtk_widget_show (button); 02731 02732 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Wild Life Park"); 02733 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 10); 02734 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com1), (gpointer) "Wild Life Park"); 02735 gtk_widget_show (button); 02736 02737 02738 //Question 3 02739 question=gtk_label_new("3. Which sport does Mike O'Donnell plays in 17 Again?"); 02740 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 11); 02741 gtk_widget_show(question); 02742 02743 button = gtk_radio_button_new_with_label (NULL, "Tennis"); 02744 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 12); 02745 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com2), (gpointer) "Tennis"); 02746 gtk_widget_show (button); 02747 02748 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Cricket"); 02749 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 13); 02750 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com2), (gpointer) "Cricket"); 02751 gtk_widget_show (button); 02752 02753 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Basketball"); 02754 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 14); 02755 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com2), (gpointer) "Basketball"); 02756 gtk_widget_show (button); 02757 02758 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Football"); 02759 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 15); 02760 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com2), (gpointer) "Football"); 02761 gtk_widget_show (button); 02762 02763 02764 //Question 4 02765 question=gtk_label_new("4. Which class was Mike O'Donnell from?"); 02766 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 16); 02767 gtk_widget_show(question); 02768 02769 button = gtk_radio_button_new_with_label (NULL, "1999"); 02770 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 17); 02771 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com3), (gpointer) "1999"); 02772 gtk_widget_show (button); 02773 02774 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1989"); 02775 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 18); 02776 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com3), (gpointer) "1989"); 02777 gtk_widget_show (button); 02778 02779 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "2009"); 02780 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 19); 02781 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com3), (gpointer) "2009"); 02782 gtk_widget_show (button); 02783 02784 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "2008"); 02785 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 20); 02786 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com3), (gpointer) "2008"); 02787 gtk_widget_show (button); 02788 02789 02790 //Question 5 02791 question=gtk_label_new("5. What are the 27 dresses in 27 Dresses?"); 02792 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 21); 02793 gtk_widget_show(question); 02794 02795 button = gtk_radio_button_new_with_label (NULL, "Wedding Dresses"); 02796 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 22); 02797 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com4), (gpointer) "Wedding Dresses"); 02798 gtk_widget_show (button); 02799 02800 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Cocktail Dresses"); 02801 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 23); 02802 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com4), (gpointer) "Cocktail Dresses"); 02803 gtk_widget_show (button); 02804 02805 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Summer Dresses"); 02806 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 24); 02807 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com4), (gpointer) "Summer Dresses"); 02808 gtk_widget_show (button); 02809 02810 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Bridesmaid Dresses"); 02811 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 25); 02812 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com4), (gpointer) "Bridesmaid Dresses"); 02813 gtk_widget_show (button); 02814 02815 02816 //Question 6 02817 question=gtk_label_new("6. Where did Jane wanted to get married at in 27 Dresses?"); 02818 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 26); 02819 gtk_widget_show(question); 02820 02821 button = gtk_radio_button_new_with_label (NULL, "Beach Club House"); 02822 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 27); 02823 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com5), (gpointer) "Beach Club House"); 02824 gtk_widget_show (button); 02825 02826 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Lake House"); 02827 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 28); 02828 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com5), (gpointer) "Lake House"); 02829 gtk_widget_show (button); 02830 02831 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Boat Club House"); 02832 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 29); 02833 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com5), (gpointer) "Boat Club House"); 02834 gtk_widget_show (button); 02835 02836 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Country House"); 02837 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 30); 02838 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com5), (gpointer) "Country House"); 02839 gtk_widget_show (button); 02840 02841 02842 //Question 7 02843 question=gtk_label_new("7. Who are best friends in Superbad?"); 02844 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 31); 02845 gtk_widget_show(question); 02846 02847 button = gtk_radio_button_new_with_label (NULL, "Seth and Becca"); 02848 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 32); 02849 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com6), (gpointer) "Seth and Becca"); 02850 gtk_widget_show (button); 02851 02852 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Seth and Evan"); 02853 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 33); 02854 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com6), (gpointer) "Seth and Evan"); 02855 gtk_widget_show (button); 02856 02857 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Becca and Evan"); 02858 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 34); 02859 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com6), (gpointer) "Becca and Evan"); 02860 gtk_widget_show (button); 02861 02862 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Seth and Fogell"); 02863 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 35); 02864 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com6), (gpointer) "Seth and Fogell"); 02865 gtk_widget_show (button); 02866 02867 02868 //Question 8 02869 question=gtk_label_new("8. In Superbad, How many weeks were there before the end of high school?"); 02870 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 36); 02871 gtk_widget_show(question); 02872 02873 button = gtk_radio_button_new_with_label (NULL, "Three"); 02874 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 37); 02875 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com7), (gpointer) "Three"); 02876 gtk_widget_show (button); 02877 02878 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "One"); 02879 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 38); 02880 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com7), (gpointer) "One"); 02881 gtk_widget_show (button); 02882 02883 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Two"); 02884 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 39); 02885 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com7), (gpointer) "Two"); 02886 gtk_widget_show (button); 02887 02888 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Four"); 02889 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 40); 02890 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com7), (gpointer) "Four"); 02891 gtk_widget_show (button); 02892 02893 02894 //Question 9 02895 question=gtk_label_new("9. What is the name of the song in Eurotrip?"); 02896 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 41); 02897 gtk_widget_show(question); 02898 02899 button = gtk_radio_button_new_with_label (NULL, "Scotty Knows"); 02900 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 42); 02901 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com8), (gpointer) "Scotty Knows"); 02902 gtk_widget_show (button); 02903 02904 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Scotty Doesn't Know"); 02905 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 43); 02906 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com8), (gpointer) "Scotty Doesn't Know"); 02907 gtk_widget_show (button); 02908 02909 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Scotty Wanna Know"); 02910 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 44); 02911 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com8), (gpointer) "Scotty Wanna Know"); 02912 gtk_widget_show (button); 02913 02914 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Scotty"); 02915 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 45); 02916 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com8), (gpointer) "Scotty"); 02917 gtk_widget_show (button); 02918 02919 02920 //Question 10 02921 question=gtk_label_new("10. Which place they did not go to in Eurotrip?"); 02922 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 46); 02923 gtk_widget_show(question); 02924 02925 button = gtk_radio_button_new_with_label (NULL, "Amsterdam"); 02926 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 47); 02927 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com9), (gpointer) "Amsterdam"); 02928 gtk_widget_show (button); 02929 02930 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Berlin"); 02931 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 48); 02932 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com9), (gpointer) "Berlin"); 02933 gtk_widget_show (button); 02934 02935 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Rome"); 02936 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 49); 02937 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com9), (gpointer) "Rome"); 02938 gtk_widget_show (button); 02939 02940 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Southampton"); 02941 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 50); 02942 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_com9), (gpointer) "Southampton"); 02943 gtk_widget_show (button); 02944 02945 02946 //Enter button to calculate marks 02947 button = gtk_button_new_with_label ("Enter"); 02948 g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (close_application), G_OBJECT (window)); 02949 02950 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 02951 02952 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0); 02953 02954 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_com), (gpointer) "button"); 02955 gtk_widget_grab_default (button); 02956 gtk_widget_show (button); 02957 gtk_widget_show (window); 02958 02959 gtk_main (); 02960 02961 02962 }
void create_computer | ( | ) |
create_computer creates the computer quiz.
after selection of computer in general knowledge page and clicking click button.
void |
Definition at line 890 of file quiz.c.
References answer_comp(), button, callback_comp(), callback_comp1(), callback_comp2(), callback_comp3(), callback_comp4(), callback_comp5(), callback_comp6(), callback_comp7(), callback_comp8(), callback_comp9(), close_application(), destroy(), table, and window.
Referenced by answer_gen().
00891 { 00892 00893 static GtkWidget *window; 00894 00895 GtkWidget *button; 00896 GtkWidget *question; 00897 GtkWidget *scrolled_window; 00898 GtkWidget *table; 00899 00900 //Create a new dialog window for the scrolled window to be packed into. 00901 window = gtk_dialog_new (); 00902 gtk_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); 00903 gtk_window_set_title (GTK_WINDOW (window), "Science Quiz"); 00904 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 00905 gtk_widget_set_usize(window, 300, 300); 00906 00907 //create a new scrolled window. 00908 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 00909 00910 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10); 00911 00912 /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. 00913 * GTK_POLICY_AUTOMATIC will automatically decide whether you need 00914 * scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars 00915 * there. The first one is the horizontal scrollbar, the second, 00916 * the vertical. */ 00917 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); 00918 00919 //The dialog window is created with a vbox packed into it. 00920 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, TRUE, TRUE, 0); 00921 gtk_widget_show (scrolled_window); 00922 00923 //create a table of 10 by 10 squares. 00924 table = gtk_table_new (10, 10, FALSE); 00925 00926 //set the spacing to 45 on x and 1 on y 00927 gtk_table_set_row_spacings (GTK_TABLE (table), 45); 00928 gtk_table_set_col_spacings (GTK_TABLE (table), 1); 00929 00930 //pack the table into the scrolled window 00931 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table); 00932 gtk_widget_show (table); 00933 00934 //Question 1 00935 question=gtk_label_new("1. how many bits is byte?"); 00936 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 1); 00937 gtk_widget_show(question); 00938 00939 button = gtk_radio_button_new_with_label (NULL, "4"); 00940 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 2); 00941 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp), (gpointer) "4"); 00942 gtk_widget_show (button); 00943 00944 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "8"); 00945 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0,3); 00946 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp), (gpointer) "8"); 00947 gtk_widget_show (button); 00948 00949 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "12"); 00950 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 4); 00951 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp), (gpointer) "12"); 00952 gtk_widget_show (button); 00953 00954 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "16"); 00955 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 5); 00956 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp), (gpointer) "16"); 00957 gtk_widget_show (button); 00958 00959 00960 //Question 2 00961 question=gtk_label_new("2. computer calculate numbers in what mode?"); 00962 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 6); 00963 gtk_widget_show(question); 00964 00965 button = gtk_radio_button_new_with_label (NULL, "decimal"); 00966 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 7); 00967 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp1), (gpointer) "decimal"); 00968 gtk_widget_show (button); 00969 00970 00971 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "octal"); 00972 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 8); 00973 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp1), (gpointer) "octal"); 00974 gtk_widget_show (button); 00975 00976 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "binary"); 00977 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 9); 00978 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp1), (gpointer) "binary"); 00979 gtk_widget_show (button); 00980 00981 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "hexadecimal"); 00982 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 10); 00983 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp1), (gpointer) "hexadecimal"); 00984 gtk_widget_show (button); 00985 00986 00987 //Question 3 00988 question=gtk_label_new("3. RAM stands for?"); 00989 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 11); 00990 gtk_widget_show(question); 00991 00992 button = gtk_radio_button_new_with_label (NULL, "Random Access Memory"); 00993 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 12); 00994 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp2), (gpointer) "Random Access Memory"); 00995 gtk_widget_show (button); 00996 00997 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Really Annoying Machine"); 00998 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 13); 00999 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp2), (gpointer) "Really Annoying Machine"); 01000 gtk_widget_show (button); 01001 01002 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Read A Manual"); 01003 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 14); 01004 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp2), (gpointer) "Read A Manual"); 01005 gtk_widget_show (button); 01006 01007 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "None"); 01008 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 15); 01009 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp2), (gpointer) "None"); 01010 gtk_widget_show (button); 01011 01012 01013 //Question 4 01014 question=gtk_label_new("4. ROM stands for?"); 01015 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 16); 01016 gtk_widget_show(question); 01017 01018 button = gtk_radio_button_new_with_label (NULL, "Royal Ontario Museum"); 01019 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 17); 01020 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp3), (gpointer) "Royal Ontario Museum"); 01021 gtk_widget_show (button); 01022 01023 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Read Only Memory"); 01024 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 18); 01025 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp3), (gpointer) "Read Only Memory"); 01026 gtk_widget_show (button); 01027 01028 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Read on Monday"); 01029 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 19); 01030 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp3), (gpointer) "Read on Monday"); 01031 gtk_widget_show (button); 01032 01033 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "none"); 01034 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 20); 01035 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp3), (gpointer) "none"); 01036 gtk_widget_show (button); 01037 01038 01039 //Question 5 01040 question=gtk_label_new("5. Which of the following is not a programming language?"); 01041 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 21); 01042 gtk_widget_show(question); 01043 01044 button = gtk_radio_button_new_with_label (NULL, "c"); 01045 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 22); 01046 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp4), (gpointer) "c"); 01047 gtk_widget_show (button); 01048 01049 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Basic"); 01050 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 23); 01051 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp4), (gpointer) "Basic"); 01052 gtk_widget_show (button); 01053 01054 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Java"); 01055 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 24); 01056 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp4), (gpointer) "Java"); 01057 gtk_widget_show (button); 01058 01059 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Turing"); 01060 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 25); 01061 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp4), (gpointer) "Turing"); 01062 gtk_widget_show (button); 01063 01064 01065 //Question 6 01066 question=gtk_label_new("6. WWhat does WWW stand for?"); 01067 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 26); 01068 gtk_widget_show(question); 01069 01070 button = gtk_radio_button_new_with_label (NULL, "World Wide Web"); 01071 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 27); 01072 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp5), (gpointer) "World Wide Web"); 01073 gtk_widget_show (button); 01074 01075 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "World Wide Wresting"); 01076 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 28); 01077 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp5), (gpointer) "World Wide Wresting"); 01078 gtk_widget_show (button); 01079 01080 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Wacky, Wild, Wonderful "); 01081 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 29); 01082 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp5), (gpointer) "Wacky, Wild, Wonderful "); 01083 gtk_widget_show (button); 01084 01085 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "None"); 01086 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 30); 01087 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp5), (gpointer) "None"); 01088 gtk_widget_show (button); 01089 01090 01091 //Question 7 01092 question=gtk_label_new("7. Which is not an internet protocol?"); 01093 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 31); 01094 gtk_widget_show(question); 01095 01096 button = gtk_radio_button_new_with_label (NULL, "HTTP"); 01097 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 32); 01098 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp6), (gpointer) "HTTP"); 01099 gtk_widget_show (button); 01100 01101 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "FTP"); 01102 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 33); 01103 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp6), (gpointer) "FTP"); 01104 gtk_widget_show (button); 01105 01106 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "STP"); 01107 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 34); 01108 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp6), (gpointer) "STP"); 01109 gtk_widget_show (button); 01110 01111 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "None"); 01112 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 35); 01113 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp6), (gpointer) "None"); 01114 gtk_widget_show (button); 01115 01116 01117 //Question 8 01118 question=gtk_label_new("8. Which was not an early mainframe computer?"); 01119 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 36); 01120 gtk_widget_show(question); 01121 01122 button = gtk_radio_button_new_with_label (NULL, "ENIAC"); 01123 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 37); 01124 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp7), (gpointer) "ENIAC"); 01125 gtk_widget_show (button); 01126 01127 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "UNIVAC"); 01128 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 38); 01129 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp7), (gpointer) "UNIVAC"); 01130 gtk_widget_show (button); 01131 01132 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "BRAINIAC"); 01133 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 39); 01134 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp7), (gpointer) "BRAINIAC"); 01135 gtk_widget_show (button); 01136 01137 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "None"); 01138 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 40); 01139 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp7), (gpointer) "None"); 01140 gtk_widget_show (button); 01141 01142 01143 //Question 9 01144 question=gtk_label_new("9. What type of memory is volatile?"); 01145 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 41); 01146 gtk_widget_show(question); 01147 01148 button = gtk_radio_button_new_with_label (NULL, "cache"); 01149 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 42); 01150 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp8), (gpointer) "cache"); 01151 gtk_widget_show (button); 01152 01153 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "hard drive"); 01154 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 43); 01155 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp8), (gpointer) "hard drive"); 01156 gtk_widget_show (button); 01157 01158 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "RAM"); 01159 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 44); 01160 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp8), (gpointer) "RAM"); 01161 gtk_widget_show (button); 01162 01163 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "ROM"); 01164 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 45); 01165 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp8), (gpointer) "ROM"); 01166 gtk_widget_show (button); 01167 01168 01169 //Question 10 01170 question=gtk_label_new("10. When was the first e-mail sent?"); 01171 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 46); 01172 gtk_widget_show(question); 01173 01174 button = gtk_radio_button_new_with_label (NULL, "1963"); 01175 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 47); 01176 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp9), (gpointer) "1963"); 01177 gtk_widget_show (button); 01178 01179 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1969"); 01180 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 48); 01181 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp9), (gpointer) "1969"); 01182 gtk_widget_show (button); 01183 01184 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1971"); 01185 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 49); 01186 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp9), (gpointer) "1971"); 01187 gtk_widget_show (button); 01188 01189 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1974"); 01190 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 50); 01191 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_comp9), (gpointer) "1974"); 01192 gtk_widget_show (button); 01193 01194 01195 //Enter button to calculate marks 01196 button = gtk_button_new_with_label ("Enter"); 01197 g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (close_application), G_OBJECT (window)); 01198 01199 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 01200 01201 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0); 01202 01203 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_comp), (gpointer) "button"); 01204 gtk_widget_grab_default (button); 01205 gtk_widget_show (button); 01206 gtk_widget_show (window); 01207 01208 gtk_main (); 01209 01210 }
void create_cricket | ( | ) |
create_cricket creates the cricket quiz.
after selection of cricket in sports page and clicking click button.
void |
Definition at line 3339 of file quiz.c.
References answer_crick(), button, callback_crick(), callback_crick1(), callback_crick2(), callback_crick3(), callback_crick4(), callback_crick5(), callback_crick6(), callback_crick7(), callback_crick8(), callback_crick9(), close_application(), destroy(), table, and window.
Referenced by callback_sport().
03340 { 03341 03342 static GtkWidget *window; 03343 03344 GtkWidget *button; 03345 GtkWidget *question; 03346 GtkWidget *scrolled_window; 03347 GtkWidget *table; 03348 03349 03350 03351 //Create a new dialog window for the scrolled window to be packed into. 03352 window = gtk_dialog_new (); 03353 gtk_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); 03354 gtk_window_set_title (GTK_WINDOW (window), "Cricket"); 03355 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 03356 gtk_widget_set_usize(window, 300, 300); 03357 03358 //create a new scrolled window. 03359 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 03360 03361 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10); 03362 03363 /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. 03364 * GTK_POLICY_AUTOMATIC will automatically decide whether you need 03365 * scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars 03366 * there. The first one is the horizontal scrollbar, the second, 03367 * the vertical. */ 03368 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); 03369 03370 //The dialog window is created with a vbox packed into it. 03371 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, TRUE, TRUE, 0); 03372 gtk_widget_show (scrolled_window); 03373 03374 //create a table of 10 by 10 squares. 03375 table = gtk_table_new (10, 10, FALSE); 03376 03377 //set the spacing to 45 on x and 1 on y 03378 gtk_table_set_row_spacings (GTK_TABLE (table), 45); 03379 gtk_table_set_col_spacings (GTK_TABLE (table), 1); 03380 03381 //pack the table into the scrolled window 03382 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table); 03383 gtk_widget_show (table); 03384 03385 //Question 1 03386 question=gtk_label_new("1. In first T20 world cup who hit 6 sixes in an over"); 03387 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 1); 03388 gtk_widget_show(question); 03389 03390 button = gtk_radio_button_new_with_label (NULL, "Yuvraj"); 03391 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 2); 03392 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick), (gpointer) "Yuvraj"); 03393 gtk_widget_show (button); 03394 03395 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "M.S. Dhoni"); 03396 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0,3); 03397 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick), (gpointer) "M.S. Dhoni"); 03398 gtk_widget_show (button); 03399 03400 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sehwag"); 03401 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 4); 03402 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick), (gpointer) "Sehwag"); 03403 gtk_widget_show (button); 03404 03405 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sachin"); 03406 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 5); 03407 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick), (gpointer) "Sachin"); 03408 gtk_widget_show (button); 03409 03410 03411 //Question 2 03412 question=gtk_label_new("2. who won the second T20 world cup?"); 03413 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 6); 03414 gtk_widget_show(question); 03415 03416 button = gtk_radio_button_new_with_label (NULL, "Sri Lanka"); 03417 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 7); 03418 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick1), (gpointer) "Sri Lanka"); 03419 gtk_widget_show (button); 03420 03421 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "India"); 03422 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 8); 03423 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick1), (gpointer) "India"); 03424 gtk_widget_show (button); 03425 03426 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Australia"); 03427 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 9); 03428 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick1), (gpointer) "Australia"); 03429 gtk_widget_show (button); 03430 03431 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Pakistan"); 03432 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 10); 03433 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick1), (gpointer) "Pakistan"); 03434 gtk_widget_show (button); 03435 03436 03437 //Question 3 03438 question=gtk_label_new("3. In what season was Stumpcam introduced?"); 03439 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 11); 03440 gtk_widget_show(question); 03441 03442 button = gtk_radio_button_new_with_label (NULL, "1990"); 03443 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 12); 03444 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick2), (gpointer) "1990"); 03445 gtk_widget_show (button); 03446 03447 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1979"); 03448 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 13); 03449 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick2), (gpointer) "1979"); 03450 gtk_widget_show (button); 03451 03452 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1988-89"); 03453 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 14); 03454 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick2), (gpointer) "1988-89"); 03455 gtk_widget_show (button); 03456 03457 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1985"); 03458 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 15); 03459 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick2), (gpointer) "1985"); 03460 gtk_widget_show (button); 03461 03462 03463 //Question 4 03464 question=gtk_label_new("4. Which INDIAN player scored had scored 2 triple century in TEST CRICKET ?"); 03465 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 16); 03466 gtk_widget_show(question); 03467 03468 button = gtk_radio_button_new_with_label (NULL, "Sachin"); 03469 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 17); 03470 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick3), (gpointer) "Sachin"); 03471 gtk_widget_show (button); 03472 03473 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sehwag"); 03474 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 18); 03475 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick3), (gpointer) "Sehwag"); 03476 gtk_widget_show (button); 03477 03478 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Laxman"); 03479 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 19); 03480 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick3), (gpointer) "Laxman"); 03481 gtk_widget_show (button); 03482 03483 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Kapil"); 03484 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 20); 03485 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick3), (gpointer) "Kapil"); 03486 gtk_widget_show (button); 03487 03488 03489 //Question 5 03490 question=gtk_label_new("5. which australian keeper has taken the most test dismissals"); 03491 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 21); 03492 gtk_widget_show(question); 03493 03494 button = gtk_radio_button_new_with_label (NULL, "Ian Heally"); 03495 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 22); 03496 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick4), (gpointer) "Ian Heally"); 03497 gtk_widget_show (button); 03498 03499 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Brad Haddin"); 03500 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 23); 03501 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick4), (gpointer) "Brad Haddin"); 03502 gtk_widget_show (button); 03503 03504 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Adam Gilchrist"); 03505 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 24); 03506 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick4), (gpointer) "Adam Gilchrist"); 03507 gtk_widget_show (button); 03508 03509 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Rod Marsh"); 03510 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 25); 03511 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick4), (gpointer) "Rod Marsh"); 03512 gtk_widget_show (button); 03513 03514 03515 //Question 6 03516 question=gtk_label_new("6. Who takes the first hat-trick in the 20-20 worldcup"); 03517 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 26); 03518 gtk_widget_show(question); 03519 03520 button = gtk_radio_button_new_with_label (NULL, "Danniel Vettori"); 03521 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 27); 03522 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick5), (gpointer) "Danniel Vettori"); 03523 gtk_widget_show (button); 03524 03525 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Brett Lee"); 03526 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 28); 03527 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick5), (gpointer) "Brett Lee"); 03528 gtk_widget_show (button); 03529 03530 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Jogan Botha"); 03531 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 29); 03532 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick5), (gpointer) "Jogan Botha"); 03533 gtk_widget_show (button); 03534 03535 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Irfan Pathan"); 03536 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 30); 03537 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick5), (gpointer) "Irfan Pathan"); 03538 gtk_widget_show (button); 03539 03540 03541 //Question 7 03542 question=gtk_label_new("7. Where did the 1st ODI match was played in India?"); 03543 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 31); 03544 gtk_widget_show(question); 03545 03546 button = gtk_radio_button_new_with_label (NULL, "Delhi"); 03547 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 32); 03548 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick6), (gpointer) "Delhi"); 03549 gtk_widget_show (button); 03550 03551 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Ahemdabad"); 03552 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 33); 03553 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick6), (gpointer) "Ahemdabad"); 03554 gtk_widget_show (button); 03555 03556 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Kolkata"); 03557 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 34); 03558 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick6), (gpointer) "Kolkata"); 03559 gtk_widget_show (button); 03560 03561 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Mumbai"); 03562 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 35); 03563 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick6), (gpointer) "Mumbai"); 03564 gtk_widget_show (button); 03565 03566 03567 //Question 8 03568 question=gtk_label_new("8. Who is the owner of Rajasthan Royals?"); 03569 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 36); 03570 gtk_widget_show(question); 03571 03572 button = gtk_radio_button_new_with_label (NULL, "Shahrukh"); 03573 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 37); 03574 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick7), (gpointer) "Shahrukh"); 03575 gtk_widget_show (button); 03576 03577 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Preity"); 03578 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 38); 03579 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick7), (gpointer) "Preity"); 03580 gtk_widget_show (button); 03581 03582 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Salman"); 03583 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 39); 03584 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick7), (gpointer) "Salman"); 03585 gtk_widget_show (button); 03586 03587 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Shilpa"); 03588 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 40); 03589 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick7), (gpointer) "Shilpa"); 03590 gtk_widget_show (button); 03591 03592 03593 //Question 9 03594 question=gtk_label_new("9. The Ranjhi Trophy was started in"); 03595 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 41); 03596 gtk_widget_show(question); 03597 03598 button = gtk_radio_button_new_with_label (NULL, "1950"); 03599 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 42); 03600 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick8), (gpointer) "1950"); 03601 gtk_widget_show (button); 03602 03603 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1935"); 03604 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 43); 03605 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick8), (gpointer) "1935"); 03606 gtk_widget_show (button); 03607 03608 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1937"); 03609 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 44); 03610 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick8), (gpointer) "1937"); 03611 gtk_widget_show (button); 03612 03613 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "1947"); 03614 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 45); 03615 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick8), (gpointer) "1947"); 03616 gtk_widget_show (button); 03617 03618 03619 //Question 10 03620 question=gtk_label_new("10. Who is the only player to take all the 10 wickets in a match?"); 03621 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 46); 03622 gtk_widget_show(question); 03623 03624 button = gtk_radio_button_new_with_label (NULL, "Murlidharan"); 03625 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 47); 03626 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick9), (gpointer) "Murlidharan"); 03627 gtk_widget_show (button); 03628 03629 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Anil"); 03630 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 48); 03631 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick9), (gpointer) "Anil"); 03632 gtk_widget_show (button); 03633 03634 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Shane"); 03635 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 49); 03636 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick9), (gpointer) "Shane"); 03637 gtk_widget_show (button); 03638 03639 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Donald"); 03640 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 50); 03641 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_crick9), (gpointer) "Donald"); 03642 gtk_widget_show (button); 03643 03644 03645 //Enter button to calculate marks 03646 button = gtk_button_new_with_label ("Enter"); 03647 g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (close_application), G_OBJECT (window)); 03648 03649 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 03650 03651 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0); 03652 03653 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_crick), (gpointer) "button"); 03654 gtk_widget_grab_default (button); 03655 gtk_widget_show (button); 03656 gtk_widget_show (window); 03657 03658 gtk_main (); 03659 03660 }
void create_database | ( | ) |
create_database creates database.
void |
Definition at line 31 of file quiz.c.
References connection1, result, and sqlrow.
Referenced by main().
00032 { 00033 int res,flg=0; 00034 connection1 = mysql_init(NULL); 00035 if (mysql_real_connect (connection1, "localhost", "ankur_user", "ankur_password", "ankur_database", 0, NULL, 0)) 00036 { 00037 printf ("Connection successful\n"); 00038 00039 res=mysql_query(connection1,"select 'quiz' from information_schema.tables where table_schema='ankur_database'"); 00040 if(res) 00041 { 00042 printf("Command failed"); 00043 } 00044 else 00045 { 00046 result=mysql_use_result(connection1); 00047 while((sqlrow=mysql_fetch_row(result))) 00048 { 00049 flg=1; 00050 } 00051 00052 mysql_free_result(result); 00053 } 00054 00055 if(flg==0) 00056 { 00057 res = mysql_query (connection1, "create table quiz(roll_number varchar(10) primary key,name varchar(50),username varchar(50),password varchar(20),level1 varchar(50),level2 varchar(50),score integer)"); 00058 if (res==0) 00059 { 00060 printf ("Table created successfully.\n"); 00061 } 00062 else 00063 { 00064 fprintf (stderr, "Could not create table as %d: %s\n",mysql_errno (connection1),mysql_error (connection1)); 00065 mysql_close (connection1); 00066 exit(EXIT_FAILURE); 00067 } 00068 } 00069 00070 } 00071 else 00072 { 00073 fprintf (stderr, "Connection failed\n"); 00074 if (mysql_errno (connection1)) 00075 { 00076 printf ( " \nConnection error"); 00077 } 00078 } 00079 }
void create_epic | ( | ) |
create_epic creates the epic quiz.
after selection of epic in movie page and clicking click button.
void |
Definition at line 2105 of file quiz.c.
References answer_epic(), button, callback_epic(), callback_epic1(), callback_epic2(), callback_epic3(), callback_epic4(), callback_epic5(), callback_epic6(), callback_epic7(), callback_epic8(), callback_epic9(), close_application(), destroy(), table, and window.
Referenced by answer_m().
02106 { 02107 02108 static GtkWidget *window; 02109 02110 GtkWidget *button; 02111 GtkWidget *question; 02112 GtkWidget *scrolled_window; 02113 GtkWidget *table; 02114 02115 02116 02117 //Create a new dialog window for the scrolled window to be packed into. 02118 window = gtk_dialog_new (); 02119 gtk_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); 02120 gtk_window_set_title (GTK_WINDOW (window), "Epic Quiz"); 02121 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 02122 gtk_widget_set_usize(window, 300, 300); 02123 02124 //create a new scrolled window. 02125 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 02126 02127 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10); 02128 02129 /* The policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. 02130 * GTK_POLICY_AUTOMATIC will automatically decide whether you need 02131 * scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars 02132 * there. The first one is the horizontal scrollbar, the second, 02133 * the vertical. */ 02134 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); 02135 02136 //The dialog window is created with a vbox packed into it. 02137 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, TRUE, TRUE, 0); 02138 gtk_widget_show (scrolled_window); 02139 02140 //create a table of 10 by 10 squares. 02141 table = gtk_table_new (10, 10, FALSE); 02142 02143 //set the spacing to 45 on x and 1 on y 02144 gtk_table_set_row_spacings (GTK_TABLE (table), 45); 02145 gtk_table_set_col_spacings (GTK_TABLE (table), 1); 02146 02147 //pack the table into the scrolled window 02148 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table); 02149 gtk_widget_show (table); 02150 02151 //Question 1 02152 question=gtk_label_new("1. Who is Captain Jack Sparrow?"); 02153 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 1); 02154 gtk_widget_show(question); 02155 02156 button = gtk_radio_button_new_with_label (NULL, "Ashton Kutcher"); 02157 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 2); 02158 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic), (gpointer) "Ashton Kutcher"); 02159 gtk_widget_show (button); 02160 02161 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Johnny Depp"); 02162 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0,3); 02163 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic), (gpointer) "Johnny Depp"); 02164 gtk_widget_show (button); 02165 02166 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Ben Affleck"); 02167 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 4); 02168 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic), (gpointer) "Ben Affleck"); 02169 gtk_widget_show (button); 02170 02171 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Orlando Bloom"); 02172 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 5); 02173 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic), (gpointer) "Orlando Bloom"); 02174 gtk_widget_show (button); 02175 02176 02177 //Question 2 02178 question=gtk_label_new("2. What is the name of the captain on the ship Captain Jack Sparrow wants to take over?"); 02179 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 6); 02180 gtk_widget_show(question); 02181 02182 button = gtk_radio_button_new_with_label (NULL, "Captain Hook"); 02183 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 7); 02184 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic1), (gpointer) "Captain Hook"); 02185 gtk_widget_show (button); 02186 02187 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Captain Swann"); 02188 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 8); 02189 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic1), (gpointer) "Captain Swann"); 02190 gtk_widget_show (button); 02191 02192 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Captain Norrington"); 02193 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 9); 02194 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic1), (gpointer) "Captain Norrington"); 02195 gtk_widget_show (button); 02196 02197 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Captain Barbossa"); 02198 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 10); 02199 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic1), (gpointer) "Captain Barbossa"); 02200 gtk_widget_show (button); 02201 02202 02203 //Question 3 02204 question=gtk_label_new("3. Frodo and Bilbo are..."); 02205 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 11); 02206 gtk_widget_show(question); 02207 02208 button = gtk_radio_button_new_with_label (NULL, "Dwarves"); 02209 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 12); 02210 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic2), (gpointer) "Dwarves"); 02211 gtk_widget_show (button); 02212 02213 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Elves"); 02214 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 13); 02215 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic2), (gpointer) "Elves"); 02216 gtk_widget_show (button); 02217 02218 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Hobbits"); 02219 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 14); 02220 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic2), (gpointer) "Hobbits"); 02221 gtk_widget_show (button); 02222 02223 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Leprechauns"); 02224 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 15); 02225 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic2), (gpointer) "Leprechauns"); 02226 gtk_widget_show (button); 02227 02228 02229 //Question 4 02230 question=gtk_label_new("4. What is the other name of Smeagol?"); 02231 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 16); 02232 gtk_widget_show(question); 02233 02234 button = gtk_radio_button_new_with_label (NULL, "Gollum"); 02235 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 17); 02236 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic3), (gpointer) "Gollum"); 02237 gtk_widget_show (button); 02238 02239 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Galadriel"); 02240 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 18); 02241 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic3), (gpointer) "Galadriel"); 02242 gtk_widget_show (button); 02243 02244 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Elrond"); 02245 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 19); 02246 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic3), (gpointer) "Elrond"); 02247 gtk_widget_show (button); 02248 02249 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sauron"); 02250 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 20); 02251 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic3), (gpointer) "Sauron"); 02252 gtk_widget_show (button); 02253 02254 02255 //Question 5 02256 question=gtk_label_new("5. Which house was Harry Potter in?"); 02257 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 21); 02258 gtk_widget_show(question); 02259 02260 button = gtk_radio_button_new_with_label (NULL, "Hufflepuff"); 02261 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 22); 02262 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic4), (gpointer) "Hufflepuff"); 02263 gtk_widget_show (button); 02264 02265 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Gryffindor"); 02266 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 23); 02267 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic4), (gpointer) "Gryffindor"); 02268 gtk_widget_show (button); 02269 02270 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Ravenclaw"); 02271 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 24); 02272 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic4), (gpointer) "Ravenclaw"); 02273 gtk_widget_show (button); 02274 02275 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Slytherin"); 02276 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 25); 02277 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic4), (gpointer) "Slytherin"); 02278 gtk_widget_show (button); 02279 02280 02281 //Question 6 02282 question=gtk_label_new("6. Who did Harry Potter had a crush on for the first time?"); 02283 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 26); 02284 gtk_widget_show(question); 02285 02286 button = gtk_radio_button_new_with_label (NULL, "Ginny Weasley"); 02287 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 27); 02288 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic5), (gpointer) "Ginny Weasley"); 02289 gtk_widget_show (button); 02290 02291 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Hermoine Granger"); 02292 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 28); 02293 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic5), (gpointer) "Hermoine Granger"); 02294 gtk_widget_show (button); 02295 02296 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Luna Lovegood"); 02297 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 29); 02298 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic5), (gpointer) "Luna Lovegood"); 02299 gtk_widget_show (button); 02300 02301 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Cho Chang"); 02302 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 30); 02303 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic5), (gpointer) "Cho Chang"); 02304 gtk_widget_show (button); 02305 02306 02307 //Question 7 02308 question=gtk_label_new("7. Why were they doing the program on pandora?"); 02309 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 31); 02310 gtk_widget_show(question); 02311 02312 button = gtk_radio_button_new_with_label (NULL, "To study the Avatars!"); 02313 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 32); 02314 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic6), (gpointer) "To study the Avatars!"); 02315 gtk_widget_show (button); 02316 02317 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "For fun!"); 02318 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 33); 02319 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic6), (gpointer) "For fun!"); 02320 gtk_widget_show (button); 02321 02322 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "U.S President orders."); 02323 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 34); 02324 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic6), (gpointer) "U.S President orders."); 02325 gtk_widget_show (button); 02326 02327 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "New planet for humans."); 02328 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 35); 02329 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic6), (gpointer) "New planet for humans."); 02330 gtk_widget_show (button); 02331 02332 02333 //Question 8 02334 question=gtk_label_new("8. Who did Jake fall in love with in Avatar?"); 02335 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 36); 02336 gtk_widget_show(question); 02337 02338 button = gtk_radio_button_new_with_label (NULL, "Neytiri"); 02339 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 37); 02340 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic7), (gpointer) "Neytiri"); 02341 gtk_widget_show (button); 02342 02343 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sarah"); 02344 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 38); 02345 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic7), (gpointer) "Sarah"); 02346 gtk_widget_show (button); 02347 02348 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Naina"); 02349 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 39); 02350 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic7), (gpointer) "Naina"); 02351 gtk_widget_show (button); 02352 02353 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Naitara"); 02354 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 40); 02355 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic7), (gpointer) "Naitara"); 02356 gtk_widget_show (button); 02357 02358 02359 //Question 9 02360 question=gtk_label_new("9. In Gladiator, Where did the merchant say he bought Juba before selling him to Proximo?"); 02361 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 41); 02362 gtk_widget_show(question); 02363 02364 button = gtk_radio_button_new_with_label (NULL, "Hunter's camp"); 02365 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 42); 02366 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic8), (gpointer) "Hunter's camp"); 02367 gtk_widget_show (button); 02368 02369 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Salt mine"); 02370 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 43); 02371 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic8), (gpointer) "Salt mine"); 02372 gtk_widget_show (button); 02373 02374 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Bazaar"); 02375 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 44); 02376 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic8), (gpointer) "Bazaar"); 02377 gtk_widget_show (button); 02378 02379 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Gold mine"); 02380 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 45); 02381 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic8), (gpointer) "Gold mine"); 02382 gtk_widget_show (button); 02383 02384 02385 //Question 10 02386 question=gtk_label_new("10. What letters are tattooed on Maximus' left shoulder?"); 02387 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 46); 02388 gtk_widget_show(question); 02389 02390 button = gtk_radio_button_new_with_label (NULL, "SROP"); 02391 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 47); 02392 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic9), (gpointer) "SROP"); 02393 gtk_widget_show (button); 02394 02395 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "SPOR"); 02396 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 48); 02397 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic9), (gpointer) "SPOR"); 02398 gtk_widget_show (button); 02399 02400 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "SRQP"); 02401 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 49); 02402 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic9), (gpointer) "SRQP"); 02403 gtk_widget_show (button); 02404 02405 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "SPQR"); 02406 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 50); 02407 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_epic9), (gpointer) "SPQR"); 02408 gtk_widget_show (button); 02409 02410 02411 //Enter button to calculate marks 02412 button = gtk_button_new_with_label ("Enter"); 02413 g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (close_application), G_OBJECT (window)); 02414 02415 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 02416 02417 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0); 02418 02419 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_epic), (gpointer) "button"); 02420 gtk_widget_grab_default (button); 02421 gtk_widget_show (button); 02422 gtk_widget_show (window); 02423 02424 gtk_main (); 02425 02426 02427 }
void create_general | ( | ) |
create_general creates the general knowledge quiz page.
after selection of general knowledge in main quiz page and clicking click button. movie quiz page will open.
void |
Definition at line 1270 of file quiz.c.
References answer_gen(), button, callback_gen(), close_application(), and window.
Referenced by answer_cat().
01271 { 01272 GtkWidget *window = NULL; 01273 GtkWidget *box1; 01274 GtkWidget *box2; 01275 GtkWidget *button; 01276 GtkWidget *separator; 01277 GtkWidget *question; 01278 //GSList *group_gen; 01279 01280 01281 01282 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 01283 01284 gtk_window_set_default_size(GTK_WINDOW(window),340,200); 01285 gtk_window_set_title (GTK_WINDOW (window), "General Knowledge"); 01286 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 01287 01288 box1 = gtk_vbox_new (FALSE, 0); 01289 gtk_container_add (GTK_CONTAINER (window), box1); 01290 gtk_widget_show (box1); 01291 01292 box2 = gtk_vbox_new (FALSE, 10); 01293 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 01294 gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); 01295 gtk_widget_show (box2); 01296 01297 question=gtk_label_new("Choose Quiz"); 01298 gtk_box_pack_start (GTK_BOX (box2), question, TRUE, TRUE, 0); 01299 gtk_widget_show(question); 01300 01301 button = gtk_radio_button_new_with_label (NULL, "Human Body"); 01302 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 01303 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_gen), (gpointer) "Human Body"); 01304 gtk_widget_show (button); 01305 01306 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Computers"); 01307 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 01308 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_gen), (gpointer) "Computers"); 01309 gtk_widget_show (button); 01310 01311 separator = gtk_hseparator_new (); 01312 gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); 01313 gtk_widget_show (separator); 01314 01315 box2 = gtk_vbox_new (FALSE, 10); 01316 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 01317 gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); 01318 gtk_widget_show (box2); 01319 01320 button = gtk_button_new_with_label ("Enter"); 01321 g_signal_connect_swapped (G_OBJECT (button), "clicked", 01322 G_CALLBACK (close_application), 01323 G_OBJECT (window)); 01324 01325 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 01326 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 01327 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_gen), (gpointer) "button"); 01328 gtk_widget_grab_default (button); 01329 gtk_widget_show (button); 01330 gtk_widget_show (window); 01331 01332 gtk_main (); 01333 01334 }
void create_human | ( | ) |
create_human creates the human body quiz.
after selection of human body in general knowledge page and clicking click button.
void |
Definition at line 355 of file quiz.c.
References answer_hb(), button, callback_hb(), callback_hb1(), callback_hb2(), callback_hb3(), callback_hb4(), callback_hb5(), callback_hb6(), callback_hb7(), callback_hb8(), callback_hb9(), close_application(), destroy(), table, and window.
Referenced by answer_gen().
00356 { 00357 00358 static GtkWidget *window; 00359 00360 GtkWidget *button; 00361 GtkWidget *question; 00362 GtkWidget *scrolled_window; 00363 GtkWidget *table; 00364 00365 window = gtk_dialog_new (); 00366 gtk_signal_connect (GTK_OBJECT (window), "destroy", (GtkSignalFunc) destroy, NULL); 00367 gtk_window_set_title (GTK_WINDOW (window), "Human Quiz"); 00368 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 00369 gtk_widget_set_usize(window, 300, 300); 00370 00371 scrolled_window = gtk_scrolled_window_new (NULL, NULL); 00372 00373 gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10); 00374 00375 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); 00376 00377 00378 gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, TRUE, TRUE, 0); 00379 gtk_widget_show (scrolled_window); 00380 00381 00382 table = gtk_table_new (10, 10, FALSE); 00383 00384 //set the spacing to 45 on x and 1 on y 00385 gtk_table_set_row_spacings (GTK_TABLE (table), 45); 00386 gtk_table_set_col_spacings (GTK_TABLE (table), 1); 00387 00388 //pack the table into the scrolled window 00389 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), table); 00390 gtk_widget_show (table); 00391 00392 //Question 1 00393 question=gtk_label_new("1. What is the largest organ in the body?"); 00394 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 1); 00395 gtk_widget_show(question); 00396 00397 button = gtk_radio_button_new_with_label (NULL, "skin"); 00398 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 2); 00399 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb), (gpointer) "skin"); 00400 gtk_widget_show (button); 00401 00402 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "heart"); 00403 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0,3); 00404 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb), (gpointer) "heart"); 00405 gtk_widget_show (button); 00406 00407 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "brain"); 00408 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 4); 00409 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb), (gpointer) "brain"); 00410 gtk_widget_show (button); 00411 00412 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "liver"); 00413 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 5); 00414 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb), (gpointer) "liver"); 00415 gtk_widget_show (button); 00416 00417 00418 //Question 2 00419 question=gtk_label_new("2. How many bones are there in the human body?"); 00420 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 6); 00421 gtk_widget_show(question); 00422 00423 button = gtk_radio_button_new_with_label (NULL, "203"); 00424 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 7); 00425 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb1), (gpointer) "203"); 00426 gtk_widget_show (button); 00427 00428 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "205"); 00429 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 8); 00430 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb1), (gpointer) "205"); 00431 gtk_widget_show (button); 00432 00433 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "206"); 00434 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 9); 00435 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb1), (gpointer) "206"); 00436 gtk_widget_show (button); 00437 00438 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "208"); 00439 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 10); 00440 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb1), (gpointer) "208"); 00441 gtk_widget_show (button); 00442 00443 00444 //Question 3 00445 question=gtk_label_new("3. To control bleeding, what should you try first?"); 00446 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 11); 00447 gtk_widget_show(question); 00448 00449 button = gtk_radio_button_new_with_label (NULL, "ice"); 00450 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 12); 00451 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb2), (gpointer) "ice"); 00452 gtk_widget_show (button); 00453 00454 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "elevation"); 00455 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 13); 00456 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb2), (gpointer) "elevation"); 00457 gtk_widget_show (button); 00458 00459 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "wash"); 00460 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 14); 00461 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb2), (gpointer) "wash"); 00462 gtk_widget_show (button); 00463 00464 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "pressure"); 00465 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 15); 00466 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb2), (gpointer) "pressure"); 00467 gtk_widget_show (button); 00468 00469 00470 //Question 4 00471 question=gtk_label_new("4. What is the function of the skin?"); 00472 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 16); 00473 gtk_widget_show(question); 00474 00475 button = gtk_radio_button_new_with_label (NULL, "stalability"); 00476 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 17); 00477 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb3), (gpointer) "stalability"); 00478 gtk_widget_show (button); 00479 00480 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "protection"); 00481 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 18); 00482 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb3), (gpointer) "protection"); 00483 gtk_widget_show (button); 00484 00485 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "consistency"); 00486 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 19); 00487 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb3), (gpointer) "consistency"); 00488 gtk_widget_show (button); 00489 00490 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "sunblock"); 00491 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 20); 00492 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb3), (gpointer) "sunblock"); 00493 gtk_widget_show (button); 00494 00495 00496 //Question 5 00497 question=gtk_label_new("5. Where would you find a radial pulse?"); 00498 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 21); 00499 gtk_widget_show(question); 00500 00501 button = gtk_radio_button_new_with_label (NULL, "neck"); 00502 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 22); 00503 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb4), (gpointer) "neck"); 00504 gtk_widget_show (button); 00505 00506 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "feet"); 00507 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 23); 00508 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb4), (gpointer) "feet"); 00509 gtk_widget_show (button); 00510 00511 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "wrist"); 00512 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 24); 00513 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb4), (gpointer) "wrist"); 00514 gtk_widget_show (button); 00515 00516 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "armpit"); 00517 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 25); 00518 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb4), (gpointer) "armpit"); 00519 gtk_widget_show (button); 00520 00521 00522 //Question 6 00523 question=gtk_label_new("6. Where would you put an oropharyngeal airway?"); 00524 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 26); 00525 gtk_widget_show(question); 00526 00527 button = gtk_radio_button_new_with_label (NULL, "mouth"); 00528 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 27); 00529 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb5), (gpointer) "mouth"); 00530 gtk_widget_show (button); 00531 00532 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "nose"); 00533 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 28); 00534 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb5), (gpointer) "nose"); 00535 gtk_widget_show (button); 00536 00537 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "ear"); 00538 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 29); 00539 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb5), (gpointer) "ear"); 00540 gtk_widget_show (button); 00541 00542 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "eyes"); 00543 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 30); 00544 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb5), (gpointer) "eyes"); 00545 gtk_widget_show (button); 00546 00547 00548 //Question 7 00549 question=gtk_label_new("7. What are normal respirations for an adult?"); 00550 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 31); 00551 gtk_widget_show(question); 00552 00553 button = gtk_radio_button_new_with_label (NULL, "16-24"); 00554 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 32); 00555 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb6), (gpointer) "16-24"); 00556 gtk_widget_show (button); 00557 00558 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "8-12"); 00559 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 33); 00560 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb6), (gpointer) "8-12"); 00561 gtk_widget_show (button); 00562 00563 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "12-20"); 00564 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 34); 00565 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb6), (gpointer) "12-20"); 00566 gtk_widget_show (button); 00567 00568 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "10-16"); 00569 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 35); 00570 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb6), (gpointer) "10-16"); 00571 gtk_widget_show (button); 00572 00573 00574 //Question 8 00575 question=gtk_label_new("8. What is the average human scalp?"); 00576 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 36); 00577 gtk_widget_show(question); 00578 00579 button = gtk_radio_button_new_with_label (NULL, "2,000"); 00580 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 37); 00581 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb7), (gpointer) "2,000"); 00582 gtk_widget_show (button); 00583 00584 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "6,000"); 00585 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 38); 00586 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb7), (gpointer) "6,000"); 00587 gtk_widget_show (button); 00588 00589 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "8,000"); 00590 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 39); 00591 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb7), (gpointer) "8,000"); 00592 gtk_widget_show (button); 00593 00594 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "10,000"); 00595 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 40); 00596 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb7), (gpointer) "10,000"); 00597 gtk_widget_show (button); 00598 00599 00600 //Question 9 00601 question=gtk_label_new("9. What is the strongest muscle?"); 00602 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 41); 00603 gtk_widget_show(question); 00604 00605 button = gtk_radio_button_new_with_label (NULL, "tongue"); 00606 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 42); 00607 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb8), (gpointer) "tongue"); 00608 gtk_widget_show (button); 00609 00610 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "arms"); 00611 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 43); 00612 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb8), (gpointer) "arms"); 00613 gtk_widget_show (button); 00614 00615 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "fingers"); 00616 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 44); 00617 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb8), (gpointer) "fingers"); 00618 gtk_widget_show (button); 00619 00620 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "legs"); 00621 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 45); 00622 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb8), (gpointer) "legs"); 00623 gtk_widget_show (button); 00624 00625 00626 //Question 10 00627 question=gtk_label_new("10. Which is the fastest growing nail?"); 00628 gtk_table_attach_defaults (GTK_TABLE (table), question, 0, 1, 0, 46); 00629 gtk_widget_show(question); 00630 00631 button = gtk_radio_button_new_with_label (NULL, "index"); 00632 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 47); 00633 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb9), (gpointer) "index"); 00634 gtk_widget_show (button); 00635 00636 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "middle"); 00637 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 48); 00638 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb9), (gpointer) "middle"); 00639 gtk_widget_show (button); 00640 00641 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "thumb"); 00642 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 49); 00643 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb9), (gpointer) "thumb"); 00644 gtk_widget_show (button); 00645 00646 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "ring"); 00647 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 50); 00648 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_hb9), (gpointer) "ring"); 00649 gtk_widget_show (button); 00650 00651 00652 //Enter button to calculate marks 00653 button = gtk_button_new_with_label ("Enter"); 00654 g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (close_application), G_OBJECT (window)); 00655 00656 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 00657 00658 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0); 00659 00660 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_hb), (gpointer) "button"); 00661 gtk_widget_grab_default (button); 00662 gtk_widget_show (button); 00663 gtk_widget_show (window); 00664 00665 gtk_main (); 00666 00667 00668 }
void create_main | ( | ) |
create_main creates the main page of quiz category.
after login button in login page is clicked.
void |
Definition at line 3833 of file quiz.c.
References answer_cat(), button, callback_cat(), close_application(), and window.
Referenced by callback_login().
03834 { 03835 GtkWidget *window = NULL; 03836 GtkWidget *box1; 03837 GtkWidget *box2; 03838 GtkWidget *button; 03839 GtkWidget *separator; 03840 GtkWidget *question; 03841 03842 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 03843 03844 gtk_window_set_default_size(GTK_WINDOW(window),340,200); 03845 gtk_window_set_title (GTK_WINDOW (window), "Quiz Category"); 03846 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 03847 03848 box1 = gtk_vbox_new (FALSE, 0); 03849 gtk_container_add (GTK_CONTAINER (window), box1); 03850 gtk_widget_show (box1); 03851 03852 box2 = gtk_vbox_new (FALSE, 10); 03853 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 03854 gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); 03855 gtk_widget_show (box2); 03856 03857 question=gtk_label_new("Choose Category"); 03858 gtk_box_pack_start (GTK_BOX (box2), question, TRUE, TRUE, 0); 03859 gtk_widget_show(question); 03860 03861 button = gtk_radio_button_new_with_label (NULL, "General Knowledge"); 03862 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03863 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_cat), (gpointer) "General Knowledge"); 03864 gtk_widget_show (button); 03865 03866 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Movies"); 03867 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03868 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_cat), (gpointer) "Movies"); 03869 gtk_widget_show (button); 03870 03871 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Sports"); 03872 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03873 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_cat), (gpointer) "Sports"); 03874 gtk_widget_show (button); 03875 03876 separator = gtk_hseparator_new (); 03877 gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); 03878 gtk_widget_show (separator); 03879 03880 box2 = gtk_vbox_new (FALSE, 10); 03881 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 03882 gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); 03883 gtk_widget_show (box2); 03884 03885 button = gtk_button_new_with_label ("Enter"); 03886 g_signal_connect_swapped (G_OBJECT (button), "clicked", 03887 G_CALLBACK (close_application), 03888 G_OBJECT (window)); 03889 03890 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03891 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 03892 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_cat), (gpointer) "button"); 03893 gtk_widget_grab_default (button); 03894 gtk_widget_show (button); 03895 gtk_widget_show (window); 03896 03897 gtk_main (); 03898 }
void create_movie | ( | ) |
create_movie creates the movie quiz.
after selection of movie in main quiz page and clicking click button. movie quiz page will open.
void |
Definition at line 3039 of file quiz.c.
References answer_m(), button, callback_m(), close_application(), and window.
Referenced by answer_cat().
03040 { 03041 GtkWidget *window = NULL; 03042 GtkWidget *box1; 03043 GtkWidget *box2; 03044 GtkWidget *button; 03045 GtkWidget *separator; 03046 GtkWidget *question; 03047 03048 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 03049 03050 gtk_window_set_default_size(GTK_WINDOW(window),340,200); 03051 gtk_window_set_title (GTK_WINDOW (window), "Quizzes"); 03052 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 03053 03054 box1 = gtk_vbox_new (FALSE, 0); 03055 gtk_container_add (GTK_CONTAINER (window), box1); 03056 gtk_widget_show (box1); 03057 03058 box2 = gtk_vbox_new (FALSE, 10); 03059 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 03060 gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); 03061 gtk_widget_show (box2); 03062 03063 question=gtk_label_new("Choose Movie"); 03064 gtk_box_pack_start (GTK_BOX (box2), question, TRUE, TRUE, 0); 03065 gtk_widget_show(question); 03066 03067 button = gtk_radio_button_new_with_label (NULL, "Cartoons"); 03068 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03069 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_m), (gpointer) "Cartoons"); 03070 gtk_widget_show (button); 03071 03072 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Epic"); 03073 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03074 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_m), (gpointer) "Epic"); 03075 gtk_widget_show (button); 03076 03077 button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), "Comedy"); 03078 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03079 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_m), (gpointer) "Comedy"); 03080 gtk_widget_show (button); 03081 03082 separator = gtk_hseparator_new (); 03083 gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); 03084 gtk_widget_show (separator); 03085 03086 box2 = gtk_vbox_new (FALSE, 10); 03087 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 03088 gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); 03089 gtk_widget_show (box2); 03090 03091 button = gtk_button_new_with_label ("Enter"); 03092 g_signal_connect_swapped (G_OBJECT (button), "clicked", 03093 G_CALLBACK (close_application), 03094 G_OBJECT (window)); 03095 03096 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03097 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 03098 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_m), (gpointer) "button"); 03099 gtk_widget_grab_default (button); 03100 gtk_widget_show (button); 03101 gtk_widget_show (window); 03102 03103 gtk_main (); 03104 03105 }
void create_register | ( | ) |
create_register creates a register page for new user to register.
void |
Definition at line 4010 of file quiz.c.
References button, callback_clear(), callback_reg(), close_application(), delete_cancel(), delete_event_reg(), enter_callback_register(), entry_name, entry_passwordr, entry_roll, entry_usernamer, label, table, and window.
Referenced by callback_register().
04011 { 04012 GtkWidget *window; 04013 GtkWidget *button; 04014 GtkWidget *table; 04015 04016 GtkWidget *label; 04017 04018 04019 /* Create a new window */ 04020 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 04021 04022 /* Set the window size */ 04023 gtk_window_set_default_size(GTK_WINDOW(window),50,50); 04024 04025 /* Set the window title */ 04026 gtk_window_set_title (GTK_WINDOW (window), "Login"); 04027 04028 /* Set a handler for delete_event that immediately 04029 * exits GTK. */ 04030 g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event_reg), NULL); 04031 04032 /* Sets the border width of the window. */ 04033 gtk_container_set_border_width (GTK_CONTAINER (window), 10); 04034 04035 table = gtk_table_new (2, 2, TRUE); 04036 04037 /* Put the table in the main window */ 04038 gtk_container_add (GTK_CONTAINER (window), table); 04039 04040 //Label for Name 04041 label=gtk_label_new("Name:"); 04042 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); 04043 gtk_widget_show (label); 04044 04045 //Label for Roll No. 04046 label=gtk_label_new("Roll No.:"); 04047 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); 04048 gtk_widget_show (label); 04049 04050 //Label for Username 04051 label=gtk_label_new("Username:"); 04052 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); 04053 gtk_widget_show (label); 04054 04055 //Label for Password 04056 label=gtk_label_new("Password:"); 04057 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); 04058 gtk_widget_show (label); 04059 04060 //Textbox for Name 04061 entry_name = gtk_entry_new (); 04062 g_signal_connect (G_OBJECT (entry_name), "activate", G_CALLBACK (enter_callback_register), (gpointer) entry_name); 04063 gtk_table_attach_defaults (GTK_TABLE (table), entry_name, 1, 2, 0, 1); 04064 gtk_widget_show (entry_name); 04065 04066 //Textbox for Roll No. 04067 entry_roll = gtk_entry_new (); 04068 g_signal_connect (G_OBJECT (entry_roll), "activate", G_CALLBACK (enter_callback_register), (gpointer) entry_roll); 04069 gtk_table_attach_defaults (GTK_TABLE (table), entry_roll, 1, 2, 1, 2); 04070 gtk_widget_show (entry_roll); 04071 04072 //Textbox for Username 04073 entry_usernamer = gtk_entry_new (); 04074 g_signal_connect (G_OBJECT (entry_usernamer), "activate", G_CALLBACK (enter_callback_register), (gpointer) entry_usernamer); 04075 gtk_table_attach_defaults (GTK_TABLE (table), entry_usernamer, 1, 2, 2, 3); 04076 gtk_widget_show (entry_usernamer); 04077 04078 //Textbox for Password 04079 entry_passwordr = gtk_entry_new (); 04080 g_signal_connect (G_OBJECT (entry_passwordr), "activate", G_CALLBACK (gtk_entry_set_visibility), (gpointer) entry_passwordr); 04081 gtk_entry_set_text (GTK_ENTRY (entry_passwordr), ""); 04082 gtk_editable_select_region (GTK_EDITABLE (entry_passwordr), 0, GTK_ENTRY (entry_passwordr)->text_length); 04083 gtk_table_attach_defaults (GTK_TABLE (table), entry_passwordr, 1, 2, 3, 4); 04084 gtk_widget_show (entry_passwordr); 04085 04086 04087 04088 /* Create Register button */ 04089 button = gtk_button_new_with_label ("Register"); 04090 g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback_reg), (gpointer) "Register"); 04091 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 5, 6); 04092 gtk_widget_show (button); 04093 04094 /* Create Clear button */ 04095 button = gtk_button_new_with_label ("Clear"); 04096 g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback_clear), (gpointer) "Clear"); 04097 gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 5, 6); 04098 gtk_widget_show (button); 04099 04100 g_signal_connect_swapped (G_OBJECT (button), "clicked", 04101 G_CALLBACK (close_application), 04102 G_OBJECT (window)); 04103 04104 04105 /* Create Cancel button */ 04106 button = gtk_button_new_with_label ("Cancel"); 04107 g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (delete_cancel), (gpointer) "Cancel"); 04108 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 6, 7); 04109 gtk_widget_show (button); 04110 04111 04112 gtk_widget_show (table); 04113 gtk_widget_show (window); 04114 04115 04116 }
void create_sports | ( | ) |
create_main creates the main page of sports category.
after selection of sports in quiz page and clicking click button. sports category page will be created.
void |
Definition at line 3719 of file quiz.c.
References answer_sport(), button, callback_sport(), close_application(), and window.
Referenced by answer_cat().
03720 { 03721 GtkWidget *window = NULL; 03722 GtkWidget *box1; 03723 GtkWidget *box2; 03724 GtkWidget *button; 03725 GtkWidget *separator; 03726 GtkWidget *question; 03727 03728 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 03729 03730 gtk_window_set_default_size(GTK_WINDOW(window),340,200); 03731 03732 gtk_window_set_title (GTK_WINDOW (window), "Sports"); 03733 gtk_container_set_border_width (GTK_CONTAINER (window), 0); 03734 03735 box1 = gtk_vbox_new (FALSE, 0); 03736 gtk_container_add (GTK_CONTAINER (window), box1); 03737 gtk_widget_show (box1); 03738 03739 box2 = gtk_vbox_new (FALSE, 10); 03740 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 03741 gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); 03742 gtk_widget_show (box2); 03743 03744 question=gtk_label_new("Choose Sport"); 03745 gtk_box_pack_start (GTK_BOX (box2), question, TRUE, TRUE, 0); 03746 gtk_widget_show(question); 03747 03748 button = gtk_radio_button_new_with_label (NULL, "Cricket"); 03749 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03750 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(answer_sport), (gpointer) "Cricket"); 03751 gtk_widget_show (button); 03752 03753 separator = gtk_hseparator_new (); 03754 gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); 03755 gtk_widget_show (separator); 03756 03757 box2 = gtk_vbox_new (FALSE, 10); 03758 gtk_container_set_border_width (GTK_CONTAINER (box2), 10); 03759 gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); 03760 gtk_widget_show (box2); 03761 03762 button = gtk_button_new_with_label ("Enter"); 03763 g_signal_connect_swapped (G_OBJECT (button), "clicked", 03764 G_CALLBACK (close_application), 03765 G_OBJECT (window)); 03766 03767 03768 gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); 03769 GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 03770 gtk_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(callback_sport), (gpointer) "button"); 03771 gtk_widget_grab_default (button); 03772 gtk_widget_show (button); 03773 gtk_widget_show (window); 03774 03775 gtk_main (); 03776 03777 03778 }
gboolean delete_cancel | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 3970 of file quiz.c.
Referenced by create_register().
static gboolean delete_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) | [static] |
It is called when user tries to close window using window manager.
We will always disable closing of window using window manager.
widget1 | Widget which generated the event | |
data | any additional data passed while generating signal |
Definition at line 4204 of file quiz.c.
Referenced by main().
static gboolean delete_event_reg | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | data | |||
) | [static] |
Definition at line 3962 of file quiz.c.
Referenced by create_register().
void destroy | ( | GtkWidget * | widget, | |
gpointer | data | |||
) |
Definition at line 343 of file quiz.c.
Referenced by create_cartoon(), create_comedy(), create_computer(), create_cricket(), create_epic(), and create_human().
void display_row | ( | ) |
display_row used to retreive data from database.
void |
Definition at line 86 of file quiz.c.
References cnt, connection1, r5, and sqlrow.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_hb(), answer_toon(), and callback_login().
00087 { 00088 unsigned int field_count; 00089 field_count = 0; 00090 cnt=1; 00091 printf("\n<"); 00092 while (field_count < mysql_field_count (connection1)) 00093 { 00094 if(field_count==0) //Means its a roll number 00095 { 00096 strcpy(r5,sqlrow[0]); 00097 break; 00098 } 00099 00100 } 00101 printf (">\n"); 00102 }
static void enter_callback | ( | GtkWidget * | widget, | |
GtkWidget * | entry | |||
) | [static] |
static void enter_callback_register | ( | GtkWidget * | widget, | |
GtkWidget * | entry | |||
) | [static] |
enter_callback_register is for text entry in text area in register page.
if clear button pressed.
entry | is a pointer to the textbox(GTK_ENTRY) used to get data from the user. |
Definition at line 3981 of file quiz.c.
Referenced by create_register().
03983 { 03984 const gchar *entry_text; 03985 entry_text = gtk_entry_get_text (GTK_ENTRY (entry)); 03986 printf ("Entry contents: %s\n", entry_text); 03987 }
int main | ( | int | argc, | |
char * | argv[] | |||
) |
This is where program execution starts.
This is the main login window. where new user can click on register button to register and old user can login directly.All arguments are passed to gtk for processing, which removes any arguments relevant to it. All other arguments are ignored.
argc | Number of arguments passed. | |
argv | NULL terminated array of command line arguments. |
Definition at line 4230 of file quiz.c.
References button, callback_login(), callback_register(), close_application(), create_database(), delete_event(), enter_callback(), entry_password, entry_username, label, table, and window.
04232 { 04233 create_database(); 04234 04235 gtk_init (&argc, &argv); 04236 /* Create a new window */ 04237 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); 04238 04239 /* Set the window size */ 04240 gtk_window_set_default_size(GTK_WINDOW(window),50,50); 04241 04242 /* Set the window title */ 04243 gtk_window_set_title (GTK_WINDOW (window), "Login"); 04244 04245 /* Set a handler for delete_event that immediately 04246 * exits GTK. */ 04247 g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event), NULL); 04248 04249 /* Sets the border width of the window. */ 04250 gtk_container_set_border_width (GTK_CONTAINER (window), 10); 04251 04252 table = gtk_table_new (2, 2, TRUE); 04253 04254 /* Put the table in the main window */ 04255 gtk_container_add (GTK_CONTAINER (window), table); 04256 04257 04258 //Textbox for Username 04259 entry_username = gtk_entry_new (); 04260 g_signal_connect (G_OBJECT (entry_username), "activate", G_CALLBACK (enter_callback), (gpointer) entry_username); 04261 gtk_entry_set_text (GTK_ENTRY (entry_username), ""); 04262 gtk_editable_select_region (GTK_EDITABLE (entry_username), 0, GTK_ENTRY (entry_username)->text_length); 04263 gtk_table_attach_defaults (GTK_TABLE (table), entry_username, 1, 2, 0, 1); 04264 gtk_widget_show (entry_username); 04265 04266 //Textbox for Password 04267 entry_password = gtk_entry_new (); 04268 g_signal_connect (G_OBJECT (entry_password), "activate", G_CALLBACK (gtk_entry_set_visibility), (gpointer) entry_password); 04269 gtk_entry_set_text (GTK_ENTRY (entry_password), ""); 04270 gtk_editable_select_region (GTK_EDITABLE (entry_password), 0, GTK_ENTRY (entry_password)->text_length); 04271 gtk_table_attach_defaults (GTK_TABLE (table), entry_password, 1, 2, 1, 2); 04272 gtk_widget_show (entry_password); 04273 04274 label=gtk_label_new("Username"); 04275 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1); 04276 gtk_widget_show (label); 04277 04278 label=gtk_label_new("Password"); 04279 gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2); 04280 gtk_widget_show (label); 04281 04282 04283 /* Create Login button */ 04284 button = gtk_button_new_with_label ("Login"); 04285 g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback_login), (gpointer) "Login"); 04286 gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 3, 4); 04287 gtk_widget_show (button); 04288 04289 04290 g_signal_connect_swapped (G_OBJECT (button), "clicked", 04291 G_CALLBACK (close_application), 04292 G_OBJECT (window)); 04293 /* Create Register button */ 04294 button = gtk_button_new_with_label ("Register"); 04295 g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (callback_register), (gpointer) "Register"); 04296 gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 3, 4); 04297 gtk_widget_show (button); 04298 04299 04300 gtk_widget_show (table); 04301 gtk_widget_show (window); 04302 04303 gtk_main (); 04304 04305 return 0; 04306 }
char ans[100] |
Definition at line 18 of file quiz.c.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_hb(), answer_toon(), and callback_cat().
GtkWidget* button |
Definition at line 114 of file quiz.c.
Referenced by create_cartoon(), create_comedy(), create_computer(), create_cricket(), create_epic(), create_general(), create_human(), create_main(), create_movie(), create_register(), create_sports(), and main().
int cnt = 0 |
Definition at line 16 of file quiz.c.
Referenced by callback_login(), and display_row().
MYSQL* connection1 |
Definition at line 12 of file quiz.c.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_hb(), answer_toon(), callback_login(), callback_reg(), create_database(), and display_row().
MYSQL * connection2 |
GtkWidget* entry_name |
Definition at line 120 of file quiz.c.
Referenced by callback_clear(), callback_reg(), and create_register().
GtkWidget * entry_password |
Definition at line 117 of file quiz.c.
Referenced by callback_login(), and main().
GtkWidget * entry_passwordr |
Definition at line 120 of file quiz.c.
Referenced by callback_clear(), callback_reg(), and create_register().
GtkWidget * entry_roll |
Definition at line 120 of file quiz.c.
Referenced by callback_clear(), callback_reg(), and create_register().
GtkWidget* entry_username |
Definition at line 117 of file quiz.c.
Referenced by callback_login(), and main().
GtkWidget * entry_usernamer |
Definition at line 120 of file quiz.c.
Referenced by callback_clear(), callback_reg(), and create_register().
int flag_cat = 0 |
Definition at line 1260 of file quiz.c.
Referenced by answer_cat(), and callback_cat().
int flag_gk = 0 |
Definition at line 124 of file quiz.c.
Referenced by answer_gen(), and callback_gen().
int flag_sport = 0 |
Definition at line 3117 of file quiz.c.
Referenced by answer_sport(), and callback_sport().
int flag_toon = 0 |
Definition at line 1342 of file quiz.c.
Referenced by answer_m(), and callback_m().
GtkWidget* label |
Definition at line 118 of file quiz.c.
Referenced by create_register(), and main().
char n[10] |
Definition at line 19 of file quiz.c.
Referenced by callback_reg().
char option_cat[50] |
char option_com[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com().
char option_com1[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com1().
char option_com2[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com2().
char option_com3[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com3().
char option_com4[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com4().
char option_com5[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com5().
char option_com6[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com6().
char option_com7[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com7().
char option_com8[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com8().
char option_com9[50] |
Definition at line 2433 of file quiz.c.
Referenced by answer_com(), and callback_com9().
char option_comp[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp().
char option_comp1[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp1().
char option_comp2[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp2().
char option_comp3[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp3().
char option_comp4[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp4().
char option_comp5[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp5().
char option_comp6[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp6().
char option_comp7[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp7().
char option_comp8[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp8().
char option_comp9[50] |
Definition at line 674 of file quiz.c.
Referenced by answer_comp(), and callback_comp9().
char option_crick[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick().
char option_crick1[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick1().
char option_crick2[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick2().
char option_crick3[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick3().
char option_crick4[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick4().
char option_crick5[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick5().
char option_crick6[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick6().
char option_crick7[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick7().
char option_crick8[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick8().
char option_crick9[50] |
Definition at line 3119 of file quiz.c.
Referenced by answer_crick(), and callback_crick9().
char option_epic[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic().
char option_epic1[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic1().
char option_epic2[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic2().
char option_epic3[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic3().
char option_epic4[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic4().
char option_epic5[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic5().
char option_epic6[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic6().
char option_epic7[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic7().
char option_epic8[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic8().
char option_epic9[50] |
Definition at line 1891 of file quiz.c.
Referenced by answer_epic(), and callback_epic9().
char option_gen[50] |
char option_hb[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb().
char option_hb1[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb1().
char option_hb2[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb2().
char option_hb3[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb3().
char option_hb4[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb4().
char option_hb5[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb5().
char option_hb6[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb6().
char option_hb7[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb7().
char option_hb8[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb8().
char option_hb9[50] |
Definition at line 126 of file quiz.c.
Referenced by answer_hb(), and callback_hb9().
char option_sport[50] |
char option_toon[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon().
char option_toon1[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon1().
char option_toon2[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon2().
char option_toon3[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon3().
char option_toon4[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon4().
char option_toon5[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon5().
char option_toon6[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon6().
char option_toon7[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon7().
char option_toon8[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon8().
char option_toon9[50] |
Definition at line 1344 of file quiz.c.
Referenced by answer_toon(), and callback_toon9().
char p[100] |
Definition at line 23 of file quiz.c.
Referenced by callback_login(), and callback_reg().
char r5[100] |
Definition at line 21 of file quiz.c.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_hb(), answer_toon(), callback_reg(), and display_row().
MYSQL_RES* result |
Definition at line 13 of file quiz.c.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_hb(), answer_toon(), callback_login(), and create_database().
MYSQL_ROW sqlrow |
Definition at line 14 of file quiz.c.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_hb(), answer_toon(), callback_login(), create_database(), and display_row().
char subans[100] |
Definition at line 18 of file quiz.c.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_gen(), answer_hb(), answer_m(), answer_toon(), and callback_sport().
GtkWidget* table |
Definition at line 115 of file quiz.c.
Referenced by create_cartoon(), create_comedy(), create_computer(), create_cricket(), create_epic(), create_human(), create_register(), and main().
char u[100] |
Definition at line 22 of file quiz.c.
Referenced by callback_login(), and callback_reg().
char user[100] |
Definition at line 17 of file quiz.c.
Referenced by answer_com(), answer_comp(), answer_crick(), answer_epic(), answer_hb(), and answer_toon().
GtkWidget* window |
Definition at line 113 of file quiz.c.
Referenced by create_cartoon(), create_comedy(), create_computer(), create_cricket(), create_epic(), create_general(), create_human(), create_main(), create_movie(), create_register(), create_sports(), and main().