Enlightenment CVS committal Author : nerochiaro Project : e17 Module : proto
Dir : e17/proto/ruby-efl/src/enhance/examples Modified Files: dialog.glade test.rb Log Message: ruby-enhance: removed functions to set data ptr for callback handlers. The example now shows the proper ruby way to obtain the same effect. Also added automatic wrapping of var_get return value =================================================================== RCS file: /cvs/e/e17/proto/ruby-efl/src/enhance/examples/dialog.glade,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- dialog.glade 11 Aug 2006 11:47:07 -0000 1.1 +++ dialog.glade 14 Aug 2006 20:33:19 -0000 1.2 @@ -19,6 +19,10 @@ <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <property name="has_separator">True</property> + <signal name="close" handler="on_window1_close" last_modification_time="Sun, 13 Aug 2006 15:45:52 GMT"/> + <signal name="activate_focus" handler="on_window1_activate_focus" last_modification_time="Sun, 13 Aug 2006 15:46:57 GMT"/> + <signal name="activate_default" handler="on_window1_activate_default" last_modification_time="Sun, 13 Aug 2006 15:47:04 GMT"/> + <signal name="delete_event" handler="on_window1_delete_event" last_modification_time="Sun, 13 Aug 2006 16:19:34 GMT"/> <child internal-child="vbox"> <widget class="GtkVBox" id="dialog-vbox1"> @@ -41,7 +45,7 @@ <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-6</property> - <signal name="clicked" handler="cancel_clicked" last_modification_time="Wed, 01 Dec 2004 18:47:13 GMT"/> + <signal name="clicked" handler="cancel_clicked"/> </widget> </child> @@ -55,6 +59,7 @@ <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="response_id">-5</property> + <signal name="clicked" handler="ok_clicked"/> </widget> </child> </widget> @@ -81,153 +86,28 @@ <property name="xscale">1</property> <property name="yscale">1</property> <property name="top_padding">0</property> - <property name="bottom_padding">0</property> + <property name="bottom_padding">1</property> <property name="left_padding">12</property> <property name="right_padding">0</property> <child> <widget class="GtkTable" id="table1"> <property name="visible">True</property> - <property name="n_rows">3</property> + <property name="n_rows">1</property> <property name="n_columns">3</property> <property name="homogeneous">False</property> <property name="row_spacing">0</property> <property name="column_spacing">0</property> <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">label2</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">label3</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes">label4</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button1"> + <widget class="GtkButton" id="save"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">button1</property> + <property name="label" translatable="yes">Save</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> + <signal name="clicked" handler="save_clicked"/> </widget> <packing> <property name="left_attach">1</property> @@ -240,15 +120,14 @@ </child> <child> - <widget class="GtkToggleButton" id="togglebutton1"> + <widget class="GtkButton" id="load"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">togglebutton1</property> + <property name="label" translatable="yes">Load</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> + <signal name="clicked" handler="load_clicked"/> </widget> <packing> <property name="left_attach">2</property> @@ -261,44 +140,22 @@ </child> <child> - <widget class="GtkCheckButton" id="checkbutton1"> + <widget class="GtkEntry" id="textbox"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">checkbutton1</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes">type stuff in here</property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> </widget> <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkToggleButton" id="togglebutton2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">togglebutton2</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> <property name="y_options"></property> </packing> </child> @@ -310,7 +167,7 @@ <child> <widget class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>frame1</b></property> + <property name="label" translatable="yes"></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> =================================================================== RCS file: /cvs/e/e17/proto/ruby-efl/src/enhance/examples/test.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- test.rb 11 Aug 2006 11:47:07 -0000 1.1 +++ test.rb 14 Aug 2006 20:33:19 -0000 1.2 @@ -6,11 +6,13 @@ require 'dl/ffcall-callback' require 'ruby-efl/enhance/ruby-enhance' +#require File.dirname(File.expand_path(__FILE__)) + '/../ruby-enhance.rb' # uncomment this if you want to use local version include Etk include Enhance -# CClass.debug = true # uncomment this for lots of debug info +# CClass.debug = true # uncomment this for lots of debug info +# CClass.debug_level = [:call] # and uncomment this too this for a bit more relevant debug info EnhanceBase.init EtkBase.init(0, nil) @@ -20,20 +22,29 @@ en.file_load("window1", File.dirname(File.expand_path(__FILE__)) + "/dialog.glade") -window1 = en.var_get("window1") - -class Handlers - class << self - def cancel_clicked(target, data) - puts "Oooh, cancel clicked !" - end +class Event_Handlers + attr_accessor :enhance + + def initialize(enhance) + @text = nil + @enhance = enhance + @textbox = enhance.var_get("textbox") + end + def save_clicked(target, data) + @somevar = @textbox.text + end + def load_clicked(target, data) + @textbox.text = @somevar unless @somevar.nil? + end + def on_window1_delete_event(target, data) + EtkBase.main_quit end end +h = Event_Handlers.new(en) -en.autoconnect(Handlers) +en.autoconnect(h) -win = Dialog.wrap(window1) -win << Etk::DeleteEventSignal.new { EtkBase.main_quit } +win = en.var_get("window1") win.show EtkBase.main ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs