You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.9 KiB

12 years ago
/* $Id */
/*
12 years ago
* Copyright (C) 2006-2007 Jasper Huijsmans <jasper@xfce.org>
* Copyright (C) 2008-2009 Nick Schermer <nick@xfce.org>
12 years ago
*
* This library is free software; you can redistribute it and/or
12 years ago
* modify it under the terms of the GNU Lesser General Public
12 years ago
* License as published by the Free Software Foundation; either
12 years ago
* version 2.1 of the License, or (at your option) any later version.
12 years ago
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 years ago
* Lesser General Public License for more details.
12 years ago
*
12 years ago
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
12 years ago
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libxfce4util/libxfce4util.h>
#include <gtk/gtk.h>
#include <libxfce4panel/libxfce4panel.h>
12 years ago
/**
* xfce_panel_create_button:
12 years ago
*
* Create regular #GtkButton with a few properties set to be useful in the
* Xfce panel: Flat (%GTK_RELIEF_NONE), no focus on click and minimal padding.
*
* Returns: newly created #GtkButton.
**/
PANEL_SYMBOL_EXPORT GtkWidget *
xfce_panel_create_button (void)
12 years ago
{
GtkWidget *button = gtk_button_new ();
GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
gtk_widget_set_name (button, "xfce_panel_button");
return button;
}
/**
* xfce_panel_create_toggle_button:
12 years ago
*
* Create regular #GtkToggleButton with a few properties set to be useful in
* Xfce panel: Flat (%GTK_RELIEF_NONE), no focus on click and minimal padding.
*
* Returns: newly created #GtkToggleButton.
**/
PANEL_SYMBOL_EXPORT GtkWidget *
xfce_panel_create_toggle_button (void)
12 years ago
{
GtkWidget *button = gtk_toggle_button_new ();
GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
gtk_widget_set_name (button, "xfce_panel_toggle_button");
return button;
}
/**
* xfce_panel_allow_customization:
12 years ago
*
* Check if the user is allowed to customize the panel. Uses the kiosk mode
* implementation from libxfce4util.
*
* Returns: %TRUE if the user is allowed to customize the panel, %FALSE
* otherwise.
**/
PANEL_SYMBOL_EXPORT gboolean
xfce_panel_allow_customization (void)
12 years ago
{
static gboolean allow_customization = FALSE;
static gboolean checked = FALSE;
XfceKiosk *kiosk;
if (G_UNLIKELY (!checked))
{
kiosk = xfce_kiosk_new ("xfce4-panel");
allow_customization = xfce_kiosk_query (kiosk, "CustomizePanel");
xfce_kiosk_free (kiosk);
checked = TRUE;
}
return allow_customization;
}