[libcroco-list] sewfox minimal application



Hi all

Here is a minimal gtk application that displays a xml file using a css
stylesheet with sewfox. 

It only depends on libsewfox and I hope it will be useful for debugging
purpose

It could be great if it were included in the test dir of the sewfox
source tree. 

 
Stephane
-- 
    Stéphane Bonhomme - Formations, Conseil et Réalisations
 Ingénierie Documentaire - Technologies Web - Logiciels Libres
   s bonhomme wanadoo fr - http://perso.wanadoo.fr/s.bonhomme
              04 76 17 09 40 / 06 88 57 27 08

#include <stdio.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <sewfox/sx-box-view.h>




static gboolean delete_event( GtkWidget *widget,
                              GdkEvent  *event,
                              gpointer   data )
{

    gtk_main_quit ();
    return FALSE;
}

static void usage () {
  g_print ("usage : minifox <xmlfile> <cssfile>\n");
}

int main(int argc, char **argv) {
  GtkWidget *window;
  GtkWidget *scroll;
  SXBoxView * layout;
  
 
  gtk_init (&argc, &argv);
  if (argc != 3) {
    usage ();
    return 1;
  }
  
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT (window), "delete_event",
		    G_CALLBACK (delete_event), NULL);

  scroll = gtk_scrolled_window_new (NULL, NULL) ;
  gtk_container_add (GTK_CONTAINER (window), scroll) ;
  g_print ("Rendering xml: %s - css: %s \n",argv[1],argv[2]);
  layout = sx_box_view_new_from_xml_css_paths(argv[1], argv[2]);
  gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET (layout)) ;
  
  gtk_widget_show_all (window);
  gtk_main ();

  return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]