1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| #include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "variables.h"
void on_activate_entry(GtkWidget *pEntry, gpointer data);
void on_copier_button(GtkWidget *pButton, gpointer data);
void Identification(gpointer data, int x)
{
GtkWidget *pWindow;
GtkWidget *pVBox;
GtkWidget *pEntry;
GtkWidget *pLabel;
GtkWidget *pButton;
GtkWidget *pFrame;
GtkWidget *pVBoxFrame;
char log[20];
char pass[20];
gchar *sUtf8;
pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(pWindow), "Identification");
gtk_window_set_default_size(GTK_WINDOW(pWindow), 320, 200);
gtk_window_set_position(GTK_WINDOW(pWindow), GTK_WIN_POS_CENTER);
g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);
pVBox = gtk_vbox_new(TRUE, 0);
gtk_container_add(GTK_CONTAINER(pWindow), pVBox);
/* Creation du premier GtkFrame */
pFrame = gtk_frame_new("Identification");
gtk_box_pack_start(GTK_BOX(pVBox), pFrame, TRUE, FALSE, 0);
/* Creation et insertion d une boite pour le premier GtkFrame */
pVBoxFrame = gtk_vbox_new(TRUE, 0);
gtk_container_add(GTK_CONTAINER(pFrame), pVBoxFrame);
/* Creation et insertion des elements contenus dans le premier GtkFrame */
pLabel = gtk_label_new("Identifiant :");
gtk_box_pack_start(GTK_BOX(pVBoxFrame), pLabel, TRUE, FALSE, 0);
pEntry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(pVBoxFrame), pEntry, TRUE, FALSE, 0);
puts(strcpy(log, ));
sUtf8 = g_locale_to_utf8("Mot de passe :", -1, NULL, NULL, NULL);
pLabel = gtk_label_new(sUtf8);
g_free(sUtf8);
gtk_box_pack_start(GTK_BOX(pVBoxFrame), pLabel, TRUE, FALSE, 0);
puts(strcpy(log, ));
pEntry = gtk_entry_new_with_max_length(20);
gtk_entry_set_visibility(GTK_ENTRY(pEntry), FALSE);
gtk_entry_set_invisible_char(GTK_ENTRY(pEntry), '*');
gtk_box_pack_start(GTK_BOX(pVBoxFrame), pEntry, TRUE, FALSE, 0);
pButton = gtk_button_new_with_label("OK");
gtk_box_pack_start(GTK_BOX(pVBox), pButton, TRUE, FALSE, 0);
/* Connexion du signal "activate" du GtkEntry */
if((strcmp(log,"admin")==0)&&(strcmp(pass,"admin")==0)&&(x==1))
{
g_signal_connect(G_OBJECT(pEntry), "activate", G_CALLBACK(AjoutPersonne), (GtkWidget*) pLabel);
}
//if((strcmp(log,"admin")==0)&&(strcmp(pass,"admin")==0)&&(x==2))
gtk_widget_show_all(pWindow);
gtk_main();
return;
} |
Partager