PageRenderTime 99ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/0.2-release/gtk-facemanager.c

http://pam-face-authentication.googlecode.com/
C | 603 lines | 520 code | 54 blank | 29 comment | 58 complexity | 53e7915fe86729d1417f1f9335c14d23 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. /*
  2. Copyright (C) 2008 Rohan Anil (rohan.anil@gmail.com) , Alex Lau ( avengermojo@gmail.com)
  3. Google Summer of Code Program 2008
  4. Mentoring Organization: openSUSE
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include <gtk/gtk.h>
  17. #include "highgui.h"
  18. #include "cv.h"
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <assert.h>
  23. #include <math.h>
  24. #include <float.h>
  25. #include <limits.h>
  26. #include <time.h>
  27. #include <ctype.h>
  28. #include <dlfcn.h>
  29. #include <sys/types.h>
  30. #include <sys/ipc.h>
  31. #include <sys/shm.h>
  32. #include <unistd.h>
  33. #include "pam_face_defines.h"
  34. extern char *HAAR_CASCADE_FACE;
  35. extern char *HAAR_CASCADE_EYE;
  36. extern char *HAAR_CASCADE_NOSE;
  37. extern char *path;
  38. extern char *imgPath;
  39. extern char *imgExt;
  40. extern char *GTK_FACE_AUTHENTICATE;
  41. extern char *XAUTH_EXTRACT_FILE;
  42. extern char *XAUTHDISPLAY_EXTRACT_FILE;
  43. extern char *GTK_FACE_MANAGER_KEY;
  44. extern char *XML_GTK_BUILDER_FACE_MANAGER;
  45. GtkBuilder *builder;
  46. GtkBuilder *builderIN;
  47. IplImage *frame,*frameNew, *frame_copy = 0;
  48. CvPoint pLeftEye;
  49. CvPoint pRightEye;
  50. CvCapture* capture;
  51. int captureFace=-1;
  52. int numberOfFacesToCapture=6;
  53. void *handleFaceDetect;
  54. void *handleFaceConfigure;
  55. char* NONE_SELECTED="No User Selected";
  56. enum
  57. {
  58. USER_NAME = 0,
  59. STATUS,
  60. N_COLUMNS
  61. };
  62. void loadCVPIXBUF(GtkWidget *imgCapturedFace,IplImage* image)
  63. {
  64. unsigned char *gdataUserFace;
  65. GdkPixbuf *pixbufUserFace= NULL;
  66. pixbufUserFace = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE,8,image->width,image->height);
  67. gdataUserFace = gdk_pixbuf_get_pixels(pixbufUserFace);
  68. int m,n;
  69. for (n=0;n<image->height;n++)
  70. {
  71. for (m= 0;m<image->width;m++)
  72. {
  73. CvScalar s;
  74. s=cvGet2D(image,n,m);
  75. gdataUserFace[n*image->width*3 + m*3 +0]=(uchar)s.val[2];
  76. gdataUserFace[n*image->width*3 + m*3 +1]=(uchar)s.val[1];
  77. gdataUserFace[n*image->width*3 + m*3 +2]=(uchar)s.val[0];
  78. }
  79. }
  80. gtk_image_set_from_pixbuf(imgCapturedFace, pixbufUserFace);
  81. g_object_unref (pixbufUserFace);
  82. }
  83. void loadFaceImage(char *fullPath,GtkWidget *img)
  84. {
  85. IplImage* image =0;
  86. image=cvLoadImage( fullPath, 1 );
  87. if (image!=NULL)
  88. loadCVPIXBUF(img,image);
  89. else
  90. {
  91. image= cvCreateImage( cvSize(120,140),8,1);
  92. cvZero(image);
  93. loadCVPIXBUF(img,image);
  94. }
  95. }
  96. void saveConfigFile()
  97. {
  98. FILE *file1;
  99. GtkWidget *tvList;
  100. tvList = GTK_WIDGET (gtk_builder_get_object (builder, "tvList"));
  101. GtkListStore *store;
  102. GtkTreeModel *model;
  103. GtkTreeIter iter;
  104. store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW (tvList)));
  105. model = gtk_tree_view_get_model (GTK_TREE_VIEW (tvList));
  106. if (file1 = fopen(GTK_FACE_MANAGER_KEY, "w"))
  107. {
  108. if (gtk_tree_model_get_iter_first(model, &iter) != FALSE)
  109. {
  110. char *value,*value1;
  111. char *fullPath;
  112. char * t="Assigned";
  113. gtk_tree_model_get(model, &iter, USER_NAME, &value,STATUS, &value1, -1);
  114. if (strcmp(value1,t)==0)
  115. {
  116. // no itoa
  117. int i;
  118. for (i=1;i<7;i++)
  119. {
  120. char * ch=(char *)calloc(2,sizeof(char));
  121. if (i==1)
  122. strcat(ch,"1");
  123. if (i==2)
  124. strcat(ch,"2");
  125. if (i==3)
  126. strcat(ch,"3");
  127. if (i==4)
  128. strcat(ch,"4");
  129. if (i==5)
  130. strcat(ch,"5");
  131. if (i==6)
  132. strcat(ch,"6");
  133. fullPath=(char *)calloc( strlen(imgPath) + strlen(value)+strlen(imgExt)+2,sizeof(char));
  134. strcat(fullPath,imgPath);
  135. strcat(fullPath,value);
  136. strcat(fullPath,ch);
  137. strcat(fullPath,imgExt);
  138. fprintf(file1,"%s %s\n",value, fullPath);
  139. }
  140. }
  141. g_free(value);
  142. g_free(value1);
  143. while (gtk_tree_model_iter_next (model, &iter)!=FALSE)
  144. {
  145. gtk_tree_model_get(model, &iter, USER_NAME, &value,STATUS, &value1, -1);
  146. if (strcmp(value1,t)==0)
  147. {
  148. int i;
  149. for (i=1;i<7;i++)
  150. {
  151. char * ch=(char *)calloc(2,sizeof(char));
  152. if (i==1)
  153. strcat(ch,"1");
  154. if (i==2)
  155. strcat(ch,"2");
  156. if (i==3)
  157. strcat(ch,"3");
  158. if (i==4)
  159. strcat(ch,"4");
  160. if (i==5)
  161. strcat(ch,"5");
  162. if (i==6)
  163. strcat(ch,"6");
  164. fullPath=(char *)calloc( strlen(imgPath) + strlen(value)+strlen(imgExt)+2,sizeof(char));
  165. strcat(fullPath,imgPath);
  166. strcat(fullPath,value);
  167. strcat(fullPath,ch);
  168. strcat(fullPath,imgExt);
  169. fprintf(file1,"%s %s\n",value, fullPath);
  170. }
  171. }
  172. }
  173. }
  174. }
  175. // printf("dleror is %s \n",dlerror());
  176. fclose(file1);
  177. }
  178. void
  179. on_btnSSave_clicked (GtkButton *button,gpointer user_data)
  180. {
  181. saveConfigFile();
  182. // learn();
  183. GtkWidget *inpDialog;
  184. inpDialog = GTK_WIDGET (gtk_builder_get_object (builder, "dlgSampleFace"));
  185. gtk_widget_hide(inpDialog);
  186. }
  187. void
  188. on_btnInpOk_clicked (GtkButton *button,gpointer user_data)
  189. {
  190. GtkWidget *inpDialog;
  191. inpDialog = GTK_WIDGET (gtk_builder_get_object (builder, "dlgInputUserName"));
  192. char *text[2];
  193. char *b="Not Assigned";
  194. text[0]=(char *)gtk_entry_get_text (GTK_ENTRY(GTK_WIDGET (gtk_builder_get_object (builder, "entUserName"))));
  195. text[1]=b;
  196. GtkListStore *store;
  197. GtkTreeIter iter;
  198. store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(GTK_WIDGET (gtk_builder_get_object (builder, "tvList")))));
  199. gtk_list_store_append(store, &iter);
  200. gtk_list_store_set(store, &iter, USER_NAME, text[0],STATUS,text[1], -1);
  201. gtk_widget_hide(inpDialog);
  202. }
  203. void
  204. on_btnSCancel_clicked (GtkButton *button,gpointer user_data)
  205. {
  206. GtkWidget *inpDialog;
  207. inpDialog = GTK_WIDGET (gtk_builder_get_object (builder, "dlgSampleFace"));
  208. gtk_widget_hide(inpDialog);
  209. }
  210. void
  211. on_btnSFace_clicked (GtkButton *button,gpointer user_data)
  212. {
  213. captureFace=6;
  214. }
  215. void
  216. on_btnInpCancel_clicked (GtkButton *button,gpointer user_data)
  217. {
  218. GtkWidget *inpDialog;
  219. inpDialog = GTK_WIDGET (gtk_builder_get_object (builder, "dlgInputUserName"));
  220. gtk_widget_hide(inpDialog);
  221. }
  222. char * fileNameImage(char *ch,char *value)
  223. {
  224. char *fullPath;
  225. fullPath=(char *)calloc( strlen(imgPath) + strlen(value)+strlen(imgExt)+2,sizeof(char));
  226. strcat(fullPath,imgPath);
  227. strcat(fullPath,value);
  228. strcat(fullPath,ch);
  229. strcat(fullPath,imgExt);
  230. return fullPath;
  231. }
  232. void
  233. on_btnTrain_clicked (GtkButton *button,gpointer user_data)
  234. {
  235. GtkTreeSelection *selection;
  236. GtkWidget *tvList;
  237. tvList = GTK_WIDGET (gtk_builder_get_object (builder, "tvList"));
  238. selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tvList));
  239. GtkTreeIter iter;
  240. GtkTreeModel *model;
  241. char *value;
  242. if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(selection), &model, &iter))
  243. {
  244. gtk_tree_model_get(model, &iter, USER_NAME, &value, -1);
  245. intializePaths(value);
  246. GtkResponseType val;
  247. GtkWidget *inpDialog;
  248. GtkWidget *imgS;
  249. inpDialog = GTK_WIDGET (gtk_builder_get_object (builder, "dlgSampleFace"));
  250. IplImage *face;
  251. face = cvCreateImage( cvSize(120,140),8,3);
  252. cvZero(face);
  253. face=cvLoadImage(fileNameImage("1",value), 1 );
  254. if (face!=0)
  255. {
  256. imgS = GTK_WIDGET (gtk_builder_get_object (builder, "imgS1"));
  257. loadCVPIXBUF(imgS,face);
  258. }
  259. face=cvLoadImage(fileNameImage("2",value), 1 );
  260. if (face!=0)
  261. {
  262. imgS = GTK_WIDGET (gtk_builder_get_object (builder, "imgS2"));
  263. loadCVPIXBUF(imgS,face);
  264. }
  265. face=cvLoadImage(fileNameImage("3",value), 1 );
  266. if (face!=0)
  267. {
  268. imgS = GTK_WIDGET (gtk_builder_get_object (builder, "imgS3"));
  269. loadCVPIXBUF(imgS,face);
  270. }
  271. face=cvLoadImage(fileNameImage("4",value), 1 );
  272. if (face!=0)
  273. {
  274. imgS = GTK_WIDGET (gtk_builder_get_object (builder, "imgS4"));
  275. loadCVPIXBUF(imgS,face);
  276. }
  277. face=cvLoadImage(fileNameImage("5",value), 1 );
  278. if (face!=0)
  279. {
  280. imgS = GTK_WIDGET (gtk_builder_get_object (builder, "imgS5"));
  281. loadCVPIXBUF(imgS,face);
  282. }
  283. face=cvLoadImage(fileNameImage("6",value), 1 );
  284. if (face!=0)
  285. {
  286. imgS = GTK_WIDGET (gtk_builder_get_object (builder, "imgS6"));
  287. loadCVPIXBUF(imgS,face);
  288. }
  289. val=gtk_dialog_run(GTK_DIALOG(inpDialog));
  290. }
  291. }
  292. void
  293. on_btnAbout_clicked (GtkButton *button,gpointer user_data)
  294. {
  295. GtkWidget *dialog = gtk_about_dialog_new();
  296. gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(dialog), "PAM FACE AUTHENTICATION");
  297. gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), "0.1");
  298. gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),"Work done during Google Summer of Code 2008 for openSUSE");
  299. gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog),
  300. "PAM Module for Face Recognition.");
  301. gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog),
  302. "http://code.google.com/p/pam-face-authentication/");
  303. gtk_dialog_run(GTK_DIALOG (dialog));
  304. gtk_widget_destroy(dialog);
  305. }
  306. GtkResponseType showYesNo(char * str)
  307. {
  308. GtkResponseType response;
  309. GtkWidget *dialog;
  310. dialog = gtk_message_dialog_new(NULL,GTK_DIALOG_DESTROY_WITH_PARENT,
  311. GTK_MESSAGE_QUESTION,GTK_BUTTONS_YES_NO,
  312. str);
  313. gtk_window_set_title(GTK_WINDOW(dialog), "Face Manager");
  314. response=gtk_dialog_run(GTK_DIALOG(dialog));
  315. gtk_widget_destroy(dialog);
  316. return response;
  317. }
  318. void
  319. on_btnCaptureFace_clicked (GtkButton *button,gpointer user_data)
  320. {
  321. captureFace=6;
  322. }
  323. void
  324. on_btnQuit_clicked (GtkButton *button,gpointer user_data)
  325. {
  326. char * str= "Are you sure to quit?";
  327. if (showYesNo(str)==GTK_RESPONSE_YES)
  328. {
  329. gtk_main_quit();
  330. }
  331. }
  332. void
  333. on_btnAdd_clicked (GtkButton *button,gpointer user_data)
  334. {
  335. GtkResponseType val;
  336. GtkWidget *inpDialog;
  337. inpDialog = GTK_WIDGET (gtk_builder_get_object (builder, "dlgInputUserName"));
  338. val=gtk_dialog_run(GTK_DIALOG(inpDialog));
  339. gtk_widget_hide(inpDialog);
  340. }
  341. void
  342. on_btnRemove_clicked (GtkButton *button,gpointer user_data)
  343. {
  344. GtkWidget *tvList;
  345. tvList = GTK_WIDGET (gtk_builder_get_object (builder, "tvList"));
  346. GtkListStore *store;
  347. GtkTreeModel *model;
  348. GtkTreeIter iter;
  349. GtkTreeSelection *selection;
  350. selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tvList));
  351. store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW (tvList)));
  352. model = gtk_tree_view_get_model (GTK_TREE_VIEW (tvList));
  353. if (gtk_tree_model_get_iter_first(model, &iter) == FALSE)
  354. return;
  355. if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(selection),&model, &iter))
  356. {
  357. char * str= "Do you want to remove from the List?";
  358. if (showYesNo(str)==GTK_RESPONSE_YES)
  359. {
  360. gtk_list_store_remove(store, &iter);
  361. saveConfigFile();
  362. }
  363. }
  364. }
  365. static void
  366. init_list(GtkWidget *list)
  367. {
  368. GtkCellRenderer *renderer;
  369. GtkTreeViewColumn *column;
  370. GtkListStore *store;
  371. renderer = gtk_cell_renderer_text_new();
  372. column = gtk_tree_view_column_new_with_attributes("User Name",renderer, "text", USER_NAME, NULL);
  373. gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
  374. column = gtk_tree_view_column_new_with_attributes("Status",renderer, "text", STATUS, NULL);
  375. gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
  376. store = gtk_list_store_new(N_COLUMNS, G_TYPE_STRING,G_TYPE_STRING);
  377. gtk_tree_view_set_model(GTK_TREE_VIEW(list),GTK_TREE_MODEL(store));
  378. g_object_unref(store);
  379. }
  380. static void
  381. add_to_list(GtkWidget *list, const gchar *str1,const gchar *str2)
  382. {
  383. GtkListStore *store;
  384. GtkTreeIter iter;
  385. store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list)));
  386. gtk_list_store_append(store, &iter);
  387. gtk_list_store_set(store, &iter, USER_NAME, str1,STATUS, str2,-1);
  388. }
  389. void createListItems(GtkWidget *tvList)
  390. {
  391. char tempUserName[512];
  392. char imgFilename[512];
  393. FILE* file1;
  394. if (file1 = fopen(GTK_FACE_MANAGER_KEY, "r"))
  395. {
  396. while (fscanf(file1,"%s %s", tempUserName, imgFilename)!=EOF )
  397. {
  398. int i=0;
  399. for (i=0;i<5;i++)
  400. fscanf(file1,"%s %s", tempUserName, imgFilename);
  401. char *text[2];
  402. char *b="Assigned";
  403. text[0]=tempUserName;
  404. text[1]=b;
  405. add_to_list(tvList, text[0],b);
  406. }
  407. }
  408. }
  409. static gboolean time_handler(GtkWidget *widget)
  410. {
  411. if (widget->window == NULL) return FALSE;
  412. if ( !cvGrabFrame( capture ))
  413. return FALSE;
  414. frame = cvRetrieveFrame( capture );
  415. if ( !frame )
  416. return FALSE;
  417. if ( !frame_copy )
  418. {
  419. frame_copy = cvCreateImage( cvSize(frame->width,frame->height),IPL_DEPTH_8U, frame->nChannels );
  420. frameNew = cvCreateImage( cvSize(frame->width,frame->height),IPL_DEPTH_8U, frame->nChannels );
  421. }
  422. if ( frame->origin == IPL_ORIGIN_TL )
  423. cvCopy( frame, frame_copy, 0 );
  424. else
  425. cvFlip( frame, frame_copy, 0 );
  426. cvCopy( frame_copy, frameNew, 0 );
  427. allocateMemory();
  428. int k= faceDetect(frame_copy,&pLeftEye,&pRightEye);
  429. if (k==1 && captureFace>0)
  430. {
  431. IplImage *face;
  432. face = cvCreateImage( cvSize(120,140),8,1);
  433. int j= preprocess(frameNew,pLeftEye,pRightEye,face);
  434. GtkTreeIter iter;
  435. GtkTreeModel *model;
  436. char *value;
  437. char *b="Assigned";
  438. GtkListStore *store;
  439. GtkWidget *widget;
  440. GtkWidget *selection;
  441. widget = GTK_WIDGET (gtk_builder_get_object (builder, "tvList"));
  442. selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
  443. if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(selection), &model, &iter))
  444. {
  445. gtk_tree_model_get(model, &iter, USER_NAME, &value, -1);
  446. char *fullPath;
  447. fullPath=(char *)calloc( strlen(imgPath) + strlen(value)+strlen(imgExt)+1+1,sizeof(char));
  448. strcat(fullPath,imgPath);
  449. strcat(fullPath,value);
  450. char * ch=(char *)calloc(2,sizeof(char));
  451. GtkWidget *imgS;
  452. if ((numberOfFacesToCapture-captureFace)==0)
  453. {
  454. strcat(ch,"1");
  455. imgS = GTK_WIDGET (gtk_builder_get_object (builder,"imgS1"));
  456. }
  457. if ((numberOfFacesToCapture-captureFace)==1)
  458. {
  459. strcat(ch,"2");
  460. imgS = GTK_WIDGET (gtk_builder_get_object (builder,"imgS2"));
  461. }
  462. if ((numberOfFacesToCapture-captureFace)==2)
  463. {
  464. strcat(ch,"3");
  465. imgS = GTK_WIDGET (gtk_builder_get_object (builder,"imgS3"));
  466. }
  467. if ((numberOfFacesToCapture-captureFace)==3)
  468. {
  469. strcat(ch,"4");
  470. imgS = GTK_WIDGET (gtk_builder_get_object (builder,"imgS4"));
  471. }
  472. if ((numberOfFacesToCapture-captureFace)==4)
  473. {
  474. strcat(ch,"5");
  475. imgS = GTK_WIDGET (gtk_builder_get_object (builder,"imgS5"));
  476. }
  477. if ((numberOfFacesToCapture-captureFace)==5)
  478. {
  479. strcat(ch,"6");
  480. imgS = GTK_WIDGET (gtk_builder_get_object (builder,"imgS6"));
  481. }
  482. strcat(fullPath,ch);
  483. strcat(fullPath,imgExt);
  484. cvSaveImage(fullPath,face);
  485. if ((numberOfFacesToCapture-captureFace)>=0 &&(numberOfFacesToCapture-captureFace)<=5)
  486. loadFaceImage(fullPath,imgS);
  487. //loadCVPIXBUF(imgS,face);
  488. // on_changed(selection,NULL);
  489. }
  490. if (j==1)
  491. {
  492. // loadCVPIXBUF(simage,face);
  493. captureFace--;
  494. if (captureFace==0)
  495. {
  496. store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(GTK_WIDGET (gtk_builder_get_object (builder, "tvList")))));
  497. gtk_list_store_set(store, &iter, USER_NAME, value,STATUS,b, -1);
  498. }
  499. }
  500. }
  501. GtkWidget *imgSWebcam;
  502. imgSWebcam = GTK_WIDGET (gtk_builder_get_object (builder, "imgSWebcam"));
  503. loadCVPIXBUF(imgSWebcam,frame_copy);
  504. if ( cvWaitKey( 4 ) >= 0 )
  505. {}
  506. return TRUE;
  507. }
  508. int
  509. main (int argc, char *argv[])
  510. {
  511. intialize();
  512. capture = cvCaptureFromCAM(0);
  513. cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH,IMAGE_WIDTH);
  514. cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT,IMAGE_HEIGHT);
  515. GtkWidget *window;
  516. GtkWidget *windowIN;
  517. GtkWidget *tvList;
  518. GtkTreeSelection *selection;
  519. GtkWidget *inpDialogSampleFace;
  520. GtkWidget *lblUserName;
  521. GtkWidget *inpDialog;
  522. gtk_init (&argc, &argv);
  523. builder = gtk_builder_new ();
  524. builderIN = gtk_builder_new ();
  525. gtk_builder_add_from_file (builder, XML_GTK_BUILDER_FACE_MANAGER, NULL);
  526. window = GTK_WIDGET (gtk_builder_get_object (builder, "gtk-facemanager"));
  527. tvList = GTK_WIDGET (gtk_builder_get_object (builder, "tvList"));
  528. inpDialog = GTK_WIDGET (gtk_builder_get_object (builder, "dlgInputUserName"));
  529. gtk_widget_hide(inpDialog);
  530. inpDialogSampleFace = GTK_WIDGET (gtk_builder_get_object (builder, "dlgSampleFace"));
  531. gtk_widget_hide(inpDialogSampleFace);
  532. g_timeout_add(100, (GSourceFunc) time_handler, (gpointer) window);
  533. gtk_builder_connect_signals (builder, NULL);
  534. init_list(tvList);
  535. createListItems(tvList);
  536. // hideShowSelectArea(0);
  537. // lblUserName = GTK_WIDGET (gtk_builder_get_object (builder, "lblUserName"));
  538. // gtk_label_set_text(GTK_LABEL(lblUserName),NONE_SELECTED);
  539. selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tvList));
  540. // g_signal_connect(selection, "changed",G_CALLBACK(on_changed),NULL);
  541. gtk_widget_show (window);
  542. gtk_main ();
  543. g_object_unref (G_OBJECT (builder));
  544. return 0;
  545. }