# -*- coding: utf-8 -*-
#
# xml0_importer.rb  (e-PRTR XML-0 Import)
# (c) ENDA, 2010
#
# by mlt
#
# Rel-1-0-1

module Gui_callbacks

  def hbox1_destroy_cb(widget)
    print widget.to_s, " Name: <", widget.name, ">\n"
    Gtk.main_quit
  end
  def b_exit_clicked_cb(widget)
    print widget.to_s, " Name: <", widget.name, ">\n"
    Gtk.main_quit
  end

  # HIER ist es spannend:
  def b_do_import_clicked_cb(widget)
    print widget.to_s, " Name: <", widget.name, ">\n"
    @glade['main_window'].window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))
    xml0_importer = XML0_Importer.new(@glade)
    xml0_importer.import
    @glade['main_window'].window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::LEFT_PTR))
  end

  def button1_clicked_cb(widget)
    # Alisa-Knopf
    print widget.to_s, " Name: <", widget.name, ">\n"
    puts "@glade.widget_names"
    puts @glade.widget_names
    puts
    puts @glade["entry1"].name
    # Text in einem Entry setzen:
    @glade["entry1"].set_text "Alisa"

    # Knopf anders beschriften:
    @glade["b_exit"].set_label "Au revoir"
  end
  def menuaction_test1_activate_cb(widget)
    print widget.to_s, " Name: <", widget.name, ">\n"
    Test1.now
  end
  def menuaction_test2_activate_cb(widget)
    print widget.to_s, " Name: <", widget.name, ">\n"
    Test1.t2
  end
  def imagemenuitem10_activate_cb(widget)
    print widget.to_s, " Name: <", widget.name, ">\n"
    Gnome::About.new(APPNAME, APPVERSION ,
      "Copyright (C) 2010 ENDA GmbH & Co. KG",
      ABOUT,
      ["M. Lüttgert (mlt)"], ["Es gibt keine Dokumentation"], nil).show
  end
  def gtk_main_quit(widget)
    print widget.to_s, " Name: <", widget.name, ">\n"
    Gtk.main_quit
  end
end
