Status messages for logrotate tab window

pull/46/head
parent 1801dd0dd9
commit 2092c0f8ac

@ -1202,12 +1202,17 @@ void on_logrotate_apps_configure(GtkWidget *self, logrotate_window *window){
if (!strcmp(cur[i],parsed_check[j])) found ++; if (!strcmp(cur[i],parsed_check[j])) found ++;
} }
} }
if (cur_size==found) return; if (cur_size==found) {
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),REPEATED_PATHS_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
return;
}
} }
settings = yon_char_replace(settings,",\t",","); settings = yon_char_replace(settings,",\t",",");
if (settings[0]==',') yon_char_divide_search(settings,",",-1); if (settings[0]==',') yon_char_divide_search(settings,",",-1);
yon_config_register(LOGROTATE(yon_char_replace(paths,"\n",",")),"logging",settings); yon_config_register(LOGROTATE(yon_char_replace(paths,"\n",",")),"logging",settings);
gtk_list_store_set(main_config.logrotate_list,&itar,0,name,1,paths,-1); gtk_list_store_set(main_config.logrotate_list,&itar,0,name,1,paths,-1);
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),SUCCESS_LABEL,5,BACKGROUND_IMAGE_SUCCESS_TYPE);
} }
} }
@ -1278,6 +1283,7 @@ void on_logrotate_tab_open(GtkWidget *self, main_window *widgets){
window->ConfigureButton = yon_gtk_builder_get_widget(builder,"ConfigureButton"); window->ConfigureButton = yon_gtk_builder_get_widget(builder,"ConfigureButton");
window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton"); window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton");
window->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton"); window->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton");
window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL); gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL);
gtk_tree_view_set_model(GTK_TREE_VIEW(window->MainTree),GTK_TREE_MODEL(main_config.logrotate_list)); gtk_tree_view_set_model(GTK_TREE_VIEW(window->MainTree),GTK_TREE_MODEL(main_config.logrotate_list));

@ -228,6 +228,7 @@ typedef struct {
GtkWidget *ConfigureButton; GtkWidget *ConfigureButton;
GtkWidget *CancelButton; GtkWidget *CancelButton;
GtkWidget *SaveButton; GtkWidget *SaveButton;
GtkWidget *StatusBox;
} logrotate_window; } logrotate_window;
typedef struct { typedef struct {

@ -1363,11 +1363,13 @@ int yon_config_save_registered(char *path){
if (sections_add) if (sections_add)
for_dictionaries(dct,sections_add){ for_dictionaries(dct,sections_add){
char *command = yon_dictionary_get_data(dct,char*); char *command = yon_dictionary_get_data(dct,char*);
printf(command);
yon_launch(command); yon_launch(command);
} }
if (sections_remove) if (sections_remove)
for_dictionaries(dct,sections_remove){ for_dictionaries(dct,sections_remove){
char *command = yon_dictionary_get_data(dct,char*); char *command = yon_dictionary_get_data(dct,char*);
printf(command);
yon_launch(command); yon_launch(command);
} }
return 1; return 1;
@ -2103,10 +2105,13 @@ void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){
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_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){
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("");
@ -2154,7 +2159,9 @@ 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;
GThread *thread = g_thread_new(NULL,(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;
}
} }
/**yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id) /**yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id)

@ -354,6 +354,7 @@ void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type);
void yon_ubl_status_highlight_incorrect(GtkWidget *widget); void yon_ubl_status_highlight_incorrect(GtkWidget *widget);
static int status_thread_busy;
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);
#ifdef __cplusplus #ifdef __cplusplus

@ -56,6 +56,26 @@
<property name="modal">True</property> <property name="modal">True</property>
<property name="icon-name">com.ublinux.ubl-settings-logging</property> <property name="icon-name">com.ublinux.ubl-settings-logging</property>
<property name="type-hint">dialog</property> <property name="type-hint">dialog</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="StatusBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
@ -151,9 +171,6 @@
<object class="GtkTreeView" id="MainTree"> <object class="GtkTreeView" id="MainTree">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Log/Journal</property> <property name="title" translatable="yes">Log/Journal</property>
@ -258,9 +275,6 @@
<object class="GtkTreeView" id="AppsMainTree"> <object class="GtkTreeView" id="AppsMainTree">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Log/Journal</property> <property name="title" translatable="yes">Log/Journal</property>
@ -358,6 +372,13 @@
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child> </child>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="headerBar"> <object class="GtkHeaderBar" id="headerBar">

Loading…
Cancel
Save