How do you use granite in a vala project

Asked by Malcolm2608

I was looking through the code for the scratch text editor and I saw things from the granite framework , I want to use some of the widgets like LightWindow .vala but I since im really new to vala I have no idea how to actually use it . I read some where that to compile your program with other packages besides GLib you have to pass --pkg package_name and that worked , but when I enter granite as the package name I get this

error: Package `granite' not found in specified Vala API directories or GObject-Introspection GIR directories
Compilation failed: 1 error(s), 0 warning(s)

I also checked if libgranite0 and libgranite1 was installed and they both are .

How would I get this to work?

Question information

Language:
English Edit question
Status:
Solved
For:
Granite Edit question
Assignee:
No assignee Edit question
Solved by:
Malcolm2608
Solved:
Last query:
Last reply:
Revision history for this message
982c80311320c1b (alexander-wilms) said :
#2

Do you have libgranite1-dev installed? Not sure about the 1

Revision history for this message
Malcolm2608 (malcolmclark2608) said :
#3

I did not have it installed so I tried to and got this

malcom@malcom-A780L3L:~$ sudo apt-get install libgranite1-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libgranite1-dev

Is there a ppa I am missing or did I mess something up :(

Revision history for this message
Malcolm2608 (malcolmclark2608) said :
#4

I also tried to install libgranite-dev and Compile a program with using Granite; at the top and it still says it cannot find that namespace. I am new to vala so if this is an error in the way i compiled it , I am sorry .

Revision history for this message
982c80311320c1b (alexander-wilms) said :
#6

You could ask on #elementary-dev: http://elementaryos.org/developer/chat

Revision history for this message
Malcolm2608 (malcolmclark2608) said :
#7

I asked on there to no avail , I even tried to branch the scratch-text-editor and do a sudo apt-get build-dep scratch and but I still can not build anything that requires Granite.

Revision history for this message
982c80311320c1b (alexander-wilms) said :
#8

It depends on the time of the day whether people are active. Try again from time to time, usually people are really helpful

Revision history for this message
Malcolm2608 (malcolmclark2608) said :
#9

I got on there and a guy named voldy was really helpful , however I had to leave in the middle of our chat . Turns on granite is installed and working correctly if i do valac --pkg granite --gtk+-3.0 valafile.vala but I left before he could finish . I think it has to do something with cmake messing things up .

Revision history for this message
Malcolm2608 (malcolmclark2608) said :
#10

Problem solved , it was my own fault . Sorry to waste your time guys!

Revision history for this message
Ellie (magnonellie) said :
#11

Malcolm, you don't think you could share your solution, since others like me may have the same problem?

Revision history for this message
Jakob Karnatz (jakobkarnatz) said :
#12

Tobi, it's just without the 1. Pretty sure you'll find libgranite-dev in the Software Center, at least on elementaryOS