Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

Problem to setup an icon to an application

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


tquerci at gmail

Jul 3, 2008, 6:32 AM

Post #1 of 3 (566 views)
Permalink
Problem to setup an icon to an application

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;
}
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


marius at pov

Jul 3, 2008, 6:45 AM

Post #2 of 3 (541 views)
Permalink
Re: Problem to setup an icon to an application [In reply to]

On Thu, Jul 03, 2008 at 03:32:19PM +0200, Torello Querci wrote:
> 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);

Is the .ico format even supported by Gtk+? Usually people use .png.

I strongly suspect the relative pathname is not going to work. You
should pass an absolute filename, such as "/usr/share/myapp/icon.png".

Also, I believe the window manager in Maemo (matchbox) wants to
determine the icon from the .desktop file corresponding to your app,
rather than from the _NET_WM_ICON property that
gtk_window_set_icon_from_file.

Now you have three things to check, any of which could be the cause why
your icon is missing.

Marius Gedminas
--
C is for Cookies. Perl is even better for Cookies.
Attachments: signature.asc (0.18 KB)


tquerci at gmail

Jul 3, 2008, 9:10 AM

Post #3 of 3 (537 views)
Permalink
Re: Problem to setup an icon to an application [In reply to]

2008/7/3 Marius Gedminas <marius [at] pov>:
> On Thu, Jul 03, 2008 at 03:32:19PM +0200, Torello Querci wrote:
>> 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);
>
> Is the .ico format even supported by Gtk+? Usually people use .png.
Ok, I try using both and not work

>
> I strongly suspect the relative pathname is not going to work. You
> should pass an absolute filename, such as "/usr/share/myapp/icon.png".
I try this solution, but if the GTK not find the image I got an error
message on console. Again not work.

>
> Also, I believe the window manager in Maemo (matchbox) wants to
> determine the icon from the .desktop file corresponding to your app,
> rather than from the _NET_WM_ICON property that
> gtk_window_set_icon_from_file.
On the Bora enviroment I was able to setup the application icon on the runtime.
Now I use the same method and not work, but the problem can be on the
environmante that I use.
So I try to "write" (write ..... simply add a line of code :) ) to
test to set the Icon using C code.
I try to setup the Icon, X-Window-Icon and X-Window-Icon-Dimmed
proerty in .desktop file and the icon is right in the Maemo menu but
is the generic one in the taskbar.

>
> Now you have three things to check, any of which could be the cause why
> your icon is missing.
I try but something is wrong .. :(


Bye, Torello.
_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.