RE: Image handling



This should do it...

    GdkPixbuf *pb = NULL;
    GError *error = NULL;
    gchar *filename = "myfile.xpm";

    if(filename == NULL || strlen(filename) < 1)
    {
        g_warning("filename was NULL");
        return;
    }
    else
        g_message("opening file:'%s'", filename);

    pb = gdk_pixbuf_new_from_file(filename, &error);

    if(pb == NULL)
    {
        g_warning("error loading file:'%s'", filename);
        
        /* look at error */
        if(error != NULL)
          {
            g_warning("error domain:'%s', code:%d, message:'%s'", 
                      g_quark_to_string(error->domain), error->code,
error->message);

            g_error_free(error);
          }
        
        return NULL;
    }

    /* insert into textview */
    gtk_text_buffer_insert_pixbuf(buffer, &iter, pb);
    g_object_unref(G_OBJECT(pb));

Regards,
Martyn

-----Original Message-----
From: Viveka Nathan K [mailto:vivek lantana tenet res in]
Sent: 31 March 2003 14:45
To: gtk-app-devel-list gnome org
Subject: Image handling


Hi
 
 In a TextView, how a image can be handled ?
 If I need to insert an image in between texts, how can i 
handle this ?



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-=-=-=-=-=-=-= 
Viveka Nathan K, DON Lab, IITM, Chennai-36, India. 
Ph:044-22578904/8353 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-=-=-=-=-=-=-=
All condemnation of others really condemns ourselves - Swami 
Vivekananda

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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