|
|
|
|
@ -508,3 +508,69 @@ template_main_window *yon_ubl_window_setup(){
|
|
|
|
|
|
|
|
|
|
return widgets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_on_email_check(GtkEntry *self,GdkEventFocus *event,GtkContainer *status){
|
|
|
|
|
char *text = (char*)gtk_entry_get_text(self);
|
|
|
|
|
if (!strstr(text,"@")){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(status,"invalid_email",EMAIL_INVALID_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_despawn_infinite(status);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_on_digit_only_changed(GtkEditable *editable, const gchar *text, gint length, gint *position){
|
|
|
|
|
gchar *new_text = g_new(gchar, length + 1);
|
|
|
|
|
gint i, j = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < length; i++) {
|
|
|
|
|
if (text[i]>'0'&&text[i]<'9') {
|
|
|
|
|
new_text[j] = text[i];
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}if (j < length) {
|
|
|
|
|
g_signal_handlers_block_by_func(editable, G_CALLBACK(yon_on_digit_only_changed), NULL);
|
|
|
|
|
gtk_editable_insert_text(editable, new_text, j, position);
|
|
|
|
|
g_signal_handlers_unblock_by_func(editable, G_CALLBACK(yon_on_digit_only_changed), NULL);
|
|
|
|
|
g_signal_stop_emission_by_name(editable, "insert-text");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free(new_text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_on_path_check(GtkEntry *self,GdkEventFocus *event,GtkContainer *status){
|
|
|
|
|
char *text = (char*)gtk_entry_get_text(self);
|
|
|
|
|
if (text[0]=='~'){
|
|
|
|
|
text = yon_char_new(text);
|
|
|
|
|
free(yon_char_divide(text,0));
|
|
|
|
|
char *new_text = yon_char_unite(yon_ubl_user_get_home_directory(),"/",text,NULL);
|
|
|
|
|
free(text);
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(self),new_text);
|
|
|
|
|
text = new_text;
|
|
|
|
|
}
|
|
|
|
|
if (!strstr(text,"/")){
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(status,"invalid_path",PATH_INVALID_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
} else {
|
|
|
|
|
yon_ubl_status_box_despawn_infinite(status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_entry_set_entry_type(GtkEntry *target,GtkBox *status){
|
|
|
|
|
GtkInputPurpose purpose = gtk_entry_get_input_purpose(target);
|
|
|
|
|
switch(purpose){
|
|
|
|
|
case GTK_INPUT_PURPOSE_EMAIL:
|
|
|
|
|
g_signal_connect(G_OBJECT(target),"insert-text",G_CALLBACK(yon_on_digit_only_changed),NULL);
|
|
|
|
|
break;
|
|
|
|
|
case GTK_INPUT_PURPOSE_DIGITS:
|
|
|
|
|
g_signal_connect(G_OBJECT(target),"insert-text",G_CALLBACK(yon_on_digit_only_changed),NULL);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case GTK_INPUT_PURPOSE_URL:
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(target),"insert-text",G_CALLBACK(yon_on_digit_only_changed),NULL);
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|