mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Use stock icons for the "ok" and "not ok" status in the account assistant
This commit is contained in:
parent
04185679c7
commit
f0dff83db6
5 changed files with 12 additions and 31 deletions
|
|
@ -309,15 +309,13 @@ static gboolean update_interface_with_username_availability(void *w) {
|
|||
int account_existing = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w), "is_username_used"));
|
||||
|
||||
if (account_existing == 0) {
|
||||
GdkPixbuf *ok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "ok_pixbuf"));
|
||||
g_object_set_data(G_OBJECT(w), "is_username_available", GINT_TO_POINTER(1));
|
||||
gtk_image_set_from_pixbuf(isUsernameOk, ok_pixbuf);
|
||||
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_OK, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
gtk_label_set_text(usernameError, "");
|
||||
} else {
|
||||
GdkPixbuf *nok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "nok_pixbuf"));
|
||||
gtk_label_set_text(usernameError, "Username is already in use!");
|
||||
g_object_set_data(G_OBJECT(w), "is_username_available", GINT_TO_POINTER(0));
|
||||
gtk_image_set_from_pixbuf(isUsernameOk, nok_pixbuf);
|
||||
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
}
|
||||
gtk_assistant_set_page_complete(GTK_ASSISTANT(assistant), GTK_WIDGET(w), linphone_account_creation_configuration_correct(GTK_WIDGET(w)) > 0);
|
||||
return FALSE;
|
||||
|
|
@ -358,14 +356,13 @@ static void linphone_account_creation_username_changed(GtkEntry *entry, GtkWidge
|
|||
timerID = g_timeout_add(500, (GSourceFunc)check_username_availability, assistant);
|
||||
g_object_set_data(G_OBJECT(w), "usernameAvailabilityTimerID", GUINT_TO_POINTER(timerID));
|
||||
} else {
|
||||
GdkPixbuf *nok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "nok_pixbuf"));
|
||||
if (gtk_entry_get_text_length(username) < LOGIN_MIN_SIZE) {
|
||||
gtk_label_set_text(usernameError, "Username is too short");
|
||||
} else if (!g_regex_match_simple("^[a-zA-Z]+[a-zA-Z0-9.\\-_]{3,}$", gtk_entry_get_text(username), 0, 0)) {
|
||||
gtk_label_set_text(usernameError, "Unauthorized username");
|
||||
}
|
||||
g_object_set_data(G_OBJECT(w), "is_username_available", GINT_TO_POINTER(0));
|
||||
gtk_image_set_from_pixbuf(isUsernameOk, nok_pixbuf);
|
||||
gtk_image_set_from_stock(isUsernameOk, GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
gtk_assistant_set_page_complete(GTK_ASSISTANT(assistant), w, linphone_account_creation_configuration_correct(w) > 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -376,13 +373,11 @@ static void linphone_account_creation_email_changed(GtkEntry *entry, GtkWidget *
|
|||
GtkWidget *assistant = gtk_widget_get_toplevel(w);
|
||||
|
||||
if (g_regex_match_simple("^[a-z0-9]([a-z0-9_\\+\\.-]+)@[a-z0-9]([a-z0-9\\.-]+)\\.[a-z]{2,}$", gtk_entry_get_text(email), 0, 0)) {
|
||||
GdkPixbuf *ok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "ok_pixbuf"));
|
||||
g_object_set_data(G_OBJECT(w), "is_email_correct", GINT_TO_POINTER(1));
|
||||
gtk_image_set_from_pixbuf(isEmailOk, ok_pixbuf);
|
||||
gtk_image_set_from_stock(isEmailOk, GTK_STOCK_OK, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
} else {
|
||||
GdkPixbuf *nok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "nok_pixbuf"));
|
||||
g_object_set_data(G_OBJECT(w), "is_email_correct", GINT_TO_POINTER(0));
|
||||
gtk_image_set_from_pixbuf(isEmailOk, nok_pixbuf);
|
||||
gtk_image_set_from_stock(isEmailOk, GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
}
|
||||
gtk_assistant_set_page_complete(GTK_ASSISTANT(assistant), w, linphone_account_creation_configuration_correct(w) > 0);
|
||||
}
|
||||
|
|
@ -396,33 +391,30 @@ static void linphone_account_creation_password_changed(GtkEntry *entry, GtkWidge
|
|||
|
||||
if ((gtk_entry_get_text_length(password) >= PASSWORD_MIN_SIZE)
|
||||
&& (g_ascii_strcasecmp(gtk_entry_get_text(password), gtk_entry_get_text(password_confirm)) == 0)) {
|
||||
GdkPixbuf *ok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "ok_pixbuf"));
|
||||
g_object_set_data(G_OBJECT(w), "is_password_correct", GINT_TO_POINTER(1));
|
||||
gtk_image_set_from_pixbuf(isPasswordOk, ok_pixbuf);
|
||||
gtk_image_set_from_stock(isPasswordOk, GTK_STOCK_OK, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
gtk_label_set_text(passwordError, "");
|
||||
} else {
|
||||
GdkPixbuf *nok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "nok_pixbuf"));
|
||||
if (gtk_entry_get_text_length(password) < PASSWORD_MIN_SIZE) {
|
||||
gtk_label_set_text(passwordError, "Password is too short !");
|
||||
} else if (!g_ascii_strcasecmp(gtk_entry_get_text(password), gtk_entry_get_text(password_confirm)) == 0) {
|
||||
gtk_label_set_text(passwordError, "Passwords don't match !");
|
||||
}
|
||||
g_object_set_data(G_OBJECT(w), "is_password_correct", GINT_TO_POINTER(0));
|
||||
gtk_image_set_from_pixbuf(isPasswordOk, nok_pixbuf);
|
||||
gtk_image_set_from_stock(isPasswordOk, GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
}
|
||||
gtk_assistant_set_page_complete(GTK_ASSISTANT(assistant), w, linphone_account_creation_configuration_correct(w) > 0);
|
||||
}
|
||||
|
||||
static GtkWidget * create_linphone_account_creation_configuration_page(void) {
|
||||
GtkWidget *vbox = gtk_table_new(7, 3, FALSE);
|
||||
GdkPixbuf *nok_pixbuf = GDK_PIXBUF(g_object_get_data(G_OBJECT(the_assistant), "nok_pixbuf"));
|
||||
GtkWidget *label = gtk_label_new(_("(*) Required fields"));
|
||||
GtkWidget *labelUsername = gtk_label_new(_("Username: (*)"));
|
||||
GtkWidget *isUsernameOk = gtk_image_new_from_pixbuf(nok_pixbuf);
|
||||
GtkWidget *isUsernameOk = gtk_image_new_from_stock(GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
GtkWidget *labelPassword = gtk_label_new(_("Password: (*)"));
|
||||
GtkWidget *isPasswordOk = gtk_image_new_from_pixbuf(nok_pixbuf);
|
||||
GtkWidget *isPasswordOk = gtk_image_new_from_stock(GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
GtkWidget *labelEmail = gtk_label_new(_("Email: (*)"));
|
||||
GtkWidget *isEmailOk = gtk_image_new_from_pixbuf(nok_pixbuf);
|
||||
GtkWidget *isEmailOk = gtk_image_new_from_stock(GTK_STOCK_NO, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
GtkWidget *labelPassword2 = gtk_label_new(_("Confirm your password: (*)"));
|
||||
GtkWidget *entryUsername = gtk_entry_new();
|
||||
GtkWidget *entryPassword = gtk_entry_new();
|
||||
|
|
@ -547,8 +539,6 @@ void linphone_gtk_show_assistant(GtkWidget *parent) {
|
|||
GtkWidget *page_7_linphone_account_validation_check_in_progress;
|
||||
GtkWidget *page_8_error;
|
||||
GtkWidget *page_9_finish;
|
||||
GdkPixbuf *ok_pixbuf;
|
||||
GdkPixbuf *nok_pixbuf;
|
||||
|
||||
if (the_assistant != NULL) return;
|
||||
|
||||
|
|
@ -556,11 +546,6 @@ void linphone_gtk_show_assistant(GtkWidget *parent) {
|
|||
gtk_window_set_resizable (GTK_WINDOW(w), FALSE);
|
||||
gtk_window_set_title(GTK_WINDOW(w), _("SIP account configuration assistant"));
|
||||
|
||||
ok_pixbuf = create_pixbuf(linphone_gtk_get_ui_config("ok", "ok.png"));
|
||||
g_object_set_data_full(G_OBJECT(the_assistant), "ok_pixbuf", ok_pixbuf, g_object_unref);
|
||||
nok_pixbuf = create_pixbuf(linphone_gtk_get_ui_config("notok", "notok.png"));
|
||||
g_object_set_data_full(G_OBJECT(the_assistant), "nok_pixbuf", nok_pixbuf, g_object_unref);
|
||||
|
||||
page_0_intro = create_intro_page();
|
||||
page_1_choice = create_choice_page();
|
||||
page_2_external_account_configuration = create_external_account_configuration_page();
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
set(ICONS_INSTALL_DIR ${PACKAGE_DATA_DIR}/icons/hicolor)
|
||||
|
||||
file(GLOB PIXMAPS "*.png" "linphone.icns")
|
||||
|
||||
install(FILES ${PIXMAPS}
|
||||
install(FILES "linphone.png" "linphone.icns" "linphone-banner.png"
|
||||
DESTINATION ${PACKAGE_DATA_DIR}/pixmaps/linphone
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
pixmapdir=$(datadir)/pixmaps/linphone
|
||||
dist_pixmap_DATA= \
|
||||
linphone.png linphone-banner.png \
|
||||
linphone.icns \
|
||||
ok.png \
|
||||
notok.png
|
||||
linphone.icns
|
||||
|
||||
iconsdir=$(datadir)/icons/hicolor
|
||||
if BUILD_WIN32
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 2 KiB |
BIN
pixmaps/ok.png
BIN
pixmaps/ok.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
Loading…
Add table
Reference in a new issue