Problems enumerating printers



Hi,

I have a bit of a newbie problem. Im trying to enumerate printers on a
system. Doing so i get a lot off errors. Cut down version of code:

----------8<----------------------------------------------------------
#include <iostream>
#include <gtkmm.h>
#include <gtkmm/main.h>

using namespace std;

static bool enumerate(const Glib::RefPtr<Gtk::Printer>& printer){
	
	cout << "Printer:"<<printer->property_name()<<endl;
	
	return false;
}


int main(int argc, char *argv[]) {
	Gtk::Main kit(argc, argv);

	Gtk::enumerate_printers(sigc::ptr_fun(enumerate),true);

	return 0;
}
----------8<----------------------------------------------------------

Output when executing:

----------8<----------------------------------------------------------
tor sid:~/tests/cpp_enumerate$ ./enumtest 
Printer:Print to File

(enumtest:30909): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed
Printer:QL-500
Printer:tors

(enumtest:30909): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed

(enumtest:30909): GLib-GObject-CRITICAL **: g_object_unref: assertion
`G_IS_OBJECT (object)' failed
----------8<----------------------------------------------------------

And if i try to do further operations on a "printer" it results in a
segmentation fault.

Am i missing something here. Google and documentation is very sparse on
this subject..

This is running on Linux, Ubuntu 8.10.

Regards,

/Tor



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]