[Gtk-sharp-list] error: CS00649, glade-sharp and gtk#

Michael Hutchinson m.j.hutchinson at gmail.com
Sat Feb 13 18:28:56 EST 2010


The Glade widget fields are dynamically bound at runtime, so the warning is
(as far as the compiler knows) correct. The reason it's breaking is that you
have warn-as-error set, so these warnings are being upgraded to errors. Note
that you can use the nowarn compiler argument to disable just that warning
number, or use a #pragma to disable it for just those specific fields.

On Feb 13, 2010 4:58 PM, "Ian Bentley" <ian.bentley at gmail.com> wrote:

Hello,

I'm working on a project involving a gtk# gui frontend that uses
glade-sharp.  I have a strange, inexplicable (to me) error.  I have the
following widgets, each with their representation in the glade file, and for
some of them, (window, RenameCheckbox, PatternCombo, PatternPreviewLabel,
and CloseButton) everything is fine, however, with the remaining two
(CoverImageCheckbox, PlaylistCheckbox) mono (gmcs) fails with the below
error.

CODE:
..snip
    public PreferencesWindow () : base ("PreferencesWindow.glade",
"window")
   {
      PatternCombo.Changed += new EventHandler (OnPatternComboChanged);
      CloseButton.Clicked += new EventHandler (OnCloseButtonClicked);
      RenameCheckbox.Toggled += new EventHandler (OnRenameCheckboxToggled);

      RenameCheckbox.Active = Runtime.Preferences.RenameFiles;
      ((Entry)PatternCombo.Child).Text =
Runtime.Preferences.RenameFilesPattern;
      CoverImageCheckbox.Active = Runtime.Preferences.CacheCoverImage;
      PlaylistCheckbox.Active = Runtime.Preferences.ExportPlaylist;
    }

    [Glade.Widget] Window window;
    [Glade.Widget] ToggleButton RenameCheckbox, CoverImageCheckbox,
PlaylistCheckbox;
    [Glade.Widget] ComboBoxEntry PatternCombo;
    [Glade.Widget] Label PatternPreviewLabel;
    [Glade.Widget] Button CloseButton;
..snip

GLADE:
..snip
                  <child>
                    <widget class="GtkCheckButton" id="PlaylistCheckbox">
                      <property name="visible">True</property>
                      <property name="can_focus">True</property>
                      <property name="label" translatable="yes">Cr_eate
album-order playlist</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>
                    </widget>
                  </child>
..snip

ERROR:
./PreferencesWindow.cs(45,61): error CS0649: Field
`project.Gui.PreferencesWindow.CoverImageCheckbox' is never assigned to, and
will always have its default value `null'
./PreferencesWindow.cs(45,81): error CS0649: Field
`project.Gui.PreferencesWindow.PlaylistCheckbox' is never assigned to, and
will always have its default value `null'

It seems that error CS0649: is actually a level 4 warning, so maybe I could
just turn it off, but it seems like there is something more fundamental that
I am missing here: i.e. why is this warning occuring at all?  And why only
on a couple of the Widgets.

I haven't tried too hard to get a smaller failing example, because the code
here all seems pretty standard, and it is from a larger open source project
which I have only started working at, so stripping a working example out of
it is infeesable.

Thanks for any help.

-- 
Ian Bentley
M.Sc. Student
University of Queens
Kingston, Ontario

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100213/4d54e765/attachment.html 


More information about the Gtk-sharp-list mailing list