|
|
07-10-2012
, 02:09 PM
|
|
|
Posts: 1,621 |
Thanked: 4,296 times |
Joined on Apr 2009
@ Germany
|
#2
|
Is this a bug? Is there anything wrong with that code? How come the orientation lock plugin (and all other!) image work?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)); }
| The Following User Says Thank You to nicolai For This Useful Post: | ||
|
|
07-10-2012
, 03:01 PM
|
|
Posts: 70 |
Thanked: 50 times |
Joined on Jan 2012
@ Berlin, Germany
|
#3
|
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
|
|
07-15-2012
, 02:57 PM
|
|
Posts: 70 |
Thanked: 50 times |
Joined on Jan 2012
@ Berlin, Germany
|
#4
|
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!
|
|
07-30-2012
, 09:23 AM
|
|
Posts: 70 |
Thanked: 50 times |
Joined on Jan 2012
@ Berlin, Germany
|
#5
|
![]() |
| Thread Tools | Search this Thread |
|
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:
// 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; }Using the same widget creation code in the orientation lock plugin, shows the broken image, replacing orientation_lock_status_plugin_init() with something like:
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)); }Any help and/or pointer will be highly appreciated, I've almost a complete day trying to debug this problem... :S