Re: [Gtk-osx-users] ige-mac-bundler and gtk_image_new_from_file

The output is the runtime value of the variables from a debug function (the first is jhbuild the second is running the bundle from the command line), the question is, I don't know why all the cairo_* functions seem to find the correct location, and have no permission issues in opening the file, while the gtk_image_new_from_file does not work, and I don't know why it does not work?

Here is how I got around it, instead of loading a GtkImage, I ceated a GtkDrawingArea like so, and now the logo shows with no problems:

     GtkWidget *drawing_area = gtk_drawing_area_new ();
     gtk_widget_set_size_request (drawing_area, 128, 128);
     g_signal_connect (G_OBJECT (drawing_area), "expose-event",
                       G_CALLBACK (isi_app_draw_logo_callback), (gpointer)self);
    // logo = gtk_image_new_from_file (file_name);
     gtk_widget_show (drawing_area);

isi_app_draw_logo_callback (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
    IsiApp *self;
    cairo_t *cr                    = NULL;        /* Rendering context derived from widget */
    cairo_surface_t *logo_image = NULL;         /* background image of current frame*/
    gchar *file_name            = NULL;
    self = (IsiApp*)user_data;
    /* Sanity Check */
    g_return_val_if_fail(self != NULL, FALSE);

    /* Get the context to which we need to draw */
    cr = gdk_cairo_create(widget->window);

    logo_image  = cairo_image_surface_create_from_png(file_name);
    /* Set pattern as new source */
    if(cr != NULL && logo_image != NULL)
        cairo_set_source_surface(cr, logo_image, 0, 20);
    cairo_paint (cr);
    /* clean up */
    /* Distroy the context we created */
    cairo_surface_destroy (logo_image);
    return FALSE;

The file_name is the file_name, and the application can access it since all the other png files work, and now that I have re-implemented using the above code, it too, works. It seems that the cairo_image_surface_create_from_* set of functions work fine, while the gtk_image_new_from_file does not.

> From: richard n procter gmail com
> Date: Fri, 25 Mar 2011 07:46:47 +1100
> To: gtk-osx-users lists sourceforge net
> Subject: Re: [Gtk-osx-users] ige-mac-bundler and gtk_image_new_from_file
> On 25/03/2011, at 7:10 AM, Shawn Bakhtiar wrote:
> >
> > The code in question:
> >
> > /* The Logo */
> > g_object_get((GObject*)self->display,"main_logo",&file_name,NULL);
> > logo = gtk_image_new_from_file (file_name);
> > gtk_box_pack_start(main_hbox,logo,FALSE,FALSE,0);
> > gtk_widget_show (logo);
> >
> >
> > The code compiles and runs fine when I am in the jhbuild shell, the logo displays with no issues. However, after having created a bundle file using ige-mac-integration, all the files that use the ciaro_* functions work fine (load and display all images correctly, except for this one, and the only real difference is that I use gtk_image_new_from_file to create a widget to pack, instead of drawing it using cairo_* functions.
> >
> > [snip] - unbundled
> > Main Logo: /Users/shawn/gtk/inst/share/isiod/pixmaps/ISILOGO-TRANS.png
> >
> > [snip] - bundled
> > Main Logo: ///Users/shawn/odie_bundle/
> Is this the measured value of file_name when running bundled?
> > Any ideas?
> Check the file permissions? Are there any relevant warnings in the syslog?
> regards,
> Richard.
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today!
> _______________________________________________
> Gtk-osx-users mailing list
> Gtk-osx-users lists sourceforge net

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