[maemo-developers] Problem to setup an icon to an application

From: Torello Querci tquerci at gmail.com
Date: Thu Jul 3 16:32:19 EEST 2008
Hi to all,

I try to set an icon file to a my application. The program seem to run
fine without error on console but the icon still the same, the generic
application icon setup by default.

This is a sample file taken from maemo tutorial where I add the

  gtk_window_set_icon_from_file(window,"icona.ico",NULL);

line.

Thank's in advance.



Torello Querci

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

#include <stdlib.h> /* EXIT_* */
/* Introduce types and prototypes of GTK+ for the compiler. */
#include <gtk/gtk.h>

int main(int argc, char** argv) {

  /* We'll have two references to two GTK+ widgets. */
  GtkWindow* window;
  GtkLabel* label;

  /* Initialize the GTK+ library. */
  gtk_init(&argc, &argv);

  /* Create a window with window border width of 12 pixels and a
     title text. */
  window = g_object_new(GTK_TYPE_WINDOW,
    "border-width", 12,
    "title", "Hello GTK+",
    NULL);

  /* Create the label widget. */
  label = g_object_new(GTK_TYPE_LABEL,
    "label", "Hello World!",
    NULL);

  /* Pack the label into the window layout. */
  gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(label));

  gtk_window_set_icon_from_file(window,"icona.ico",NULL);

  /* Show all widgets that are contained by the window. */
  gtk_widget_show_all(GTK_WIDGET(window));

  /* Start the main event loop. */
  g_print("main: calling gtk_main\n");
  gtk_main();

  /* Display a message to the standard output and exit. */
  g_print("main: returned from gtk_main and exiting with success\n");

  /* The C standard defines this condition as EXIT_SUCCESS, and this
     symbolic macro is defined in stdlib.h (which GTK+ will pull in
     in-directly). There is also a counter-part for failures:
     EXIT_FAILURE. */
  return EXIT_SUCCESS;
}

More information about the maemo-developers mailing list