Frazer Williams | 1 Jan 2003 01:28

Help request: gnome-canvas and images from data


Hi,

I'm trying to understand how to use gnome-canvas to display images, and
I could use some help/advice.

I've figured out how to display a .png image from a file on the canvas,
but I've bogged down on displaying an image from data (the functionality
provided by gdk-pixbuf_new_from_data(), for example).

Two approaches I've tried that almost seem to work are (I've attached
the code at the end):

1.  Create a pixbuf with gdk_pixbuf_new_from_data() and a blank drawable
    with gdk_pixmap_new(), fill in the drawable using
    gdk_pixbuf_render_to_drawable(), and then add it to the canvas with
    gnome_canvas_item_new() using the GNOME_TYPE_CANVAS_WIDGET
    type and providing the argument pair "widget" and a pointer to the
    drawable cast as a (GtkWidget *).

2.  Create a blank drawable with gdk_pixbuf_new(), draw the data into
    the drawable with gdk_draw_rgb_image(), and add the drawable to the
    canvas as above using gnome_canvas_item_new() and the
    GNOME_TYPE_WIDGET type.

Both methods produce a blank canvas, and a warning from GnomeUI: 

GnomeUI-WARNING **: gnome_canvas_item_construct(): invalid unclassed object pointer for argument
type `GtkObject'

(Continue reading)

Christian Neumair | 1 Jan 2003 02:18

developers, maintainers: Please add a startup notify line to your desktop.in files!

Hi there!
It would be nice if all of you could add the line
StartupNotify=true
to your desktop.in files. This will enable startup notification.which is
a cool feature which got integrated into GNOME 2.2. It won't hurt anyone
who isn't using the startup notification lib so those persons won't
experience undesired side-effects.

regs,
 Chris
Ayose | 1 Jan 2003 15:24
Picon

Re: Help request: gnome-canvas and images from data


On Tue, Dec 31, 2002 at 06:28:05PM -0600, Frazer Williams wrote:
> I've figured out how to display a .png image from a file on the canvas,
> but I've bogged down on displaying an image from data (the functionality
> provided by gdk-pixbuf_new_from_data(), for example).
> 

I have rewritten your code. Now it works :-)

#include <gnome.h>

#define WIDTH   700
#define HEIGHT  600

static gint delete_event_cb(GtkWidget *window, GdkEventAny *e, gpointer data);

GtkWidget *app;

static void 
free_pixels(guchar* pixels, gpointer data)
{
    g_free(pixels);
}

static void
create_canvas_items(GtkWidget *canvas)
{
    GdkPixbuf        *pixbuf;
    guchar           *pixels;
    GnomeCanvasItem  *citem;
(Continue reading)

Seth Nickell | 2 Jan 2003 03:42
Picon
Favicon

Re: developers, maintainers: Please add a startup notify line to your desktop.in files!


On Tue, 2002-12-31 at 17:18, Christian Neumair wrote:
> Hi there!
> It would be nice if all of you could add the line
> StartupNotify=true
> to your desktop.in files. This will enable startup notification.which is
> a cool feature which got integrated into GNOME 2.2. It won't hurt anyone
> who isn't using the startup notification lib so those persons won't
> experience undesired side-effects.

If there's no harm to it being on, why isn't it on by default? Also,
what is the lib called we need to get startup notification working?

-Seth
Havoc Pennington | 2 Jan 2003 04:44
Picon
Favicon

Re: developers, maintainers: Please add a startup notify line to your desktop.in files!


On Wed, Jan 01, 2003 at 06:42:44PM -0800, Seth Nickell wrote:
> On Tue, 2002-12-31 at 17:18, Christian Neumair wrote:
> > Hi there!
> > It would be nice if all of you could add the line
> > StartupNotify=true
> > to your desktop.in files. This will enable startup notification.which is
> > a cool feature which got integrated into GNOME 2.2. It won't hurt anyone
> > who isn't using the startup notification lib so those persons won't
> > experience undesired side-effects.
> 
> If there's no harm to it being on, why isn't it on by default? Also,
> what is the lib called we need to get startup notification working?
> 

There is harm to it being on, the busy cursor gets stuck if the app
doesn't actually support startup notification. So it has to be enabled
for apps that support it.

You don't need special libs, anything that links to GTK 2.2 and opens
a window will work automatically - see the mail I posted a while back.

Havoc
Seth Nickell | 2 Jan 2003 06:23
Picon
Favicon

Re: developers, maintainers: Please add a startup notify line to your desktop.in files!


On Wed, 2003-01-01 at 19:44, Havoc Pennington wrote:
> On Wed, Jan 01, 2003 at 06:42:44PM -0800, Seth Nickell wrote:
> > On Tue, 2002-12-31 at 17:18, Christian Neumair wrote:
> > > Hi there!
> > > It would be nice if all of you could add the line
> > > StartupNotify=true
> > > to your desktop.in files. This will enable startup notification.which is
> > > a cool feature which got integrated into GNOME 2.2. It won't hurt anyone
> > > who isn't using the startup notification lib so those persons won't
> > > experience undesired side-effects.
> > 
> > If there's no harm to it being on, why isn't it on by default? Also,
> > what is the lib called we need to get startup notification working?
> > 
> 
> There is harm to it being on, the busy cursor gets stuck if the app
> doesn't actually support startup notification. So it has to be enabled
> for apps that support it.

Mkes sense. Still too bad you have to explicitly enable it for every
GNOME app, but ah well.

> You don't need special libs, anything that links to GTK 2.2 and opens
> a window will work automatically - see the mail I posted a while back.

Sorry for not being clear, I meant "What do I have to do to make it do
something in my GNOME, as a user?"

-Seth
(Continue reading)

Havoc Pennington | 2 Jan 2003 06:13
Picon
Favicon

Re: developers, maintainers: Please add a startup notify line to your desktop.in files!

On Wed, Jan 01, 2003 at 09:23:49PM -0800, Seth Nickell wrote: 
> Mkes sense. Still too bad you have to explicitly enable it for every
> GNOME app, but ah well.

Yeah, we would need some kind of operating system support probably to
do it reliably without explicit enable. And it'd be amusing to try to
get *that* into the kernel.

> > You don't need special libs, anything that links to GTK 2.2 and opens
> > a window will work automatically - see the mail I posted a while back.
> 
> Sorry for not being clear, I meant "What do I have to do to make it do
> something in my GNOME, as a user?"

Oh, you just click a launcher or choose a menu item.  You need a
bleeding edge CVS build though. (Well, from a couple weeks ago or so.)

Right now all it does is a little busy cursor from metacity, and a
dummy button appears in the window list. It could do more, but I
thought I'd keep it low key until someone had a bright idea.  It's
kinda hosed right now since clicking the dummy button in window list
doesn't do anything.

With Keith's new Xcursor cursor theme stuff, we should also be able to
get an animated busy cursor without changing the panel at all (cursor
theme specifies animation or no).

Havoc
Seth Nickell | 2 Jan 2003 07:06
Picon
Favicon

Re: developers, maintainers: Please add a startup notify line to your desktop.in files!

> > > You don't need special libs, anything that links to GTK 2.2 and opens
> > > a window will work automatically - see the mail I posted a while back.
> > 
> > Sorry for not being clear, I meant "What do I have to do to make it do
> > something in my GNOME, as a user?"
> 
> Oh, you just click a launcher or choose a menu item.  You need a
> bleeding edge CVS build though. (Well, from a couple weeks ago or so.)

Sorry to be a pain here, I just want to confirm I'm doing the right
thing before I start filing bugs (and what should I file them against?).

I just compiled a fresh GNOME from CVS, including GTK+, Metacity,
gnome-desktop, and gnome-panel. Before everything I compiled
"startup-notification-0.4" which I found at freedesktop.org, and made
sure that Metacity and gnome-desktop were finding it. I'm launching apps
from gnome-utils that I've confirmed have the necessary .desktop voodoo.

So at this point I should be seeing hourglass cursors and dummy entries
in the window list when I launch things, and if I don't I should file a
bug?

-Seth
Jeff Waugh | 2 Jan 2003 06:54
Gravatar

Re: developers, maintainers: Please add a startup notify line to your desktop.in files!


<quote who="Seth Nickell">

> So at this point I should be seeing hourglass cursors and dummy entries in
> the window list when I launch things, and if I don't I should file a bug?

If they have the StartupNotify foo, definitely. Works for me with recent
tarball releases (current GARNOME release/CVS has s-n love, but only for a
few menu items).

- Jeff

--

-- 
  "We live in a place where policy discussion is conducted with money." -   
                                Eben Moglen                                 
Havoc Pennington | 2 Jan 2003 16:46
Picon
Favicon

Re: developers, maintainers: Please add a startup notify line to your desktop.in files!


On Wed, Jan 01, 2003 at 10:06:16PM -0800, Seth Nickell wrote: 
> So at this point I should be seeing hourglass cursors and dummy entries
> in the window list when I launch things, and if I don't I should file a
> bug?

If the things you're launching have StartupNotify=true in the .desktop
file, yes. gnome-terminal has this for example.

Havoc

Gmane