|
|
|
@ -87,6 +87,41 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
|
|
|
|
gtk_widget_show_all(terminal);
|
|
|
|
gtk_widget_show_all(terminal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void __on_yon_terminal_done(GtkWidget *self, void *, GtkWidget *status_box){
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(status_box),"terminal_done","",BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_terminal_window_launch(GtkWindow *parent_window, char *command){
|
|
|
|
|
|
|
|
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
|
|
|
|
|
|
GtkWidget *header = gtk_header_bar_new();
|
|
|
|
|
|
|
|
GtkWidget *terminal = vte_terminal_new();
|
|
|
|
|
|
|
|
GtkWidget *status_box = gtk_box_new(GTK_ORIENTATION_VERTICAL,5);
|
|
|
|
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL,5);
|
|
|
|
|
|
|
|
GtkWidget *terminal_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
|
|
|
GtkWidget *scroll = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL,gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(terminal)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_window_set_titlebar(GTK_WINDOW(window),header);
|
|
|
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(window),box);
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),status_box,0,0,0);
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),terminal_box,1,1,0);
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(terminal_box),terminal,1,1,0);
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(terminal_box),scroll,0,0,0);
|
|
|
|
|
|
|
|
gtk_widget_set_margin_bottom(terminal_box,5);
|
|
|
|
|
|
|
|
gtk_widget_set_margin_start(terminal_box,5);
|
|
|
|
|
|
|
|
gtk_widget_set_margin_end(terminal_box,5);
|
|
|
|
|
|
|
|
gtk_widget_show_all(window);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal),-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_window_set_modal(GTK_WINDOW(window),1);
|
|
|
|
|
|
|
|
gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(header),1);
|
|
|
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window),gtk_window_get_title(parent_window));
|
|
|
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(window),gtk_window_get_icon_name(parent_window));
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(__on_yon_terminal_done), status_box);
|
|
|
|
|
|
|
|
yon_terminal_integrated_start(terminal,command);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_gtk_set_scroll(GtkWidget* self,GdkEventScroll *event, GtkAdjustment *adjustment){
|
|
|
|
void yon_gtk_set_scroll(GtkWidget* self,GdkEventScroll *event, GtkAdjustment *adjustment){
|
|
|
|
if (self){};
|
|
|
|
if (self){};
|
|
|
|
gdouble val = gtk_adjustment_get_value(adjustment);
|
|
|
|
gdouble val = gtk_adjustment_get_value(adjustment);
|
|
|
|
@ -201,6 +236,13 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
|
|
|
|
if (!__yon_main_window_config.fullscreen) gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y);
|
|
|
|
if (!__yon_main_window_config.fullscreen) gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_window_config_save_instant(){
|
|
|
|
|
|
|
|
check_window_config_setup{
|
|
|
|
|
|
|
|
yon_get_is_fullscreen();
|
|
|
|
|
|
|
|
yon_window_config_save();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event)
|
|
|
|
/**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event)
|
|
|
|
* [EN]
|
|
|
|
* [EN]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -344,6 +386,10 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
|
|
|
|
param->section=section;
|
|
|
|
param->section=section;
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.deleted_parameters,param->parameter_name,param);
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.deleted_parameters,param->parameter_name,param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_window_config_erase_instant_parameter(char *param_name, char *section){
|
|
|
|
|
|
|
|
g_key_file_remove_key(__yon_window_config_file,section,param_name,NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type){
|
|
|
|
int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type){
|
|
|
|
@ -723,17 +769,16 @@ static char *yon_status_thread_id=NULL;
|
|
|
|
|
|
|
|
|
|
|
|
void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){
|
|
|
|
void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){
|
|
|
|
sleep(statusstruct->times);
|
|
|
|
sleep(statusstruct->times);
|
|
|
|
if (status_thread_busy){
|
|
|
|
if (statusstruct->revealer){
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(statusstruct->revealer),0);
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(statusstruct->revealer),0);
|
|
|
|
sleep(1);
|
|
|
|
sleep(1);
|
|
|
|
gtk_widget_destroy(statusstruct->revealer);
|
|
|
|
gtk_widget_destroy(statusstruct->revealer);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
status_thread_busy=0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void __yon_ubl_status_box_destroyed(){
|
|
|
|
void __yon_ubl_status_box_destroyed(GtkWidget *self,struct temp_statusbox *statusstruct){
|
|
|
|
status_thread_busy=0;
|
|
|
|
statusstruct->revealer=NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_status_box_destroyed(){
|
|
|
|
void yon_status_box_destroyed(){
|
|
|
|
@ -744,7 +789,7 @@ void yon_status_box_destroyed(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *status_id, char *display_text, BACKGROUND_IMAGE_TYPE type){
|
|
|
|
int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *status_id, char *display_text, BACKGROUND_IMAGE_TYPE type){
|
|
|
|
if (!status_thread_busy){
|
|
|
|
if (!gtk_container_get_children(container)){
|
|
|
|
if (yon_status_thread_id){
|
|
|
|
if (yon_status_thread_id){
|
|
|
|
if (!strcmp(yon_status_thread_id,status_id)){
|
|
|
|
if (!strcmp(yon_status_thread_id,status_id)){
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
@ -755,7 +800,6 @@ int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *status_id,
|
|
|
|
for (int i=0;i<g_list_length(list);i++){
|
|
|
|
for (int i=0;i<g_list_length(list);i++){
|
|
|
|
gtk_widget_destroy((GtkWidget*)g_list_nth_data(list,i));
|
|
|
|
gtk_widget_destroy((GtkWidget*)g_list_nth_data(list,i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
status_thread_busy=0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_status_thread_id = yon_char_new(status_id);
|
|
|
|
yon_status_thread_id = yon_char_new(status_id);
|
|
|
|
|
|
|
|
|
|
|
|
@ -773,7 +817,6 @@ int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *status_id,
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_show_all(revealer);
|
|
|
|
gtk_widget_show_all(revealer);
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1);
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1);
|
|
|
|
g_signal_connect(G_OBJECT(revealer),"destroy", G_CALLBACK(__yon_ubl_status_box_destroyed),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_margin_bottom(label,9);
|
|
|
|
gtk_widget_set_margin_bottom(label,9);
|
|
|
|
gtk_widget_set_margin_top(label,9);
|
|
|
|
gtk_widget_set_margin_top(label,9);
|
|
|
|
@ -795,6 +838,7 @@ int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *status_id,
|
|
|
|
if (display_text)
|
|
|
|
if (display_text)
|
|
|
|
gtk_label_set_text(GTK_LABEL(label),display_text);
|
|
|
|
gtk_label_set_text(GTK_LABEL(label),display_text);
|
|
|
|
struct temp_statusbox *statusstruct = malloc(sizeof(struct temp_statusbox));
|
|
|
|
struct temp_statusbox *statusstruct = malloc(sizeof(struct temp_statusbox));
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(revealer),"destroy", G_CALLBACK(__yon_ubl_status_box_destroyed),statusstruct);
|
|
|
|
statusstruct->revealer = revealer;
|
|
|
|
statusstruct->revealer = revealer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -822,7 +866,7 @@ int yon_ubl_status_box_despawn_infinite(GtkContainer *container){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type){
|
|
|
|
void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type){
|
|
|
|
if (!status_thread_busy){
|
|
|
|
if (!gtk_container_get_children(container)){
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
GtkWidget *revealer = gtk_revealer_new();
|
|
|
|
GtkWidget *revealer = gtk_revealer_new();
|
|
|
|
GtkWidget *label = gtk_label_new("");
|
|
|
|
GtkWidget *label = gtk_label_new("");
|
|
|
|
@ -836,7 +880,6 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_show_all(revealer);
|
|
|
|
gtk_widget_show_all(revealer);
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1);
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1);
|
|
|
|
g_signal_connect(G_OBJECT(revealer),"destroy", G_CALLBACK(__yon_ubl_status_box_destroyed),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_margin_bottom(label,9);
|
|
|
|
gtk_widget_set_margin_bottom(label,9);
|
|
|
|
gtk_widget_set_margin_top(label,9);
|
|
|
|
gtk_widget_set_margin_top(label,9);
|
|
|
|
@ -861,8 +904,8 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti
|
|
|
|
struct temp_statusbox *statusstruct = malloc(sizeof(struct temp_statusbox));
|
|
|
|
struct temp_statusbox *statusstruct = malloc(sizeof(struct temp_statusbox));
|
|
|
|
statusstruct->revealer = revealer;
|
|
|
|
statusstruct->revealer = revealer;
|
|
|
|
statusstruct->times = timeout;
|
|
|
|
statusstruct->times = timeout;
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(revealer),"destroy", G_CALLBACK(__yon_ubl_status_box_destroyed),statusstruct);
|
|
|
|
GThread *thread = g_thread_new("StatusThread",(GThreadFunc)_yon_ubl_status_box_timed_remove,statusstruct);
|
|
|
|
GThread *thread = g_thread_new("StatusThread",(GThreadFunc)_yon_ubl_status_box_timed_remove,statusstruct);
|
|
|
|
status_thread_busy=1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1165,7 +1208,91 @@ void yon_gtk_tree_store_copy_full(GtkTreeStore *source, GtkTreeStore *destinatio
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gboolean yon_gtk_tree_iter_get_from_combo_box_id(GtkComboBox *combo, GtkTreeModel *model, GtkTreeIter *iter){
|
|
|
|
|
|
|
|
g_return_val_if_fail(GTK_IS_COMBO_BOX(combo),0);
|
|
|
|
|
|
|
|
g_return_val_if_fail(GTK_IS_TREE_MODEL(model),0);
|
|
|
|
|
|
|
|
const char *id = gtk_combo_box_get_active_id(combo);
|
|
|
|
|
|
|
|
if (yon_char_is_empty(id)) return 0;
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter_from_string(model,iter,id);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gboolean yon_gtk_tree_model_check_exist(GtkTreeModel *model, GtkTreeIter *iter, char *id, int column){
|
|
|
|
|
|
|
|
g_return_val_if_fail(model&>K_IS_TREE_MODEL(model),0);
|
|
|
|
|
|
|
|
g_return_val_if_fail(iter,0);
|
|
|
|
|
|
|
|
for_iter(model,iter){
|
|
|
|
|
|
|
|
char *check_target;
|
|
|
|
|
|
|
|
gtk_tree_model_get(model,iter,column,&check_target,-1);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(check_target)&&!strcmp(id,check_target)){
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_calendar_set_orientation = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_calendar_last_date = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_calendar_get_last_date(){
|
|
|
|
|
|
|
|
return yon_calendar_last_date;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_calendar_set_date_orientation(int orientation){
|
|
|
|
|
|
|
|
yon_calendar_set_orientation = orientation;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_on_date_selected(GtkWidget *self,GtkWidget *target){
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (self){};
|
|
|
|
|
|
|
|
unsigned int year=0, month=0, day=0;
|
|
|
|
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(self),&year,&month,&day);
|
|
|
|
|
|
|
|
char *dy = yon_char_from_int(day);
|
|
|
|
|
|
|
|
char *mn = yon_char_from_int(month+1);
|
|
|
|
|
|
|
|
char *yr = yon_char_from_int(year);
|
|
|
|
|
|
|
|
if (month+1<10) mn = yon_char_append("0",mn);
|
|
|
|
|
|
|
|
if (day<10) dy = yon_char_append("0",dy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GDateTime *datetime = g_date_time_new_now_local();
|
|
|
|
|
|
|
|
GDateTime *current_datetime = g_date_time_new_local(year,month+1,day,0,0,0);
|
|
|
|
|
|
|
|
int comparison = g_date_time_compare(current_datetime,datetime);
|
|
|
|
|
|
|
|
if ((comparison <0&&yon_calendar_set_orientation>0)||(comparison>0&&yon_calendar_set_orientation<0)){
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target),g_date_time_format(datetime,"%Y-%m-%d"));
|
|
|
|
|
|
|
|
yon_calendar_last_date = g_date_time_to_unix(datetime);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
char *date_string = yon_char_unite(yr,"-",mn,"-",dy,NULL);
|
|
|
|
|
|
|
|
gtk_entry_set_text(GTK_ENTRY(target), date_string);
|
|
|
|
|
|
|
|
yon_calendar_last_date = g_date_time_to_unix(current_datetime);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free(dy);
|
|
|
|
|
|
|
|
free(mn);
|
|
|
|
|
|
|
|
free(yr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_on_popover_closed(GtkWidget *self){
|
|
|
|
|
|
|
|
gtk_widget_destroy(self);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_calendar_popover_open(GtkEntry *TargetEntry,GtkWidget *PopupTarget){
|
|
|
|
|
|
|
|
g_return_if_fail(GTK_IS_ENTRY(TargetEntry));
|
|
|
|
|
|
|
|
g_return_if_fail(GTK_IS_WIDGET(PopupTarget));
|
|
|
|
|
|
|
|
GtkWidget *popover = gtk_popover_new(PopupTarget);
|
|
|
|
|
|
|
|
GtkWidget *calendar = gtk_calendar_new();
|
|
|
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(popover),calendar);
|
|
|
|
|
|
|
|
gtk_widget_show_all(popover);
|
|
|
|
|
|
|
|
gtk_popover_popup(GTK_POPOVER(popover));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *date_str = gtk_entry_get_text(TargetEntry);
|
|
|
|
|
|
|
|
if (date_str&&strcmp(date_str,"")){
|
|
|
|
|
|
|
|
int date_size;
|
|
|
|
|
|
|
|
config_str date_parsed = yon_char_parse((char*)date_str,&date_size,"-");
|
|
|
|
|
|
|
|
gtk_calendar_select_day(GTK_CALENDAR(calendar),atoi(date_parsed[2]));
|
|
|
|
|
|
|
|
gtk_calendar_select_month(GTK_CALENDAR(calendar),atoi(date_parsed[1])-1,atoi(date_parsed[0]));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(calendar),"day-selected",G_CALLBACK(yon_on_date_selected),TargetEntry);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(popover),"closed",G_CALLBACK(yon_on_popover_closed),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|