GNOME images not displaying



I'm having a problem getting the gnome stock icons to display. Here is a simple XML file creating two buttons. Both have an image on the button but only one of the images displays. The program to display this GUI is also attached. What am I missing?

XML:

<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="Main Window">
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<object class="GtkToggleButton" id="togglebutton1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="togglebutton2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gnome-stock-trash</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>


Test.c

/*
 *  This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public License
 *  as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *  Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 *
 *  Copyright (C) Steven Harrington 2010 <steven harrington verizon net>
 */

/*
 *  Compile with:
 * gcc -o Test Test.c `pkg-config --cflags gtk+-2.0`
 *                          `pkg-config --libs gtk+-2.0`
 */

#include <stdlib.h>
#include <gtk/gtk.h>

static void QuitCB( GtkWidget *widget, gpointer   data )
{
  exit( EXIT_SUCCESS );
}

static void GTKErrorPopup( char *prefix, char *message )
{
  GtkWidget *dialog;

  /* Create the widgets */
  dialog = gtk_message_dialog_new( NULL,
                   GTK_DIALOG_DESTROY_WITH_PARENT,
                   GTK_MESSAGE_ERROR,
                   GTK_BUTTONS_CLOSE,
                   "%s",
                   prefix );
  gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG(dialog),
                        "%s",
                        message );
  gtk_dialog_run( GTK_DIALOG(dialog) );
  gtk_widget_destroy( dialog );
  abort( );
}

int main( int argc, char *argv[] )
{
  GtkBuilder   *builder;
  GError       *error=NULL;
  GObject      *MainWindow;

  gtk_init( &argc, &argv );

  builder = gtk_builder_new( );
  if( gtk_builder_add_from_file( builder, "Test.xml", &error ) == 0 )
     GTKErrorPopup( "Build Main GUI", error->message );

  MainWindow = gtk_builder_get_object( builder, "Main Window" );
  g_signal_connect( MainWindow, "destroy", G_CALLBACK(QuitCB), NULL );

  gtk_widget_show_all( GTK_WIDGET(MainWindow) );
  g_object_unref( G_OBJECT(builder) );

  gtk_main( );

  exit( EXIT_FAILURE );
}



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