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 (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",",");
if (settings[0]==',') yon_char_divide_search(settings,",",-1);
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);
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->AddButton = yon_gtk_builder_get_widget(builder,"AddButton");
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_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 *CancelButton;
GtkWidget *SaveButton;
GtkWidget *StatusBox;
} logrotate_window;
typedef struct {

@ -1363,11 +1363,13 @@ int yon_config_save_registered(char *path){
if (sections_add)
for_dictionaries(dct,sections_add){
char *command = yon_dictionary_get_data(dct,char*);
printf(command);
yon_launch(command);
}
if (sections_remove)
for_dictionaries(dct,sections_remove){
char *command = yon_dictionary_get_data(dct,char*);
printf(command);
yon_launch(command);
}
return 1;
@ -2103,58 +2105,63 @@ void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){
gtk_revealer_set_reveal_child(GTK_REVEALER(statusstruct->revealer),0);
sleep(1);
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){
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
GtkWidget *revealer = gtk_revealer_new();
GtkWidget *label = gtk_label_new("");
GtkWidget *icon = gtk_image_new();
gtk_container_add(GTK_CONTAINER(revealer),box);
gtk_box_pack_start(GTK_BOX(box),icon,0,0,5);
gtk_box_pack_start(GTK_BOX(box),label,0,0,5);
gtk_container_add(container,revealer);
gtk_widget_show_all(revealer);
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1);
gtk_widget_set_margin_bottom(label,9);
gtk_widget_set_margin_top(label,9);
gtk_label_set_xalign(GTK_LABEL(label),0.0);
PangoAttrList *attributes = pango_attr_list_new();
PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
pango_attr_list_insert(attributes, boldAttr);
gtk_label_set_attributes(GTK_LABEL(label),attributes);
GdkRGBA textColor;
gdk_rgba_parse(&textColor, "#4d4d4d4d4d4d");
PangoAttribute *colorAttr = pango_attr_foreground_new(
(int)(textColor.red * 65535),
(int)(textColor.green * 65535),
(int)(textColor.blue * 65535)
);
pango_attr_list_insert(attributes, colorAttr);
GtkIconTheme *ictheme = gtk_icon_theme_get_default();
if (type == BACKGROUND_IMAGE_SUCCESS_TYPE||! type)
{
gtk_style_context_remove_class(gtk_widget_get_style_context(box), "boxInfoMessError");
gtk_style_context_add_class(gtk_widget_get_style_context(box), "boxInfoMessOK");
gtk_image_set_from_pixbuf(GTK_IMAGE(icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-logging.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
}
else if (type == BACKGROUND_IMAGE_FAIL_TYPE)
{
gtk_style_context_remove_class(gtk_widget_get_style_context(box), "boxInfoMessOK");
gtk_style_context_add_class(gtk_widget_get_style_context(box), "boxInfoMessError");
gtk_image_set_from_pixbuf(GTK_IMAGE(icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-logging.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
}
if (display_text)
gtk_label_set_text(GTK_LABEL(label),display_text);
if (!status_thread_busy){
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
GtkWidget *revealer = gtk_revealer_new();
GtkWidget *label = gtk_label_new("");
GtkWidget *icon = gtk_image_new();
gtk_container_add(GTK_CONTAINER(revealer),box);
gtk_box_pack_start(GTK_BOX(box),icon,0,0,5);
gtk_box_pack_start(GTK_BOX(box),label,0,0,5);
gtk_container_add(container,revealer);
gtk_widget_show_all(revealer);
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1);
gtk_widget_set_margin_bottom(label,9);
gtk_widget_set_margin_top(label,9);
gtk_label_set_xalign(GTK_LABEL(label),0.0);
PangoAttrList *attributes = pango_attr_list_new();
PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
pango_attr_list_insert(attributes, boldAttr);
gtk_label_set_attributes(GTK_LABEL(label),attributes);
GdkRGBA textColor;
gdk_rgba_parse(&textColor, "#4d4d4d4d4d4d");
PangoAttribute *colorAttr = pango_attr_foreground_new(
(int)(textColor.red * 65535),
(int)(textColor.green * 65535),
(int)(textColor.blue * 65535)
);
pango_attr_list_insert(attributes, colorAttr);
GtkIconTheme *ictheme = gtk_icon_theme_get_default();
if (type == BACKGROUND_IMAGE_SUCCESS_TYPE||! type)
{
gtk_style_context_remove_class(gtk_widget_get_style_context(box), "boxInfoMessError");
gtk_style_context_add_class(gtk_widget_get_style_context(box), "boxInfoMessOK");
gtk_image_set_from_pixbuf(GTK_IMAGE(icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-logging.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
}
else if (type == BACKGROUND_IMAGE_FAIL_TYPE)
{
gtk_style_context_remove_class(gtk_widget_get_style_context(box), "boxInfoMessOK");
gtk_style_context_add_class(gtk_widget_get_style_context(box), "boxInfoMessError");
gtk_image_set_from_pixbuf(GTK_IMAGE(icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-logging.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
}
if (display_text)
gtk_label_set_text(GTK_LABEL(label),display_text);
struct temp_statusbox *statusstruct = malloc(sizeof(struct temp_statusbox));
statusstruct->revealer = revealer;
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)

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

@ -60,40 +60,101 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkNotebook">
<object class="GtkBox" id="StatusBox">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkNotebook">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="spacing">5</property>
<property name="can-focus">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="AddButton">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image5</property>
<style>
<class name="thin"/>
</style>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="AddButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image5</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="RemoveButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image4</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ConfigureButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image3</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -102,146 +163,186 @@
</packing>
</child>
<child>
<object class="GtkButton" id="RemoveButton">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image4</property>
<style>
<class name="thin"/>
</style>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="MainTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Log/Journal</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Path</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Description</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ConfigureButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image3</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">System configuration</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="tab-fill">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="spacing">5</property>
<child>
<object class="GtkTreeView" id="MainTree">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Log/Journal</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
<object class="GtkButton" id="AppsConfigureButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image8</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Path</property>
<object class="GtkTreeView" id="AppsMainTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Log/Journal</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Description</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Path</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">System configuration</property>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Applications configuration</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab-fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="tab-fill">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="halign">end</property>
<property name="spacing">5</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkBox">
<object class="GtkButton" id="CancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="AppsConfigureButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image8</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
</object>
<packing>
<property name="expand">False</property>
@ -250,100 +351,20 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<object class="GtkButton" id="SaveButton">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="AppsMainTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Log/Journal</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Path</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<property name="receives-default">True</property>
<property name="image">image2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Applications configuration</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab-fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="spacing">5</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="CancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="SaveButton">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image2</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
@ -352,7 +373,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>

Loading…
Cancel
Save