Merge branch 'gtk3_infobar'
This commit is contained in:
@@ -133,7 +133,11 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
|
|||||||
XtmProcessStatusbar *statusbar = XTM_PROCESS_STATUSBAR (object);
|
XtmProcessStatusbar *statusbar = XTM_PROCESS_STATUSBAR (object);
|
||||||
gchar *text;
|
gchar *text;
|
||||||
gchar *float_value;
|
gchar *float_value;
|
||||||
|
#ifdef HAVE_GTK3
|
||||||
|
GdkRGBA color;
|
||||||
|
#else
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
@@ -142,8 +146,13 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
|
|||||||
float_value = rounded_float_value (statusbar->cpu, statusbar->settings);
|
float_value = rounded_float_value (statusbar->cpu, statusbar->settings);
|
||||||
text = g_strdup_printf (_("CPU: %s%%"), float_value);
|
text = g_strdup_printf (_("CPU: %s%%"), float_value);
|
||||||
gtk_label_set_text (GTK_LABEL (statusbar->label_cpu), text);
|
gtk_label_set_text (GTK_LABEL (statusbar->label_cpu), text);
|
||||||
|
#ifdef HAVE_GTK3
|
||||||
|
gdk_rgba_parse (&color, "#ff6e00");
|
||||||
|
gtk_widget_override_color (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
|
||||||
|
#else
|
||||||
gdk_color_parse ("#ff6e00", &color);
|
gdk_color_parse ("#ff6e00", &color);
|
||||||
gtk_widget_modify_fg (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
|
gtk_widget_modify_fg (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
|
||||||
|
#endif
|
||||||
g_free (float_value);
|
g_free (float_value);
|
||||||
g_free (text);
|
g_free (text);
|
||||||
break;
|
break;
|
||||||
@@ -152,8 +161,13 @@ xtm_process_statusbar_set_property (GObject *object, guint property_id, const GV
|
|||||||
g_strlcpy(statusbar->memory, g_value_get_string (value), 64);
|
g_strlcpy(statusbar->memory, g_value_get_string (value), 64);
|
||||||
text = g_strdup_printf (_("Memory: %s"), statusbar->memory);
|
text = g_strdup_printf (_("Memory: %s"), statusbar->memory);
|
||||||
gtk_label_set_text (GTK_LABEL (statusbar->label_memory), text);
|
gtk_label_set_text (GTK_LABEL (statusbar->label_memory), text);
|
||||||
|
#ifdef HAVE_GTK3
|
||||||
|
gdk_rgba_parse (&color, "#ab1852");
|
||||||
|
gtk_widget_override_color (statusbar->label_cpu, GTK_STATE_NORMAL, &color);
|
||||||
|
#else
|
||||||
gdk_color_parse ("#ab1852", &color);
|
gdk_color_parse ("#ab1852", &color);
|
||||||
gtk_widget_modify_fg (statusbar->label_memory, GTK_STATE_NORMAL, &color);
|
gtk_widget_modify_fg (statusbar->label_memory, GTK_STATE_NORMAL, &color);
|
||||||
|
#endif
|
||||||
g_free (text);
|
g_free (text);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -172,9 +172,20 @@ xtm_process_window_init (XtmProcessWindow *window)
|
|||||||
|
|
||||||
if (geteuid () == 0)
|
if (geteuid () == 0)
|
||||||
{
|
{
|
||||||
gtk_rc_parse_string ("style\"root-warning-style\"{bg[NORMAL]=\"#b4254b\"\nfg[NORMAL]=\"#fefefe\"}\n"
|
#ifdef HAVE_GTK3
|
||||||
|
GtkCssProvider *css_provider;
|
||||||
|
css_provider = gtk_css_provider_new ();
|
||||||
|
gtk_css_provider_load_from_data (css_provider,
|
||||||
|
"#root-warning { background-color: #e53935; color: #ffffff; }",
|
||||||
|
-1, NULL);
|
||||||
|
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (css_provider),
|
||||||
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
g_object_unref (css_provider);
|
||||||
|
#else
|
||||||
|
gtk_rc_parse_string ("style\"root-warning-style\"{bg[NORMAL]=\"#e53935\"\nfg[NORMAL]=\"#ffffff\"}\n"
|
||||||
"widget\"GtkWindow.*.root-warning\"style\"root-warning-style\"\n"
|
"widget\"GtkWindow.*.root-warning\"style\"root-warning-style\"\n"
|
||||||
"widget\"GtkWindow.*.root-warning.GtkLabel\"style\"root-warning-style\"");
|
"widget\"GtkWindow.*.root-warning.GtkLabel\"style\"root-warning-style\"");
|
||||||
|
#endif
|
||||||
gtk_widget_set_name (GTK_WIDGET (gtk_builder_get_object (window->builder, "root-warning-ebox")), "root-warning");
|
gtk_widget_set_name (GTK_WIDGET (gtk_builder_get_object (window->builder, "root-warning-ebox")), "root-warning");
|
||||||
gtk_widget_show_all (GTK_WIDGET (gtk_builder_get_object (window->builder, "root-warning-box")));
|
gtk_widget_show_all (GTK_WIDGET (gtk_builder_get_object (window->builder, "root-warning-box")));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user