@@ -7,10 +7,6 @@ static void s_click(GtkWidget *widget) {
77 free (new_group );
88}
99
10- static void s2_click (GtkWidget * widget ) {
11- if (widget ) {}
12- }
13-
1410static void remove_person (GtkWidget * widget , GdkEventButton * event , gpointer user_id ) {
1511 if (event -> type == GDK_BUTTON_PRESS && event -> button == 1 ) {
1612 gtk_widget_destroy (GTK_WIDGET (widget ));
@@ -24,6 +20,7 @@ static void remove_person(GtkWidget *widget, GdkEventButton *event, gpointer use
2420 for (int i = 0 ; i < new_group -> count ; i ++ )
2521 new_group -> users_id [i ] = temp [i ];
2622 free (temp );
23+ create_notification (t_application .main_area , "User deleted" , 0 , 461 , 110 , 420 , 10 );
2724 }
2825}
2926
@@ -77,13 +74,16 @@ static void add_person(GtkWidget *widget, GdkEventButton *event) {
7774 // проверить имя пользователя name на существование
7875 printf ("Username: %s\n" , name );
7976 int avatar = 0 , user_id = 0 ;
80- if (!add_user_to_group (name , & user_id , & avatar ))
77+ if (!add_user_to_group (name , & user_id , & avatar )) {
78+ create_notification (t_application .main_area , "Invalid username!" , 1 , 461 , 110 , 420 , 10 );
8179 return ;
80+ }
8281
8382 gtk_entry_set_text (GTK_ENTRY (new_group -> search_field ), "" );
8483 GtkWidget * single = create_single_person (name , avatar );
8584 gtk_box_pack_start (GTK_BOX (t_msg .crlist ), single , FALSE, FALSE, 0 );
8685 gtk_widget_show_all (GTK_WIDGET (t_msg .crlist ));
86+ create_notification (t_application .main_area , mx_strjoin (name , " added!" ), 0 , 461 , 110 , 420 , 10 );
8787
8888 g_signal_connect (G_OBJECT (single ), "enter-notify-event" , G_CALLBACK (event_enter_notify ), NULL );
8989 g_signal_connect (G_OBJECT (single ), "leave-notify-event" , G_CALLBACK (event_leave_notify ), NULL );
@@ -95,14 +95,19 @@ static void add_person(GtkWidget *widget, GdkEventButton *event) {
9595static void create_group_button_click (GtkWidget * widget , gpointer group_name ) {
9696 if (widget ) {}
9797 GList * parent = gtk_container_get_children (GTK_CONTAINER (t_msg .crlist )); // GList *parent_c = parent;
98- if (parent == NULL )
98+ if (parent == NULL ){
99+ create_notification (t_application .main_area , "No user selected!" , 1 , 461 , 110 , 420 , 10 );
99100 return ;
101+ }
100102
101103 char * name = (char * )gtk_entry_buffer_get_text (gtk_entry_get_buffer (GTK_ENTRY ((GtkWidget * )group_name )));
102104 if (name != NULL )
103105 name = mx_del_extra_spaces (name );
104- if (!strcmp (name , "" ))
106+ if (!strcmp (name , "" )){
107+ create_notification (t_application .main_area , "Name your group!" , 1 , 461 , 110 , 420 , 10 );
105108 return ;
109+ }
110+
106111 printf ("Group name: %s \n" , name );
107112
108113 while (parent != NULL ) {
@@ -118,6 +123,7 @@ static void create_group_button_click(GtkWidget *widget, gpointer group_name) {
118123 new_group -> title = strdup (name );
119124 create_group ();
120125 g_list_free (g_steal_pointer (& parent )); // g_list_free(parent_c); //
126+ gtk_widget_destroy (GTK_WIDGET (t_application .notificaton ));
121127 gtk_widget_destroy (GTK_WIDGET (t_msg .background ));
122128}
123129
@@ -132,7 +138,7 @@ void creator_group(GtkWidget *main)
132138 GtkWidget * clickable = gtk_event_box_new ();
133139 gtk_widget_set_halign (GTK_WIDGET (clickable ), GTK_ALIGN_CENTER );
134140 gtk_widget_set_valign (GTK_WIDGET (clickable ), GTK_ALIGN_CENTER );
135- g_signal_connect (G_OBJECT (clickable ), "button_press_event" , G_CALLBACK (s2_click ), NULL );
141+ g_signal_connect (G_OBJECT (clickable ), "button_press_event" , G_CALLBACK (gtk_widget_show ), NULL );
136142 gtk_container_add (GTK_CONTAINER (t_msg .background ), clickable );
137143
138144 GtkWidget * box = gtk_box_new (GTK_ORIENTATION_VERTICAL , 0 );
0 commit comments