Ejemplo n.º 1
0
/**
* builder: the gtk builder object
* dialog: The dialog to extract the data from
*
* Gets the unlocking settings and stores them in output_data
*
**/
static void
gather_unlock_options (GtkBuilder *builder, GtkDialog *dialog)
{
	GcrUnlockOptionsWidget *unlock;
	const gchar *choice;

	unlock = g_object_get_data (G_OBJECT (dialog), "unlock-options-widget");

	choice = gcr_unlock_options_widget_get_choice (unlock);
	if (choice) {
		g_key_file_set_integer (output_data, "unlock-options", "ttl",
		                        gcr_unlock_options_widget_get_ttl (unlock));

		g_key_file_set_string (output_data, "unlock-options", "choice", choice);
	}
}
Ejemplo n.º 2
0
static void
test_unlock_options (void)
{
	GcrUnlockOptionsWidget *unlock;
	GtkDialog *dialog;

	dialog = GTK_DIALOG (gtk_dialog_new ());
	g_object_ref_sink (dialog);

	unlock = GCR_UNLOCK_OPTIONS_WIDGET (gcr_unlock_options_widget_new ());
	gtk_widget_show (GTK_WIDGET (unlock));
	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (unlock));

	gcr_unlock_options_widget_set_sensitive (unlock, GCR_UNLOCK_OPTION_IDLE, FALSE,
	                                         "This is a test of the tooltip.");
	gcr_unlock_options_widget_set_sensitive (unlock, GCR_UNLOCK_OPTION_ALWAYS, TRUE, NULL);
	gcr_unlock_options_widget_set_label (unlock, GCR_UNLOCK_OPTION_IDLE, "Disabled label test");
	gcr_unlock_options_widget_set_ttl (unlock, 80);
	gcr_unlock_options_widget_set_choice (unlock, GCR_UNLOCK_OPTION_ALWAYS);

	gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 400);
	gtk_dialog_run (dialog);

	g_printerr ("choice: %s\n",
	            gcr_unlock_options_widget_get_choice (unlock));

	g_printerr ("ttl: %u\n",
	            gcr_unlock_options_widget_get_ttl (unlock));

	g_printerr ("idle sensitive: %s\n",
	            gcr_unlock_options_widget_get_sensitive (unlock, GCR_UNLOCK_OPTION_IDLE) ? "T" : "F");

	g_printerr ("always sensitive: %s\n",
	            gcr_unlock_options_widget_get_sensitive (unlock, GCR_UNLOCK_OPTION_ALWAYS) ? "T" : "F");

	g_printerr ("label: %s\n",
	            gcr_unlock_options_widget_get_label (unlock, GCR_UNLOCK_OPTION_ALWAYS));

	g_object_unref (dialog);
}