Re: gtkmm-list Digest, Vol 86, Issue 16



unsuscribe

On Sun, Jun 19, 2011 at 9:19 PM, <gtkmm-list-request gnome org> wrote:
Send gtkmm-list mailing list submissions to
       gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
       http://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
       gtkmm-list-request gnome org

You can reach the person managing the list at
       gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

  1. Re: terminate called after throwing an instance of
     'Glib::FileError' (Bastien Durel)
  2. Re: terminate called after throwing an instance of
     'Glib::FileError' (Phong Cao)
  3. Re: terminate called after throwing an instance of
     'Glib::FileError' (Bastien Durel)
  4. Segmentation fault -
     Gtk::UIManager::add_ui_from_string(Glib::ustring  const&) (Phong Cao)


----------------------------------------------------------------------

Message: 1
Date: Sun, 19 Jun 2011 18:31:30 +0200
From: Bastien Durel <bastien durel org>
Cc: Phong Cao <phngcv gmail com>, gtkmm-list gnome org
Subject: Re: terminate called after throwing an instance of
       'Glib::FileError'
Message-ID: <1308501090 3359 11 camel sandworm geekwu org>
Content-Type: text/plain; charset="UTF-8"

Le dimanche 19 juin 2011 ? 13:31 +0200, Kjell Ahlstedt a ?crit :
[...]
>
> Gdk::Pixbuf::create_from_file("now-playing.png") searches for the file
> in the current directory, which is the directory from where the program
> was started. That's not necessarily the directory where the program's
> executable file is stored.
>
> You need to call a function that tells you where your executable is
> stored (search path, not just filename). Unfortunately I don't know
> which function is appropriate. Perhaps someone else knows?
>
Hello,

You may play with these functions :
http://developer.gnome.org/glibmm/unstable/group__MiscUtils.html

You may see in argv[0] if the program was launched with a path
(./debug/foo), and then use build_path & others to construct your image
path name. Using find_program_in_path will help you if the user lauched
it from nowhere because it's in the path.
Using get_(system|user)_data_dirs may help if the program is installed.

And using Glib::File::query_exists() before calling create_from_file
will prevent throwing an exception (useful to search your file through
directories ;))

A linux-only application may read /proc/PID/exe, but it's not portable,
and you may use gtk for this ;)

--
Bastien




------------------------------

Message: 2
Date: Sun, 19 Jun 2011 12:36:35 -0400
From: Phong Cao <phngcv gmail com>
To: Bastien Durel <bastien durel org>
Cc: gtkmm-list gnome org
Subject: Re: terminate called after throwing an instance of
       'Glib::FileError'
Message-ID: <BANLkTikfpjH02VdGt86CsK+i3cvyHvSX0w mail gmail com>
Content-Type: text/plain; charset="iso-8859-1"

Thank you guys for the responses!

I am not sure why this happened but when I clicked on the executable file
the program ran. However, when I started it using Terminal, the program got
error again. Anyway I think I just started it directly then...

BTW, does anyone know how to create a Gtk::Button that contains Stock image.
In other words, do you know how to create a GtkStockButton without label?

On Sun, Jun 19, 2011 at 12:31 PM, Bastien Durel <bastien durel org> wrote:

> Le dimanche 19 juin 2011 ? 13:31 +0200, Kjell Ahlstedt a ?crit :
> [...]
> >
> > Gdk::Pixbuf::create_from_file("now-playing.png") searches for the file
> > in the current directory, which is the directory from where the program
> > was started. That's not necessarily the directory where the program's
> > executable file is stored.
> >
> > You need to call a function that tells you where your executable is
> > stored (search path, not just filename). Unfortunately I don't know
> > which function is appropriate. Perhaps someone else knows?
> >
> Hello,
>
> You may play with these functions :
> http://developer.gnome.org/glibmm/unstable/group__MiscUtils.html
>
> You may see in argv[0] if the program was launched with a path
> (./debug/foo), and then use build_path & others to construct your image
> path name. Using find_program_in_path will help you if the user lauched
> it from nowhere because it's in the path.
> Using get_(system|user)_data_dirs may help if the program is installed.
>
> And using Glib::File::query_exists() before calling create_from_file
> will prevent throwing an exception (useful to search your file through
> directories ;))
>
> A linux-only application may read /proc/PID/exe, but it's not portable,
> and you may use gtk for this ;)
>
> --
> Bastien
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.gnome.org/archives/gtkmm-list/attachments/20110619/1fe15591/attachment.html>

------------------------------

Message: 3
Date: Sun, 19 Jun 2011 19:27:38 +0200
From: Bastien Durel <bastien durel org>
To: Phong Cao <phngcv gmail com>
Cc: gtkmm-list gnome org
Subject: Re: terminate called after throwing an instance of
       'Glib::FileError'
Message-ID: <1308504458 3359 12 camel sandworm geekwu org>
Content-Type: text/plain; charset="UTF-8"

Le dimanche 19 juin 2011 ? 12:36 -0400, Phong Cao a ?crit :

> BTW, does anyone know how to create a Gtk::Button that contains Stock
> image. In other words, do you know how to create a GtkStockButton
> without label?
>
This should work :


 Gtk::Window w;
 Gtk::Button b;
 b.property_image() =
   new Gtk::Image(Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON);
 w.add(b);
 b.show();
 Gtk::Main::run(w);


--
Bastien Durel <bastien durel org>



------------------------------

Message: 4
Date: Sun, 19 Jun 2011 20:18:55 -0400
From: Phong Cao <phngcv gmail com>
To: gtkmm-list gnome org
Subject: Segmentation fault -
       Gtk::UIManager::add_ui_from_string(Glib::ustring        const&)
Message-ID: <BANLkTimkHpBx=T5V92Ubo-ZP7mOFrZJkZw mail gmail com>
Content-Type: text/plain; charset="iso-8859-1"

Hello everybody,

I am trying to develop a music manager using gtkmm. My program was
successfully compiled. However, after running the executable file I got
"Segmentation fault". I tried to debug it and here is the output in GDB:

   (gdb)
   Program received signal SIGSEGV, Segmentation fault.
    0x00389fdc in Gtk::UIManager::add_ui_from_string(Glib::ustring const&)
()
      from /usr/lib/libgtkmm-2.4.so.1
   (gdb)
   Single stepping until exit from function
_ZN3Gtk9UIManager18add_ui_from_stringERKN4Glib7ustringE,
   which has no line number information.

   Program terminated with signal SIGSEGV, Segmentation fault.
   The program no longer exists.


The error above occurred at line 122 in file topwin.cpp:

122. menubar_ui->add_ui_from_string(ui_info);

I do not know why this happened. I just tried to create a menu in my
application and added the xml string into the Gtk::UIManager.

Attached with this email is the source code and all the necessary files of
the program. I hope that you guys can help me figure this error out!

Thank you for reading my message! Have a good day!


Best regards,


Phong Cao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.gnome.org/archives/gtkmm-list/attachments/20110619/779a9dee/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dingo.zip
Type: application/zip
Size: 10025 bytes
Desc: not available
URL: <http://mail.gnome.org/archives/gtkmm-list/attachments/20110619/779a9dee/attachment.zip>

------------------------------

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


End of gtkmm-list Digest, Vol 86, Issue 16
******************************************



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