More on GNOME_STOCK_PIXMAP (was: Toolbar bug?)



Thanks Dave, a good example, I'll use it as reference. I found
something very similar in gnome-stock.c, tried it and it works
nice now.
But when going beyond, I tried to put the same pixmap (now a GNOME_STOCK_PIXMAP)
in a menuitem of a panel applet, but it don't shows. I have no
compile errors, and if I put the STOCK_PIXMAP in a button of a dialog
that pop ups from the applet it will show, so the problem is only
in the applet menus.
Hope you can give a hint in this too.
Thanks again,
Manuel Clos.
> >>>>> "Federico" == Federico Mena Quintero <federico@redhat.com> writes:
> 
> >> I need to put my own pixmap on a toolbar, I use this: {
> >> GNOME_APP_UI_ITEM, N_("Pause"), N_("Pause downloading the
> >> file(s)"), pause_cb, NULL, NULL, GNOME_APP_PIXMAP_DATA, pause_xpm,
> >> 0, (GdkModifierType)0, NULL }, but when I disable it
> >> (gtk_widget_set_sensitive(widget, FALSE), the pixmap won't disable,
> >> only the word under it (Pause).  Is this a bug or I'm doing
> >> something wrong?
> 
> Federico> If you want all the niceties of gnome-stock, then you must
> Federico> register your pixmap against it first using
> Federico> gnome_stock_pixmap_register().  Then you can use it as a
> Federico> normal stock pixmap in your GnomeUIInfo entries.
> 
> When Federico was out here in Australia, I asked him the very same
> question.
> 
> A bit o' cut & paste...
> 
> - Dave
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> #define GNOCATAN_PIXMAP_DICE "gnocatan/dice.png"
> #define GNOCATAN_PIXMAP_TRADE "gnocatan/trade.png"
> #define GNOCATAN_PIXMAP_ROAD "gnocatan/road.png"
> #define GNOCATAN_PIXMAP_SETTLEMENT "gnocatan/settlement.png"
> #define GNOCATAN_PIXMAP_CITY "gnocatan/city.png"
> #define GNOCATAN_PIXMAP_DEVELOP "gnocatan/develop.png"
> #define GNOCATAN_PIXMAP_FINISH "gnocatan/finish.png"
> 
> static gchar *gnocatan_pixmaps[] = {
> 	GNOCATAN_PIXMAP_DICE,
> 	GNOCATAN_PIXMAP_TRADE,
> 	GNOCATAN_PIXMAP_ROAD,
> 	GNOCATAN_PIXMAP_SETTLEMENT,
> 	GNOCATAN_PIXMAP_CITY,
> 	GNOCATAN_PIXMAP_DEVELOP,
> 	GNOCATAN_PIXMAP_FINISH
> };
> 
> static void register_gnocatan_pixmaps()
> {
> 	gint idx;
> 
> 	for (idx = 0; idx < numElem(gnocatan_pixmaps); idx++) {
> 		GnomeStockPixmapEntryPath *entry;
> 
> 		entry = g_malloc0(sizeof(*entry));
> 		entry->type = GNOME_STOCK_PIXMAP_TYPE_PATH;
> 		entry->pathname = gnome_pixmap_file(gnocatan_pixmaps[idx]);
> 		gnome_stock_pixmap_register(gnocatan_pixmaps[idx],
> 					    GNOME_STOCK_PIXMAP_REGULAR,
> 					    (GnomeStockPixmapEntry *)entry);
> 	}
> }
> 
> static GnomeUIInfo toolbar_uiinfo[] = {
> 	{ GNOME_APP_UI_ITEM, N_("Roll Dice"), NULL,
> 	  client_event_cb, (gpointer)GUI_ROLL, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOCATAN_PIXMAP_DICE, 0, 0, NULL },
> 	{ GNOME_APP_UI_ITEM, N_("Trade"), NULL,
> 	  client_event_cb, (gpointer)GUI_TRADE, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOCATAN_PIXMAP_TRADE, 0, 0, NULL },
> 	{ GNOME_APP_UI_ITEM, N_("Road"), NULL,
> 	  client_event_cb, (gpointer)GUI_ROAD, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOCATAN_PIXMAP_ROAD, 0, 0, NULL },
> 	{ GNOME_APP_UI_ITEM, N_("Settlement"), NULL,
> 	  client_event_cb, (gpointer)GUI_SETTLEMENT, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOCATAN_PIXMAP_SETTLEMENT, 0, 0, NULL },
> 	{ GNOME_APP_UI_ITEM, N_("City"), NULL,
> 	  client_event_cb, (gpointer)GUI_CITY, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOCATAN_PIXMAP_CITY, 0, 0, NULL },
> 	{ GNOME_APP_UI_ITEM, N_("Develop"), NULL,
> 	  client_event_cb, (gpointer)GUI_BUY_DEVELOP, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOCATAN_PIXMAP_DEVELOP, 0, 0, NULL },
> 	{ GNOME_APP_UI_ITEM, N_("Undo"), NULL,
> 	  client_event_cb, (gpointer)GUI_UNDO, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_UNDO, 0, 0, NULL },
> 	{ GNOME_APP_UI_ITEM, N_("Finish"), NULL,
> 	  client_event_cb, (gpointer)GUI_FINISH, NULL,
> 	  GNOME_APP_PIXMAP_STOCK, GNOCATAN_PIXMAP_FINISH, 0, 0, NULL },
> 	{ GNOME_APP_UI_ENDOFINFO }
> };
> 
>         gnome_app_create_toolbar(GNOME_APP(app_window), toolbar_uiinfo);
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> 
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]