Blame ui/frob-unlock-options.c

Packit b00eeb
/*
Packit b00eeb
 * gnome-keyring
Packit b00eeb
 *
Packit b00eeb
 * Copyright (C) 2010 Collabora Ltd.
Packit b00eeb
 *
Packit b00eeb
 * This program is free software; you can redistribute it and/or modify
Packit b00eeb
 * it under the terms of the GNU Lesser General Public License as
Packit b00eeb
 * published by the Free Software Foundation; either version 2.1 of
Packit b00eeb
 * the License, or (at your option) any later version.
Packit b00eeb
 *
Packit b00eeb
 * This program is distributed in the hope that it will be useful, but
Packit b00eeb
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit b00eeb
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit b00eeb
 * Lesser General Public License for more details.
Packit b00eeb
 *
Packit b00eeb
 * You should have received a copy of the GNU Lesser General Public
Packit b00eeb
 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
Packit b00eeb
 *
Packit b00eeb
 * Author: Stef Walter <stefw@collabora.co.uk>
Packit b00eeb
 */
Packit b00eeb
Packit b00eeb
#include "config.h"
Packit b00eeb
Packit b00eeb
#include "gcr/gcr.h"
Packit b00eeb
Packit b00eeb
#include <gtk/gtk.h>
Packit b00eeb
Packit b00eeb
#include <unistd.h>
Packit b00eeb
#include <string.h>
Packit b00eeb
#include <errno.h>
Packit b00eeb
Packit b00eeb
static void
Packit b00eeb
test_unlock_options (void)
Packit b00eeb
{
Packit b00eeb
	GcrUnlockOptionsWidget *unlock;
Packit b00eeb
	GtkDialog *dialog;
Packit b00eeb
Packit b00eeb
	dialog = GTK_DIALOG (gtk_dialog_new ());
Packit b00eeb
	g_object_ref_sink (dialog);
Packit b00eeb
Packit b00eeb
	unlock = GCR_UNLOCK_OPTIONS_WIDGET (gcr_unlock_options_widget_new ());
Packit b00eeb
	gtk_widget_show (GTK_WIDGET (unlock));
Packit b00eeb
	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (unlock));
Packit b00eeb
Packit b00eeb
	gcr_unlock_options_widget_set_sensitive (unlock, GCR_UNLOCK_OPTION_IDLE, FALSE,
Packit b00eeb
	                                         "This is a test of the tooltip.");
Packit b00eeb
	gcr_unlock_options_widget_set_sensitive (unlock, GCR_UNLOCK_OPTION_ALWAYS, TRUE, NULL);
Packit b00eeb
	gcr_unlock_options_widget_set_label (unlock, GCR_UNLOCK_OPTION_IDLE, "Disabled label test");
Packit b00eeb
	gcr_unlock_options_widget_set_ttl (unlock, 80);
Packit b00eeb
	gcr_unlock_options_widget_set_choice (unlock, GCR_UNLOCK_OPTION_ALWAYS);
Packit b00eeb
Packit b00eeb
	gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 400);
Packit b00eeb
	gtk_dialog_run (dialog);
Packit b00eeb
Packit b00eeb
	g_printerr ("choice: %s\n",
Packit b00eeb
	            gcr_unlock_options_widget_get_choice (unlock));
Packit b00eeb
Packit b00eeb
	g_printerr ("ttl: %u\n",
Packit b00eeb
	            gcr_unlock_options_widget_get_ttl (unlock));
Packit b00eeb
Packit b00eeb
	g_printerr ("idle sensitive: %s\n",
Packit b00eeb
	            gcr_unlock_options_widget_get_sensitive (unlock, GCR_UNLOCK_OPTION_IDLE) ? "T" : "F");
Packit b00eeb
Packit b00eeb
	g_printerr ("always sensitive: %s\n",
Packit b00eeb
	            gcr_unlock_options_widget_get_sensitive (unlock, GCR_UNLOCK_OPTION_ALWAYS) ? "T" : "F");
Packit b00eeb
Packit b00eeb
	g_printerr ("label: %s\n",
Packit b00eeb
	            gcr_unlock_options_widget_get_label (unlock, GCR_UNLOCK_OPTION_ALWAYS));
Packit b00eeb
Packit b00eeb
	g_object_unref (dialog);
Packit b00eeb
}
Packit b00eeb
Packit b00eeb
int
Packit b00eeb
main(int argc, char *argv[])
Packit b00eeb
{
Packit b00eeb
	gtk_init (&argc, &argv);
Packit b00eeb
	g_set_prgname ("frob-unlock-options");
Packit b00eeb
Packit b00eeb
	test_unlock_options ();
Packit b00eeb
Packit b00eeb
	return 0;
Packit b00eeb
}