Redland
view release on metacpan or search on metacpan
redland/raptor/examples/grapper.c view on Meta::CPAN
static gint menu_item_factory_nentries = sizeof(menu_item_factory_entries) / sizeof(menu_item_factory_entries[0]);
static void
init_grapper_window(GtkWidget *window, grapper_state *state)
{
GtkAccelGroup *accel_group;
GtkItemFactory* menu_item_factory;
GtkWidget *menu_bar;
GtkMenu *prefs_menu;
GtkWidget *v_paned;
GtkWidget *v_box;
GtkWidget *box;
GtkWidget *go_button;
GtkWidget* feature_items[RAPTOR_FEATURE_LAST];
#ifdef GRAPPER_QNAMES
GtkWidget *qnames_button;
#endif
GtkWidget *guess_button;
GtkWidget *syntax_optionmenu;
GtkWidget *syntax_menu;
GtkWidget *url_entry;
GtkWidget *triples_frame, *prefs_frame;
GtkWidget *triples_scrolled_window;
GtkWidget *triples_treeview;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
#ifdef GRAPPER_QNAMES
GtkTooltips *qnames_tooltips;
#endif
GtkTooltips *guess_tooltips;
GtkTooltips *syntax_tooltips;
GtkWidget *prefs_box;
GtkListStore *store;
int i;
GtkWidget *errors_frame, *errors_scrolled_window;
GtkWidget *errors_treeview;
GtkListStore *errors_store;
state->window=window;
/* connect window delete event to callback */
g_signal_connect (G_OBJECT (window), "delete_event",
redland/raptor/examples/grapper.c view on Meta::CPAN
gtk_widget_show (go_button);
gtk_widget_show (box);
/* add hbox to vbox */
gtk_box_pack_start (GTK_BOX (v_box), box, FALSE, FALSE, 0);
/* horizontal box for syntax prefs in vertical box (v_box) */
prefs_frame = gtk_frame_new ("RDF Syntax");
prefs_box = gtk_hbutton_box_new();
gtk_button_box_set_layout(GTK_BUTTON_BOX(prefs_box),GTK_BUTTONBOX_START);
#ifdef GRAPPER_QNAMES
/* qnames button in horizontal box */
qnames_button = gtk_check_button_new_with_label("QNames");
qnames_tooltips = gtk_tooltips_new ();
gtk_tooltips_set_tip (qnames_tooltips, qnames_button, "Display URIs as XML QNames", NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(qnames_button), (state->qnames));
/* connect button clicked event to callback */
g_signal_connect (G_OBJECT (qnames_button), "clicked",
G_CALLBACK (qnames_button_callback), state);
/* pack into the invisible box */
gtk_box_pack_start (GTK_BOX(prefs_box), qnames_button, TRUE, TRUE, 0);
gtk_widget_show (qnames_button);
#endif
/* guess button in horizontal box */
guess_button = gtk_check_button_new_with_label("Guess Syntax");
guess_tooltips = gtk_tooltips_new ();
gtk_tooltips_set_tip (guess_tooltips, guess_button, "Try to guess the syntax from the URI", NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(guess_button), (state->guess));
/* connect button clicked event to callback */
g_signal_connect (G_OBJECT (guess_button), "clicked",
G_CALLBACK (guess_button_callback), state);
/* pack into the invisible box */
gtk_box_pack_start (GTK_BOX(prefs_box), guess_button, TRUE, TRUE, 0);
gtk_widget_show (guess_button);
/* add prefs frame to vbox */
gtk_container_add(GTK_CONTAINER(prefs_frame), prefs_box);
gtk_widget_show (prefs_box);
/* add prefs frame to start of vbox */
gtk_box_pack_start (GTK_BOX (v_box), prefs_frame, FALSE, TRUE, 0);
gtk_widget_show (prefs_frame);
/* paned in vertical box */
v_paned = gtk_vpaned_new ();
/* triples frame in vertical paned */
triples_frame=gtk_frame_new("Triples");
state->triples_frame=triples_frame;
redland/raptor/examples/grapper.c view on Meta::CPAN
"Errors and warnings from parsing the content.", NULL);
/* pack the errors store into the errors scrolled window */
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(errors_scrolled_window), errors_treeview);
gtk_widget_show(errors_treeview);
prefs_menu=GTK_MENU(gtk_item_factory_get_widget(menu_item_factory, "/Preferences"));
/* features in the preferences menu */
for(i=0; i <= RAPTOR_FEATURE_LAST; i++) {
const char *feature_name;
const char *feature_label;
grapper_widget_data* sbdata;
if(raptor_features_enumerate((raptor_feature)i,
&feature_name, NULL, &feature_label))
break;
sbdata=(grapper_widget_data*)malloc(sizeof(grapper_widget_data));
sbdata->state=state;
sbdata->feature=i;
/* add to the preferences menu */
feature_items[i] = gtk_check_menu_item_new_with_label(feature_label);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(feature_items[i]),
state->features[i]);
gtk_menu_shell_append(GTK_MENU_SHELL(prefs_menu), feature_items[i]);
g_signal_connect(G_OBJECT(feature_items[i]), "toggled",
G_CALLBACK(feature_menu_toggled), (gpointer)sbdata);
gtk_widget_show (feature_items[i]);
}
/* syntax button in horizontal box */
syntax_optionmenu = gtk_option_menu_new();
redland/raptor/examples/grapper.c view on Meta::CPAN
gtk_option_menu_set_menu(GTK_OPTION_MENU(syntax_optionmenu), syntax_menu);
/* Default is item 0 (should be RDF/XML) */
gtk_option_menu_set_history(GTK_OPTION_MENU(syntax_optionmenu), 0);
syntax_tooltips = gtk_tooltips_new ();
gtk_tooltips_set_tip (syntax_tooltips, syntax_optionmenu, "Chose the Syntax to parse", NULL);
/* pack into the invisible box */
gtk_box_pack_start (GTK_BOX(prefs_box), syntax_optionmenu, TRUE, TRUE, 0);
gtk_widget_show (syntax_optionmenu);
/* add vbox to window */
gtk_container_add (GTK_CONTAINER (window), v_box);
gtk_widget_show (v_box);
}
( run in 2.286 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )