when i try to compile this small app i get these errors ======= valac helloworld.vala --pkg gtk+-3.0 --pkg glib-2.0 helloworld.vala:20.30-20.33: warning: Argument 1: Cannot pass null to non-null parameter type var icons=theme.list_icons(null); ^^^^ /home/dr3mro/Desktop/hellovala/helloworld.vala.c: In function ‘gen_list’: /home/dr3mro/Desktop/hellovala/helloworld.vala.c:196:9: warning: passing argument 3 of ‘_vala_string_array_contains’ discards ‘const’ qualifier from pointer target type [enabled by default] /home/dr3mro/Desktop/hellovala/helloworld.vala.c:56:17: note: expected ‘gchar *’ but argument is of type ‘const gchar *’ /home/dr3mro/Desktop/hellovala/helloworld.vala.c:208:9: warning: passing argument 3 of ‘_vala_string_array_contains’ discards ‘const’ qualifier from pointer target type [enabled by default] /home/dr3mro/Desktop/hellovala/helloworld.vala.c:56:17: note: expected ‘gchar *’ but argument is of type ‘const gchar *’ Compilation succeeded - 1 warning(s) ======== what is the solution for this ?
helloworld.ui
Description: application/designer
/*hello.vala compile : valac --pkg gtk+-3.0 --pkg glib-2.0 helloworld.vala */
using Gtk;
using GLib;
public ListStore liststore;
public Builder builder;
public IconView icon_view;
public Gdk.Pixbuf pixbuf;
public Label label1;
public bool gen_list(){
var theme = new Gtk.IconTheme();
theme.set_custom_theme("ubuntu-mono-dark");
var icons=theme.list_icons(null);
string[] choices={"face","stock","emblem","gnome","application"};
string[] badicons={"gnome-spinner","gnome-panel-separator"};
string[] data ={};
foreach (string icon in icons ){
foreach (string choice in choices){
if (choice in icon && !( icon in badicons) && !(icon in data)) {
print(icon);
data += icon;
TreeIter iter;
try {
pixbuf = theme.load_icon(icon, 48, 0);
} catch (Error e)
{print(e.message);};
liststore.append (out iter);
liststore.set(iter,0,pixbuf);
};
};
};
label1.hide();
return false;
}
public static int main (string[] args)
{
Timeout.add_seconds(2, gen_list);
Gtk.init (ref args);
Gtk.Builder builder = new Gtk.Builder ();
try{
builder.add_from_file ("helloworld.ui");
} catch
(Error e ) {
print(e.message);
};
var window = builder.get_object ("window") as Gtk.Window;
icon_view = builder.get_object ("iconview1") as Gtk.IconView;
liststore = builder.get_object ("liststore") as Gtk.ListStore;
label1 = builder.get_object("label1") as Gtk.Label;
icon_view.set_pixbuf_column (0);
builder.connect_signals (null);
window.show_all ();
Gtk.main ();
return 0;
}
_______________________________________________ vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
