Fix superuser warning bar
This commit is contained in:
parent
aa6c1ccec4
commit
8495ffa571
1 changed files with 17 additions and 10 deletions
19
src/sokoke.c
19
src/sokoke.c
|
@ -16,6 +16,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
@ -279,7 +282,8 @@ gpointer sokoke_xfce_header_new(const gchar* icon, const gchar* title)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpointer sokoke_superuser_warning_new(void)
|
gpointer
|
||||||
|
sokoke_superuser_warning_new (void)
|
||||||
{
|
{
|
||||||
// Create a horizontal bar with a security warning
|
// Create a horizontal bar with a security warning
|
||||||
// This returns NULL if the user is no superuser
|
// This returns NULL if the user is no superuser
|
||||||
|
@ -287,13 +291,16 @@ gpointer sokoke_superuser_warning_new(void)
|
||||||
if (G_UNLIKELY (!geteuid ())) // effective superuser?
|
if (G_UNLIKELY (!geteuid ())) // effective superuser?
|
||||||
{
|
{
|
||||||
GtkWidget* hbox = gtk_event_box_new ();
|
GtkWidget* hbox = gtk_event_box_new ();
|
||||||
gtk_widget_modify_bg(hbox, GTK_STATE_NORMAL
|
gtk_widget_modify_bg (hbox, GTK_STATE_NORMAL,
|
||||||
, &hbox->style->bg[GTK_STATE_SELECTED]);
|
&hbox->style->bg[GTK_STATE_SELECTED]);
|
||||||
GtkWidget* label = gtk_label_new(_("Warning: You are using a superuser account!"));
|
GtkWidget* label = gtk_label_new (
|
||||||
|
_("Warning: You are using a superuser account!"));
|
||||||
gtk_misc_set_padding (GTK_MISC (label), 0, 2);
|
gtk_misc_set_padding (GTK_MISC (label), 0, 2);
|
||||||
gtk_widget_modify_fg(GTK_WIDGET(label), GTK_STATE_NORMAL
|
gtk_widget_modify_fg (GTK_WIDGET (label), GTK_STATE_NORMAL,
|
||||||
, >K_WIDGET(label)->style->fg[GTK_STATE_SELECTED]);
|
>K_WIDGET (label)->style->fg[GTK_STATE_SELECTED]);
|
||||||
|
gtk_widget_show (label);
|
||||||
gtk_container_add (GTK_CONTAINER(hbox), GTK_WIDGET (label));
|
gtk_container_add (GTK_CONTAINER(hbox), GTK_WIDGET (label));
|
||||||
|
gtk_widget_show (hbox);
|
||||||
return hbox;
|
return hbox;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue