Changeset 8d9ed780301cc5a9bd5e13ac8a1486dd0b14ebb6

Show
Ignore:
Timestamp:
04/13/09 14:38:14 (1 year ago)
Author:
Federico Mena Quintero <federico@novell.com>
git-committer:
Federico Mena Quintero <federico@novell.com> 1239647894 -0500
git-parent:

[1e3608ffeefd10d0b71db3e82e4ad582a41c5caf]

git-author:
Federico Mena Quintero <federico@novell.com> 1239647894 -0500
Message:

Use widget fields instead of widget names in TransactionEditor?'s utility functions

Signed-off-by: Federico Mena Quintero <federico@novell.com>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Sterling/TransactionEditor.cs

    r1e3608f r8d9ed78  
    117117        } 
    118118 
    119         private void SetEntryBgColor (string widget_name, byte r, byte g, byte b) 
     119        private void SetEntryBgColor (Gtk.Entry entry, byte r, byte g, byte b) 
    120120        { 
    121121            foreach (Gtk.StateType state in Enum.GetValues (typeof (Gtk.StateType))) 
     
    124124                    continue; 
    125125 
    126                 (ui.GetWidget (widget_name) as Gtk.Widget).ModifyBase (state, new Gdk.Color (r, g, b)); 
    127             } 
    128         } 
    129  
    130         private void ResetEntryBgColor (string widget_name
     126                entry.ModifyBase (state, new Gdk.Color (r, g, b)); 
     127            } 
     128        } 
     129 
     130        private void ResetEntryBgColor (Gtk.Entry entry
    131131        { 
    132132            foreach (Gtk.StateType state in Enum.GetValues (typeof (Gtk.StateType))) 
     
    135135                    continue; 
    136136 
    137                 (ui.GetWidget (widget_name) as Gtk.Widget).ModifyBase (state); 
    138             } 
    139         } 
    140  
    141         private void SetEntryInputGood (string widget_name, bool is_good) 
     137                entry.ModifyBase (state); 
     138            } 
     139        } 
     140 
     141        private void SetEntryInputGood (Gtk.Entry entry, bool is_good) 
    142142        { 
    143143            if (is_good) 
    144                 ResetEntryBgColor (widget_name); 
     144                ResetEntryBgColor (entry); 
    145145            else 
    146                 SetEntryBgColor (widget_name, 0xff, 0xe0, 0xe0); 
    147         } 
    148          
    149         private bool SetEntryInputGoodIfNonEmpty (string widget_name
    150         { 
    151             string s       = (ui.GetWidget (widget_name) as Gtk.Entry).Text; 
     146                SetEntryBgColor (entry, 0xff, 0xe0, 0xe0); 
     147        } 
     148         
     149        private bool SetEntryInputGoodIfNonEmpty (Gtk.Entry entry
     150        { 
     151            string s       = entry.Text; 
    152152            bool   is_good = s.Length > 0 ? true : false; 
    153153             
    154             SetEntryInputGood (widget_name, is_good); 
     154            SetEntryInputGood (entry, is_good); 
    155155            return is_good; 
    156156        } 
    157157 
    158         private bool SetEntryInputGoodIfNonZero (string widget_name
    159         { 
    160             string s = (ui.GetWidget (widget_name) as Gtk.Entry).Text; 
     158        private bool SetEntryInputGoodIfNonZero (Gtk.Entry entry
     159        { 
     160            string s = entry.Text; 
    161161            double t = 0.0; 
    162162             
     
    169169            bool is_good = (t != 0.0 ? true : false); 
    170170             
    171             SetEntryInputGood (widget_name, is_good); 
     171            SetEntryInputGood (entry, is_good); 
    172172            return is_good; 
    173173        } 
     
    180180            bool bad_input_has_focus = false; 
    181181 
    182             is_description_good  = SetEntryInputGoodIfNonEmpty ("transaction_editor_description"); 
    183             is_tags_good         = SetEntryInputGoodIfNonEmpty ("transaction_editor_tags"); 
    184             is_amount_good       = SetEntryInputGoodIfNonZero  ("transaction_editor_amount"); 
     182            is_description_good  = SetEntryInputGoodIfNonEmpty (transaction_editor_description); 
     183            is_tags_good         = SetEntryInputGoodIfNonEmpty (transaction_editor_tags); 
     184            is_amount_good       = SetEntryInputGoodIfNonZero  (transaction_editor_amount); 
    185185 
    186186            if ((this.Focus == transaction_editor_description && !is_description_good) ||