diff --git a/source/ubl-settings-system.c b/source/ubl-settings-system.c index e417a1c..f151b41 100644 --- a/source/ubl-settings-system.c +++ b/source/ubl-settings-system.c @@ -452,6 +452,10 @@ void on_language_changed(GtkComboBox *self, main_window *widgets){ } } +void on_terminal_command_ended(VteTerminal *terminal, gint status, domain_info_window *window){ + yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"success",SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); +} + domain_info_window *yon_information_window_new(){ GtkBuilder *builder = gtk_builder_new_from_resource(glade_domain_view_path); @@ -466,6 +470,8 @@ domain_info_window *yon_information_window_new(){ vte_terminal_get_color_background_for_draw(VTE_TERMINAL(window->ExecuteTerminal),&rgba); vte_terminal_set_color_cursor(VTE_TERMINAL(window->ExecuteTerminal),&rgba); yon_gtk_window_setup(GTK_WINDOW(window->Window),NULL,TITLE_LABEL,"com.ublinux.ubl-settings-system","InfoWindow"); + yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"loading",LOADING_LABEL,BACKGROUND_IMAGE_INFO_TYPE); + g_signal_connect(G_OBJECT(window->ExecuteTerminal), "child-exited", G_CALLBACK(on_terminal_command_ended), window); return window; } @@ -490,6 +496,8 @@ void on_domain_connect(GtkWidget *self, dictionary *dict){ char *final = yon_char_unite(!yon_char_is_empty(kerberos)?kerberos_addition_command(kerberos):"",!yon_char_is_empty(kerberos)?" ":"",!yon_char_is_empty(dns)?dns_addition_command(dns):"",!yon_char_is_empty(dns)?" ":"",!yon_char_is_empty(client)?client_addition_command(client):"",!yon_char_is_empty(client)?" ":"",NULL); yon_debug_output("%s\n",domain_connect_command(adress,login,password,final)); domain_info_window *dialog = yon_information_window_new(); + gtk_label_set_text(GTK_LABEL(dialog->HeadLabel),DOMAIN_CONNECTING_LABEL); + gtk_window_set_title(GTK_WINDOW(dialog->Window),DOMAIN_CONNECTING_LABEL); yon_terminal_integrated_start(dialog->ExecuteTerminal,domain_connect_command(adress,login,password,final)); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window)); gtk_widget_show(dialog->Window); @@ -530,6 +538,8 @@ void on_main_window_domain_status_clicked(GtkWidget *self, GtkEntryIconPosition } } +int update_thread_buzy = 0; + gboolean on_main_window_domain_status_update(connection_window *window){ const char *target = gtk_entry_get_text(GTK_ENTRY(window->AdressEntry)); if (!yon_char_is_empty(target)){ @@ -542,20 +552,29 @@ gboolean on_main_window_domain_status_update(connection_window *window){ } else { gtk_entry_set_icon_from_icon_name(GTK_ENTRY(window->AdressEntry),GTK_ENTRY_ICON_SECONDARY,domain_disconnected_icon); } + update_thread_buzy = 0; return GDK_EVENT_PROPAGATE; } -gboolean yon_update_thread(GtkWidget *self, GdkEvent *event, connection_window *window){ - pthread_t thread_id; - pthread_create(&thread_id, NULL, (void *)on_main_window_domain_status_update,window); +// gboolean yon_update_thread(GtkWidget *self, GdkEvent *event, connection_window *window){ + gboolean yon_update_thread(connection_window *window){ + if (!update_thread_buzy){ + update_thread_buzy=1; + pthread_t thread_id; + pthread_create(&thread_id, NULL, (void *)on_main_window_domain_status_update,window); + } return 1; } +void remove_checking(GtkWidget *self, connection_window *window){ + g_source_remove(window->timer_id); +} connection_window *yon_connection_window_new(){ GtkBuilder *builder = gtk_builder_new_from_resource(glade_connection_path); connection_window *window = malloc(sizeof(connection_window)); window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); window->AdressEntry = yon_gtk_builder_get_widget(builder,"AdressEntry"); + window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel"); window->StatusEntry = yon_gtk_builder_get_widget(builder,"StatusEntry"); window->FindEntry = yon_gtk_builder_get_widget(builder,"FindEntry"); window->LoginEntry = yon_gtk_builder_get_widget(builder,"LoginEntry"); @@ -572,8 +591,10 @@ connection_window *yon_connection_window_new(){ g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->StatusEntry),"clicked",G_CALLBACK(on_status_clicked),window); g_signal_connect(G_OBJECT(window->FindEntry),"clicked",G_CALLBACK(on_find_domains_clicked),window); - g_signal_connect(G_OBJECT(window->AdressEntry),"focus-out-event",G_CALLBACK(yon_update_thread),window); - yon_update_thread(NULL,NULL,window); + g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(remove_checking),window); + // g_signal_connect(G_OBJECT(window->AdressEntry),"focus-out-event",G_CALLBACK(yon_update_thread),window); + // yon_update_thread(NULL,NULL,window); + window->timer_id = g_timeout_add(1000,(GSourceFunc)yon_update_thread,window); return window; } @@ -590,6 +611,8 @@ void on_domain_disconnect(GtkWidget *self, dictionary *dict){ } yon_debug_output("%s\n",domain_disconnect_command(adress,login,password)); domain_info_window *dialog = yon_information_window_new(); + gtk_label_set_text(GTK_LABEL(dialog->HeadLabel),DISCONNECTION_LABEL); + gtk_window_set_title(GTK_WINDOW(dialog->Window),DISCONNECTION_LABEL); yon_terminal_integrated_start(dialog->ExecuteTerminal,domain_disconnect_command(adress,login,password)); gtk_window_set_transient_for(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window)); gtk_widget_show(dialog->Window); @@ -602,6 +625,7 @@ domain_window *yon_domain_window_new(){ domain_window *window = malloc(sizeof(domain_window)); window->Window = yon_gtk_builder_get_widget(builder,"MainWindow"); window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel"); window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); window->SaveButton = yon_gtk_builder_get_widget(builder,"SaveButton"); window->AdressEntry = yon_gtk_builder_get_widget(builder,"AdressEntry"); @@ -616,7 +640,8 @@ domain_window *yon_domain_window_new(){ void on_domain_opened(GtkWidget *self, main_window *widgets){ if (main_config.domain_connected){ domain_window *window = yon_domain_window_new(); - yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),TITLE_LABEL,"com.ublinux.ubl-settings-system","DomainWindow"); + gtk_label_set_text(GTK_LABEL(window->HeadLabel),DOMAIN_CONNECTING_LABEL); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DISCONNECTION_LABEL,"com.ublinux.ubl-settings-system","DomainWindow"); char *domain = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->DomainEntry)); char *password = yon_config_get_by_key(DOMAIN_ADMANGER); char *login = yon_char_divide_search(password,":",-1); @@ -638,7 +663,8 @@ void on_domain_opened(GtkWidget *self, main_window *widgets){ gtk_widget_show(window->Window); } else { connection_window *window = yon_connection_window_new(); - yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),TITLE_LABEL,"com.ublinux.ubl-settings-system","ConnectWindow"); + gtk_label_set_text(GTK_LABEL(window->HeadLabel),DOMAIN_CONNECTING_LABEL); + yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window),DOMAIN_CONNECTING_LABEL,"com.ublinux.ubl-settings-system","ConnectWindow"); char *domain = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->DomainEntry)); char *dns = config(DOMAIN_DNS); char *client = yon_config_get_by_key(DOMAIN_CLIENT); @@ -662,7 +688,7 @@ void on_domain_opened(GtkWidget *self, main_window *widgets){ yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_domain_connect),dict); g_signal_connect(G_OBJECT(window->Window),"destroy",G_CALLBACK(on_check_domain_connected),widgets); - yon_update_thread(NULL,NULL,window); + // yon_update_thread(NULL,NULL,window); gtk_widget_show(window->Window); } diff --git a/source/ubl-settings-system.h b/source/ubl-settings-system.h index 208f262..089f7eb 100644 --- a/source/ubl-settings-system.h +++ b/source/ubl-settings-system.h @@ -148,6 +148,7 @@ typedef struct { GtkWidget *Window; GtkWidget *StatusBox; + GtkWidget *HeadLabel; GtkWidget *CancelButton; GtkWidget *SaveButton; @@ -161,6 +162,7 @@ typedef struct { GtkWidget *Window; GtkWidget *StatusBox; + GtkWidget *HeadLabel; GtkWidget *CancelButton; GtkWidget *SaveButton; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 76c6919..295e529 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -19,6 +19,7 @@ #define LANGUAGE_LABEL _("Language:") #define DEFAULT_LABEL _("Default") +#define CANCEL_LABEL _("Cancel") #define COPY_SUCCESS_LABEL _("Machine ID has been copied") @@ -51,8 +52,9 @@ #define LIST_ALL_LABEL _("List all domains") #define DOMAIN_CONNECTING_LABEL _("Connecting to domain") -#define DOMAIN_CONNECT_LABEL _("Connect to domain") -#define DOMAIN_DISCONNECT_LABEL _("Disconnect from domain") +#define DISCONNECTION_LABEL _("Disconnecting from domain") +#define DOMAIN_CONNECT_LABEL _("Join") +#define DOMAIN_DISCONNECT_LABEL _("Leave") #define DOMAIN_CONNECTED_LABEL _("Connected to domain") #define DOMAIN_DISCONNECTED_LABEL _("Disconnected from domain") diff --git a/ubl-settings-system.glade b/ubl-settings-system.glade index 2d6d2a2..3ee433e 100644 --- a/ubl-settings-system.glade +++ b/ubl-settings-system.glade @@ -157,7 +157,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Connect to domain + Join True False True diff --git a/ubl-settings-system.pot b/ubl-settings-system.pot index 968eccf..9cd9acc 100644 --- a/ubl-settings-system.pot +++ b/ubl-settings-system.pot @@ -89,122 +89,130 @@ msgstr "" msgid "Default" msgstr "" -#: source/ubl-strings.h:23 +#: source/ubl-strings.h:22 +msgid "Cancel" +msgstr "" + +#: source/ubl-strings.h:24 msgid "Machine ID has been copied" msgstr "" -#: source/ubl-strings.h:25 +#: source/ubl-strings.h:26 msgid "ID field can't be empty!" msgstr "" -#: source/ubl-strings.h:27 +#: source/ubl-strings.h:28 msgid "Insert data" msgstr "" -#: source/ubl-strings.h:29 +#: source/ubl-strings.h:30 msgid "Accept" msgstr "" -#: source/ubl-strings.h:31 +#: source/ubl-strings.h:32 msgid "Important field is empty" msgstr "" -#: source/ubl-strings.h:33 +#: source/ubl-strings.h:34 msgid "Connect" msgstr "" -#: source/ubl-strings.h:34 +#: source/ubl-strings.h:35 msgid "Disconnect" msgstr "" -#: source/ubl-strings.h:35 +#: source/ubl-strings.h:36 msgid "Domain address" msgstr "" -#: source/ubl-strings.h:36 +#: source/ubl-strings.h:37 msgid "Domain address:" msgstr "" -#: source/ubl-strings.h:37 +#: source/ubl-strings.h:38 msgid "Domain administrator name:" msgstr "" -#: source/ubl-strings.h:38 +#: source/ubl-strings.h:39 msgid "Domain administrator password:" msgstr "" -#: source/ubl-strings.h:39 +#: source/ubl-strings.h:40 msgid "Main" msgstr "" -#: source/ubl-strings.h:40 +#: source/ubl-strings.h:41 msgid "Additional" msgstr "" -#: source/ubl-strings.h:41 +#: source/ubl-strings.h:42 msgid "Kerberos/AD domain server:" msgstr "" -#: source/ubl-strings.h:42 +#: source/ubl-strings.h:43 msgid "DNS server:" msgstr "" -#: source/ubl-strings.h:43 +#: source/ubl-strings.h:44 msgid "Domain connection client" msgstr "" -#: source/ubl-strings.h:44 +#: source/ubl-strings.h:45 msgid "Sssd client" msgstr "" -#: source/ubl-strings.h:45 +#: source/ubl-strings.h:46 msgid "Winbind client" msgstr "" -#: source/ubl-strings.h:46 +#: source/ubl-strings.h:47 msgid "Samba client" msgstr "" -#: source/ubl-strings.h:47 +#: source/ubl-strings.h:48 msgid "Switch client off or automatically" msgstr "" -#: source/ubl-strings.h:48 +#: source/ubl-strings.h:49 msgid "Domain information" msgstr "" -#: source/ubl-strings.h:49 +#: source/ubl-strings.h:50 msgid "Domain connection" msgstr "" -#: source/ubl-strings.h:50 +#: source/ubl-strings.h:51 msgid "Check domain name" msgstr "" -#: source/ubl-strings.h:51 +#: source/ubl-strings.h:52 msgid "List all domains" msgstr "" -#: source/ubl-strings.h:53 +#: source/ubl-strings.h:54 msgid "Connecting to domain" msgstr "" -#: source/ubl-strings.h:54 -msgid "Connect to domain" +#: source/ubl-strings.h:55 +msgid "Disconnecting from domain" msgstr "" -#: source/ubl-strings.h:55 -msgid "Disconnect from domain" +#: source/ubl-strings.h:56 +msgid "Join" msgstr "" #: source/ubl-strings.h:57 +msgid "Leave" +msgstr "" + +#: source/ubl-strings.h:59 msgid "Connected to domain" msgstr "" -#: source/ubl-strings.h:58 +#: source/ubl-strings.h:60 msgid "Disconnected from domain" msgstr "" -#: source/ubl-strings.h:60 +#: source/ubl-strings.h:62 msgid "Loading..." msgstr "" diff --git a/ubl-settings-system_ru.po b/ubl-settings-system_ru.po index e6a59a0..050dbc2 100644 --- a/ubl-settings-system_ru.po +++ b/ubl-settings-system_ru.po @@ -90,6 +90,10 @@ msgstr "Язык:" msgid "Default" msgstr "По умолчанию" +#: source/ubl-strings.h:22 +msgid "Cancel" +msgstr "Отмена" + #: source/ubl-strings.h:23 msgid "Machine ID has been copied" msgstr "ID рабочей станции скопирован" @@ -167,7 +171,7 @@ msgid "Samba client" msgstr "Клиент samba" #: source/ubl-strings.h:47 -msgid "Switch client off or autometically" +msgid "Switch client off or automatically" msgstr "Выключить клиент или автоматически" #: source/ubl-strings.h:48 @@ -191,131 +195,28 @@ msgid "Connecting to domain" msgstr "Подключение к домену" #: source/ubl-strings.h:54 -msgid "Connect to domain" -msgstr "Войти в домен" +msgid "Disconnecting from domain" +msgstr "Отключение от домена" #: source/ubl-strings.h:55 -msgid "Disconnect from domain" -msgstr "Выйти из домена" +msgid "Join" +msgstr "Присоединиться" + +#: source/ubl-strings.h:56 +msgid "Leave" +msgstr "Отсоединиться" -#: source/ubl-strings.h:57 +#: source/ubl-strings.h:58 msgid "Connected to domain" msgstr "Подключен к домену" -#: source/ubl-strings.h:60 -msgid "Loading..." -msgstr "Загрузка..." - -#: source/ubl-strings.h:58 +#: source/ubl-strings.h:59 msgid "Disconnected from domain" msgstr "Не подключен к домену" -msgid "Version:" -msgstr "Версия:" - -msgid "ubl-settings-system version:" -msgstr "Версия ubl-settings-system: " - -msgid "Usage:" -msgstr "Использование:" - -msgid "[OPTIONS]" -msgstr "[АРГУМЕНТЫ]" - -msgid "Options:" -msgstr "Аргументы:" - -msgid "Show this help" -msgstr "Показать параметры справки" - -msgid "Show package version" -msgstr "Показать текущую версию" - -msgid "Lock this help menu" -msgstr "Блокировка вызова справки" - -msgid "Lock configuration saving" -msgstr "Блокировка сохранения локальной и глобальной конфигурации" - -msgid "Lock local configration saving" -msgstr "Блокировка сохранения локальной конфигурации" - -msgid "Lock global configration saving" -msgstr "Блокировка сохранения глобальной конфигурации" - -msgid "Lock global configration loading" -msgstr "Блокировка загрузки глобальной конфигурации" - -msgid "Operation succeeded" -msgstr "Операция завершена" - -msgid "" -"Warning! Application was launched without root - root-dependent actions " -"are locked" -msgstr "" -"Внимание! Приложение было запущено без прав суперпользователя - действия, " -"требующие их наличия заблокированы" - -msgid "About" -msgstr "О программе" - -msgid "Documentation" -msgstr "Справка" - -msgid "Save to local configuration" -msgstr "Сохранить в локальную конфигурацию" - -msgid "Save to global configuration" -msgstr "Сохранить в глобальную конфигурацию" - -msgid "Save configuration" -msgstr "Сохранить конфигурацию" - -msgid "Save" -msgstr "Сохранить" - -msgid "Load local configuration" -msgstr "Загрузить локальную конфигурацию" - -msgid "Load global configuration" -msgstr "Загрузить глобальную конфигурацию" - -msgid "Load" -msgstr "Загрузить" - -msgid "Cancel" -msgstr "Отмена" - -msgid "Would you like to read documentation in the Web?" -msgstr "Вы хотите прочитать справку в Сети?" - -msgid "" -"You will be redirected to documentation website where documentation is\n" -"translated and supported by community." -msgstr "" -"Вы будете перенаправлены на сайт с документацией, где страницы помощи\n" -"переводятся и поддерживаются сообществом." - -msgid "Always redirect to online documentation" -msgstr "Всегда перенаправлять" - -msgid "Open documentation" -msgstr "Прочитать справку" - -msgid "Project Home Page" -msgstr "Домашняя страница проекта" - -msgid "Nothing were chosen" -msgstr "Ничего не было выбрано" - -msgid "Global configuration loading succeeded" -msgstr "Успешно загружена глобальная конфигурация" - -msgid "Local configuration loading succeeded" -msgstr "Успешно загружена локальная конфигурация" - -msgid "Config loading failed" -msgstr "Ошибка загрузки конфигурации" +#: source/ubl-strings.h:61 +msgid "Loading..." +msgstr "Загрузка..." msgid "Afrikaans, South Africa" msgstr "Африканский, Южная Африка"