title: Load Gif into Gtk 3 Window C\C++
body: <p>I'm trying to create a c application with code::block that use Gtk 3 as a graphics library
  This version of gtk is a bit different from gtk 2 and not so much tutorials or exampes are avaiable online. I want to use a type named GdkPixmap that permit to load gifs into your windows, after googled it i have found that the type is deprecated and have been eliminated from gtk new version (3). From official documentation (migrate from gtk2 to gtk3) i have found that is possible to use cairo functions to make the works made by GdkPixmap but i havent found how change and migrate.</p>
  
  <p>This code founded on stackoverflow is an example of loading gif into window using gtk2 that doesnt work on gtk3 compiler said : error unknown type name 'GdkPixmap'</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  GdkPixbuf *load_pixbuf_from_file (const char *filename)
  {
      GError *error = NULL;
      GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, &amp;error);
  
      if (pixbuf == NULL)
      {
          g_print ("Error loading file: %d : %s\n", error-&gt;code, error-&gt;message);
          g_error_free (error);
          exit (1);
      }
      return pixbuf;
  }
  
  GdkPixbufAnimation *load_pixbuf_animation_from_file (const char *filename)
  {
      GError *error = NULL;
      GdkPixbufAnimation *pixbuf = gdk_pixbuf_animation_new_from_file (filename, &amp;error);
  
      if (pixbuf == NULL)
      {
          g_print ("Error loading file: %d : %s\n", error-&gt;code, error-&gt;message);
          g_error_free (error);
          exit (1);
      }
      return pixbuf;
  }
  
  int main (int argc, char **argv)
  {
      GtkWidget *window = NULL;
      GdkPixbuf *image = NULL;
      GdkPixbufAnimation * anim = NULL;
      GtkWidget *widget = NULL;
      GdkPixmap *background = NULL;
      GtkStyle *style = NULL;
  
      gtk_init (&amp;argc, &amp;argv);
      /* Load a non animated gif */
      image = load_pixbuf_from_file ("C://Users//Pcc//Downloads//66.gif");
      //  widget = gtk_image_new_from_pixbuf (image);
      gdk_pixbuf_render_pixmap_and_mask (image, &amp;background, NULL, 0);
      style = gtk_style_new ();
      style-&gt;bg_pixmap [0] = background;
      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_title (GTK_WINDOW(window), "Load Image");
      gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
      gtk_widget_set_style (GTK_WIDGET(window), GTK_STYLE (style));
      gtk_window_set_transient_for (GTK_WINDOW (window), NULL);
  
      GtkWidget *hbox = NULL;
      hbox = gtk_hbox_new (0, FALSE);
      gtk_container_add (GTK_CONTAINER(window), hbox);
  
      GtkWidget *button = NULL;
      button = gtk_button_new_with_label ("Sonic");
      gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
  
      gtk_widget_show_all (window);
      gtk_main ();
      return 0;
  }
  </code></pre>
  
  <p>Use and install a obsolete gtk i dont think is good
  Please to post examples of code that works on gtk3 that load gifs</p>