All pastes #286409 Raw Edit

Quelque chose

public text v1 · immutable
#286409 ·published 2006-12-20 17:16 UTC
rendered paste body
/* ----------------------------------------------------------------------------
 * gnetadm -- Gtk+ network configuration tool
 * Main Module
 * ----------------------------------------------------------------------------
 * copyright (c) 2006 Jérôme BENHAÏM <benhaimjerome@gmail.com>, Mirsal ENNAIME <mirsal.ennaime@gmail.com>
 * 
 * ----------------------------------------------------------------------------
 * This program is free software ; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation ; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * ----------------------------------------------------------------------------
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif
#include <libxml/parser.h>
#include <libxml/xinclude.h>
#include <libxml/tree.h>
#include <libxml/xmlIO.h>
#include <stdlib.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "gnetadm.h"

/* Get widgets from glade. This is possible because 
 * widgets glade names and widgets pointer names are the same. */
gint 
init_app_interface (gnetadm_app_t* app)
{
 gint err;
 GladeXML* xml;
  GtkWidget *w;
  xml=glade_xml_new("gnetadm.glade",NULL,NULL);
  g_assert(xml != NULL);
  glade_xml_signal_autoconnect(xml);
  w=glade_xml_get_widget(xml,"window");
  /*
  * TODO attacher les signaux
  */
  gtk_object_set_data (GTK_OBJECT (w), "info_window", w);
  g_signal_connect(G_OBJECT(w),"destroy",G_CALLBACK(gtk_main_quit),NULL);
  /*gtk_widget_show(w);*/
  gtk_main();
  return 0;
}

gint
main (gint argc, gchar *argv[])
{
  gint err;
  gnetadm_app_t* app;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);
  app = (gnetadm_app_t*) g_malloc (sizeof (gnetadm_app_t));
  err = init_app_interface (app);
  if(err)
    return err;
  gtk_main ();

  return 0;
}