static void pgd_form_field_view_set_field (GtkWidget *field_view, PopplerFormField *field) { GtkWidget *alignment; GtkWidget *table; PopplerAction *action; GEnumValue *enum_value; gchar *text; gint row = 0; alignment = gtk_bin_get_child (GTK_BIN (field_view)); if (alignment) { gtk_container_remove (GTK_CONTAINER (field_view), alignment); } alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 12, 5); gtk_container_add (GTK_CONTAINER (field_view), alignment); gtk_widget_show (alignment); if (!field) return; table = gtk_table_new (13, 2, FALSE); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); text = poppler_form_field_get_name (field); if (text) { pgd_table_add_property (GTK_TABLE (table), "<b>Name:</b>", text, &row); g_free (text); } text = poppler_form_field_get_partial_name (field); if (text) { pgd_table_add_property (GTK_TABLE (table), "<b>Partial Name:</b>", text, &row); g_free (text); } text = poppler_form_field_get_mapping_name (field); if (text) { pgd_table_add_property (GTK_TABLE (table), "<b>Mapping Name:</b>", text, &row); g_free (text); } action = poppler_form_field_get_action (field); if (action) { GtkWidget *action_view; action_view = pgd_action_view_new (NULL); pgd_action_view_set_action (action_view, action); pgd_table_add_property_with_custom_widget (GTK_TABLE (table), "<b>Action:</b>", action_view, &row); gtk_widget_show (action_view); } switch (poppler_form_field_get_field_type (field)) { case POPPLER_FORM_FIELD_BUTTON: enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (POPPLER_TYPE_FORM_BUTTON_TYPE), poppler_form_field_button_get_button_type (field)); pgd_table_add_property (GTK_TABLE (table), "<b>Button Type:</b>", enum_value->value_name, &row); pgd_table_add_property (GTK_TABLE (table), "<b>Button State:</b>", poppler_form_field_button_get_state (field) ? "Active" : "Inactive", &row); break; case POPPLER_FORM_FIELD_TEXT: enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (POPPLER_TYPE_FORM_TEXT_TYPE), poppler_form_field_text_get_text_type (field)); pgd_table_add_property (GTK_TABLE (table), "<b>Text Type:</b>", enum_value->value_name, &row); text = poppler_form_field_text_get_text (field); pgd_table_add_property (GTK_TABLE (table), "<b>Contents:</b>", text, &row); g_free (text); text = g_strdup_printf ("%d", poppler_form_field_text_get_max_len (field)); pgd_table_add_property (GTK_TABLE (table), "<b>Max Length:</b>", text, &row); g_free (text); pgd_table_add_property (GTK_TABLE (table), "<b>Do spellcheck:</b>", poppler_form_field_text_do_spell_check (field) ? "Yes" : "No", &row); pgd_table_add_property (GTK_TABLE (table), "<b>Do scroll:</b>", poppler_form_field_text_do_scroll (field) ? "Yes" : "No", &row); pgd_table_add_property (GTK_TABLE (table), "<b>Rich Text:</b>", poppler_form_field_text_is_rich_text (field) ? "Yes" : "No", &row); pgd_table_add_property (GTK_TABLE (table), "<b>Pasword type:</b>", poppler_form_field_text_is_password (field) ? "Yes" : "No", &row); break; case POPPLER_FORM_FIELD_CHOICE: { gchar *item; gint selected = -1; enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (POPPLER_TYPE_FORM_CHOICE_TYPE), poppler_form_field_choice_get_choice_type (field)); pgd_table_add_property (GTK_TABLE (table), "<b>Choice Type:</b>", enum_value->value_name, &row); pgd_table_add_property (GTK_TABLE (table), "<b>Editable:</b>", poppler_form_field_choice_is_editable (field) ? "Yes" : "No", &row); pgd_table_add_property (GTK_TABLE (table), "<b>Multiple Selection:</b>", poppler_form_field_choice_can_select_multiple (field) ? "Yes" : "No", &row); pgd_table_add_property (GTK_TABLE (table), "<b>Do spellcheck:</b>", poppler_form_field_choice_do_spell_check (field) ? "Yes" : "No", &row); pgd_table_add_property (GTK_TABLE (table), "<b>Commit on Change:</b>", poppler_form_field_choice_commit_on_change (field) ? "Yes" : "No", &row); text = g_strdup_printf ("%d", poppler_form_field_choice_get_n_items (field)); pgd_table_add_property (GTK_TABLE (table), "<b>Number of items:</b>", text, &row); g_free (text); pgd_form_field_view_add_choice_items (GTK_TABLE (table), field, &selected, &row); if (selected >= 0 && poppler_form_field_choice_get_n_items (field) > selected) { item = poppler_form_field_choice_get_item (field, selected); text = g_strdup_printf ("%d (%s)", selected, item); g_free (item); pgd_table_add_property (GTK_TABLE (table), "<b>Selected item:</b>", text, &row); g_free (text); } text = poppler_form_field_choice_get_text (field); pgd_table_add_property (GTK_TABLE (table), "<b>Contents:</b>", text, &row); g_free (text); } break; case POPPLER_FORM_FIELD_SIGNATURE: case POPPLER_FORM_FIELD_UNKNOWN: break; default: g_assert_not_reached (); } gtk_container_add (GTK_CONTAINER (alignment), table); gtk_widget_show (table); }
static VALUE rg_spell_check_p(VALUE self) { return CBOOL2RVAL(poppler_form_field_text_do_spell_check(_SELF(self))); }