diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 980e2f3..1f6e44d 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -902,6 +902,9 @@ void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image gtk_image_set_from_file(GTK_IMAGE(Image), image_path); } +/** + * +*/ void _yon_ubl_status_box_render(render_data *datav) { render_data data = *(render_data*)datav; @@ -926,13 +929,26 @@ void _yon_ubl_status_box_render(render_data *datav) } if (data.text_to_render) gtk_label_set_text(GTK_LABEL(data.label), data.text_to_render); - else - for (int i=0;i-1){ gtk_widget_hide(gtk_widget_get_toplevel(main_window)); @@ -1000,8 +1016,10 @@ void yon_ubl_browser_window_open(char *link, char *browser_window_name){ /**yon_ubl_browser_window_open(char *link, char *browser_window_name) * [EN] * Launches browser with [link]. + * [browser_window_name] is't used. It's needed for compatibility with webkit version of that function. * [RU] * Открывает браузер со страницей по ссылке [link] + * [browser_window_name] не используется. Нужна для совместимости с webkit версией этой функции. */ void yon_ubl_browser_window_open(char *link, char *browser_window_name){ char *user=getenv("SUDO_USER"); diff --git a/source/ubl-utils.h b/source/ubl-utils.h index 43021b6..3b254bb 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -69,7 +69,16 @@ typedef struct apps typedef char** config_str; // dictionary functions - +/**yon_dictionary_get_data(dictionary, type) + * [EN] + * Gets data from dictionary. + * [dictionary] is dictionary, from which data should be extracted; + * [type] is type of data, [dictionary] contains. + * [RU] + * Возвращает данные из словаря. + * [dictionary] - словарь из которого достаются данные. + * [type] - тип данных, хранящихся в словаре [dictionary]. +*/ #define yon_dictionary_get_data(dictionary, type) ((type)dictionary->data) #define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) if (!dict) dict=yon_dictionary_create_with_data(key,data); \ else dict=yon_dictionary_create_with_data_connected(dict,key,data); @@ -154,10 +163,20 @@ int yon_launch(thread_output *thread); #ifdef __GTK_H__ #ifdef VTE_TERMINAL + +/** + * +*/ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument); #endif -#define yon_gtk_builder_get_widget(obj, obj2) GTK_WIDGET(gtk_builder_get_object(obj, obj2)) +/**yon_gtk_builder_get_widget(builder, widget_name) + * [EN] + * Returns GtkWidget from GtkBuilder *[builder]. + * [builder] is GtkBuilder*; + * [widget_name] is id of widget; +*/ +#define yon_gtk_builder_get_widget(builder, widget_name) GTK_WIDGET(gtk_builder_get_object(builder, widget_name)) typedef struct { @@ -177,17 +196,11 @@ int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); -GtkWidget *yon_gtk_socket_create_new_with_connect(GtkWidget *container, gpointer data); - int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment); int yon_dictionary_gtk_pack_start_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); int yon_dictionary_gtk_pack_end_multiple_widgets(dictionary *dict, GtkWidget *destination, gboolean expand, gboolean fill, int padding); -// uninitialised - -void yon_on_plug_added(GtkSocket *self, gpointer user_data); -void yon_on_plug_removed(GtkSocket *self, gpointer user_data); typedef enum @@ -202,16 +215,72 @@ typedef struct { GtkWidget *box; GtkWidget *label; char* text_to_render; - char** text_strings_to_render; - int strings_size; } render_data; - -#define yon_ubl_status_box_render(render) {pthread_attr_t attr; pthread_attr_init(&attr); pthread_t tid; pthread_create(&tid,&attr,(void*)_yon_ubl_status_box_render,((void*)render)); } +/**yon_ubl_status_box_setup(render,icon,box,label) + * [EN] + * Sets up [render] structure of type render_data. + * [icon] is GtkImage widget of status box for showing status icons; + * [box] is GtkBox widget of status box for showing status color; + * [label] is GtkLabel widget of status box for showing status text; + * [RU] + * Настраивает структуру [render] типа render_data. + * [icon] - виджет типа GtkIcon в котором будут отображаться статусные иконки; + * [box] - виджет типа GtkBox в котором будет отображаться цвет статуса; + * [label] - виджет типа GtkLabel в котором будет отображаться текст статусного сообщения; +*/ +#define yon_ubl_status_box_setup(render,icon,box,label) {render.icon=GTK_WIDGET(icon); render.box=GTK_WIDGET(box); render.label=GTK_WIDGET(label);} + +/**yon_ubl_status_box_render(render,text,type) + * [EN] + * Renders message in status box; + * [render] is render_data structure of status box; + * [text] is text to be shown in status box; + * [type] if type of message. Can be BACKGROUND_IMAGE_FAIL_TYPE or BACKGROUND_IMAGE_SUCCESS_TYPE + * [RU] + * Отображает сообщение в статусном окне. + * [render] - структура типа render_data для нужного статусного окна; + * [text] - текст, отображаемый в статусном окне; + * [type] - тип сообщения. Может быть: + * BACKGROUND_IMAGE_FAIL_TYPE (красный фон,иконка - восклицательный знак) + * или + * BACKGROUND_IMAGE_SUCCESS_TYPE (Жёлтный фон, иконка - галка) +*/ +#define yon_ubl_status_box_render(render,text,m_type) {render.text_to_render=text; render.type=m_type; pthread_attr_t attr; pthread_attr_init(&attr); pthread_t tid; pthread_create(&tid,&attr,(void*)_yon_ubl_status_box_render,((void*)&render)); } #ifdef __cplusplus + +/**yon_ubl_header_setup(overlay, head, image, imag_path) + * [EN] + * Sets up header of app. + * [overlay] is overlay for app header; + * [head] is box of header, which connects to [overlay] + * [image] is header background image; + * [imag_path] is path of image, shown in [image] + * [RU] + * Настраивает заголовок приложения. + * [overlay] - оверлей заголовка приложения; + * [head] - шапка заголовка, присоединяемая к [overlay] + * [image] - виджет картинки для заднего фона; + * [imag_path] - путь до картинки, загружаемой в [image] +*/ #define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()), GTK_WIDGET(head.gobj()), GTK_WIDGET(image.gobj()), (char *)imag_path) #else + +/**yon_ubl_header_setup(overlay, head, image, imag_path) + * [EN] + * Sets up header of app. + * [overlay] is overlay for app header; + * [head] is box of header, which connects to [overlay] + * [image] is header background image; + * [imag_path] is path of image, shown in [image] + * [RU] + * Настраивает заголовок приложения. + * [overlay] - оверлей заголовка приложения; + * [head] - шапка заголовка, присоединяемая к [overlay] + * [image] - виджет картинки для заднего фона; + * [imag_path] - путь до картинки, загружаемой в [image] +*/ #define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path) #endif