Reply
Thread Tools Search this Thread
Posts: 70 | Thanked: 50 times | Joined on Jan 2012 @ Berlin, Germany
#1
I'm facing a problema I can't get around.

I'm writting a small hildon status menu applet plugin, based on the orientation lock plugin (http://gitorious.org/community-ssu/s...commits/stable), but the icon on the button is showing a broken image (like the image is not found). For starting with my project, I just copied the image from the orientation lock plugin, so the image is fine, and is located where it should be.

Even more, doing a small hello world example works just fine. The problem appears only inside the hildon plugin. If I load the orientation lock image (with the same name that plugin uses), it works.

Here is the hello world that is working:

Code:
// compiled with: gcc -O -Wall -g `pkg-config --libs --cflags hildon-1 libhildondesktop-1` -o ../hello ../hello.c
#include <gtk/gtk.h>
#include <hildon/hildon.h>

void
destroy (void)
{
        gtk_main_quit ();
}

int
main (int argc, char *argv[])
{
        GtkWidget *window;
        GtkWidget *button;
        GtkWidget *image;

        gtk_init (&argc, &argv);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_signal_connect (GTK_OBJECT (window), "destroy",
                        GTK_SIGNAL_FUNC (destroy), NULL);
        gtk_container_border_width (GTK_CONTAINER (window), 10);
        image = gtk_image_new_from_icon_name (
            "display-blanking-icon.0", GTK_ICON_SIZE_DIALOG);

        button = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
        gtk_button_set_alignment (GTK_BUTTON (button), 0, 0);
        hildon_button_set_style (HILDON_BUTTON (button), HILDON_BUTTON_STYLE_PICKER);
        hildon_button_set_title (HILDON_BUTTON (button), "Display blanking mode");
        hildon_button_set_value (HILDON_BUTTON (button), "Test");
        hildon_button_set_image (HILDON_BUTTON (button), image);

        gtk_container_add (GTK_CONTAINER (window), button);

        gtk_widget_show_all (window);

        gtk_main ();

        return 0;
}
This shows my image perfectly (the image is installed in /usr/share/icons/hicolor/48x48/hildon/ as the orientation lock applet does).

Using the same widget creation code in the orientation lock plugin, shows the broken image, replacing orientation_lock_status_plugin_init() with something like:

Code:
static void
orientation_lock_status_plugin_init (OrientationLockStatusPlugin *plugin)
{
    plugin->priv = ORIENTATION_LOCK_STATUS_PLUGIN_GET_PRIVATE (plugin);

    GtkWidget *icon = gtk_image_new_from_icon_name ("display-blanking-icon.0", GTK_ICON_SIZE_DIALOG);
    plugin->priv->button = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
    gtk_button_set_alignment (GTK_BUTTON (plugin->priv->button), 0, 0);
    hildon_button_set_style (HILDON_BUTTON (plugin->priv->button), HILDON_BUTTON_STYLE_PICKER);
    hildon_button_set_title (HILDON_BUTTON (plugin->priv->button), dgettext (GETTEXT_DOM, "Display blanking mode"));
    hildon_button_set_value (HILDON_BUTTON (plugin->priv->button), "test");
    hildon_button_set_image (HILDON_BUTTON (plugin->priv->button), icon);

    gtk_container_add (GTK_CONTAINER (plugin), plugin->priv->button);

    gtk_widget_show_all (plugin->priv->button);

    gtk_widget_show (GTK_WIDGET (plugin));
}
Is this a bug? Is there anything wrong with that code? How come the orientation lock plugin (and all other!) image work?

Any help and/or pointer will be highly appreciated, I've almost a complete day trying to debug this problem... :S
 
nicolai's Avatar
Posts: 1,621 | Thanked: 4,296 times | Joined on Apr 2009 @ Germany
#2
Originally Posted by llucax View Post
Code:
static void
orientation_lock_status_plugin_init (OrientationLockStatusPlugin *plugin)
{
    plugin->priv = ORIENTATION_LOCK_STATUS_PLUGIN_GET_PRIVATE (plugin);

    GtkWidget *icon = gtk_image_new_from_icon_name ("display-blanking-icon.0", GTK_ICON_SIZE_DIALOG);
    plugin->priv->button = hildon_button_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
    gtk_button_set_alignment (GTK_BUTTON (plugin->priv->button), 0, 0);
    hildon_button_set_style (HILDON_BUTTON (plugin->priv->button), HILDON_BUTTON_STYLE_PICKER);
    hildon_button_set_title (HILDON_BUTTON (plugin->priv->button), dgettext (GETTEXT_DOM, "Display blanking mode"));
    hildon_button_set_value (HILDON_BUTTON (plugin->priv->button), "test");
    hildon_button_set_image (HILDON_BUTTON (plugin->priv->button), icon);

    gtk_container_add (GTK_CONTAINER (plugin), plugin->priv->button);

    gtk_widget_show_all (plugin->priv->button);

    gtk_widget_show (GTK_WIDGET (plugin));
}
Is this a bug? Is there anything wrong with that code? How come the orientation lock plugin (and all other!) image work?
Your code works for me. I put a
"display-blanking-icon.0.png" image in my
/usr/share/icons/hicolor/48x48/hildon/ folder and it
shows up in the status-menu.
Verify that your image file is indeed
in the /usr/share/icons/hicolor/48x48/hildon/ folder

nicolai
 

The Following User Says Thank You to nicolai For This Useful Post:
Posts: 70 | Thanked: 50 times | Joined on Jan 2012 @ Berlin, Germany
#3
Originally Posted by nicolai View Post
Your code works for me. I put a
"display-blanking-icon.0.png" image in my
/usr/share/icons/hicolor/48x48/hildon/ folder and it
shows up in the status-menu.
Verify that your image file is indeed
in the /usr/share/icons/hicolor/48x48/hildon/ folder

nicolai
Thanks for trying it out. This is really strange, I'm possitive the file is there, the standalone application can read it!

Maybe you can try my plug-in and tell me if it works for you (the images makes no sense, they are copied from the orientation lock plugin, but I get the broken image icon instead). Here are the files, .deb and sources:
http://www.llucax.com.ar/tmp/

Thanks again!
 
Posts: 70 | Thanked: 50 times | Joined on Jan 2012 @ Berlin, Germany
#4
Originally Posted by llucax View Post
Thanks for trying it out. This is really strange, I'm possitive the file is there, the standalone application can read it!

Maybe you can try my plug-in and tell me if it works for you (the images makes no sense, they are copied from the orientation lock plugin, but I get the broken image icon instead). Here are the files, .deb and sources:
http://www.llucax.com.ar/tmp/

Thanks again!
OK, I don't know what happened, now it's working, the same code, I restarted the phone at some point, maybe it was some cache issue or something like that... Who knows...
 
Posts: 70 | Thanked: 50 times | Joined on Jan 2012 @ Berlin, Germany
#5
 
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

 
Forum Jump


All times are GMT -4. The time now is 04:21 PM.