Commit e9bd0f2e authored by Sebastian Ramacher's avatar Sebastian Ramacher

Fix unmatched gtk_style_context_{save,restore} calls

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 1cee5a37
......@@ -52,6 +52,8 @@ HIDDEN void update_state_by_keyval(int *state, int keyval);
HIDDEN void widget_add_class(GtkWidget* widget, const char* styleclass);
HIDDEN void widget_remove_class(GtkWidget* widget, const char* styleclass);
/**
* Default complection function for the settings
*
......
......@@ -458,8 +458,6 @@ girara_session_init(girara_session_t* session, const char* sessionname)
/* notification area */
widget_add_class(session->gtk.notification_area, "notification");
widget_add_class(session->gtk.notification_text, "notification");
gtk_style_context_save(gtk_widget_get_style_context(session->gtk.notification_area));
gtk_style_context_save(gtk_widget_get_style_context(session->gtk.notification_text));
/* set window size */
int window_width = 0;
......@@ -672,13 +670,10 @@ girara_notify(girara_session_t* session, int level, const char* format, ...)
return;
}
GtkStyleContext* area_context = gtk_widget_get_style_context(session->gtk.notification_area);
GtkStyleContext* text_context = gtk_widget_get_style_context(session->gtk.notification_text);
gtk_style_context_restore(area_context);
gtk_style_context_restore(text_context);
gtk_style_context_save(area_context);
gtk_style_context_save(text_context);
widget_remove_class(session->gtk.notification_area, "notification-error");
widget_remove_class(session->gtk.notification_text, "notification-error");
widget_remove_class(session->gtk.notification_area, "notification-warning");
widget_remove_class(session->gtk.notification_text, "notification-warning");
const char* cssclass = NULL;
switch (level) {
......
......@@ -542,3 +542,13 @@ widget_add_class(GtkWidget* widget, const char* styleclass)
gtk_style_context_add_class(context, styleclass);
}
void
widget_remove_class(GtkWidget* widget, const char* styleclass)
{
if (widget == NULL || styleclass == NULL) {
return;
}
GtkStyleContext* context = gtk_widget_get_style_context(widget);
gtk_style_context_remove_class(context, styleclass);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment