[Glade-users] problem with gtk_builder_add_from_file




Hello:
        I've /just/ started using Glade (and GTK, for that matter) and
am missing clue here.
        Running Glade 3.4.5, xml file appended, the following code:

GtkTextBuffer *display_buffer,
     *display_buffer_position;
GtkTextIter   *iter = NULL;

GtkWidget *display_ptr;

extern int errno;

int main(argc,argv)
        int argc;
     char *argv[];
{
  gint i;

  GtkBuilder      *builder; 
  GtkWidget       *window;
  GladeXML        *xml;

  extern void clear_disp_buff();

  extern GtkTextIter *iter;

//  IMPORTANT - leave this before any Gtk/Glade calls

  gtk_init (&argc, &argv);

//
  puts("\nmain:: 0.0");
  builder = gtk_builder_new ();
  puts("\nmain:: 0.1");
  i = gtk_builder_add_from_file (builder, "ui.xml", NULL);
  if (!i)
    {
         puts("\nMain:: gtk_builder failed");
    }

  puts("\nmain:: 0.2");
  window = GTK_WIDGET (gtk_builder_get_object (builder, "root_window"));
  puts("\nmain:: 0");


        produces:


main:: 0.0

main:: 0.1

(ui:18101): GLib-GObject-CRITICAL **: g_value_type_compatible: assertion `G_TYPE_IS_VALUE (src_type)' failed

(ui:18101): Gtk-WARNING **: gtkliststore.c:608: Unable to convert from (null) to gchararray


(ui:18101): GLib-GObject-CRITICAL **: g_value_unset: assertion `G_IS_VALUE (value)' failed

main:: 0.2

main:: 0


        1) is there a debug tool/setting which will give a better idea
of what's going on?
        2) if not, what have I done wrong?  I adapted this code from
Miccah Carrick's (excellent but much too short) tutorial.  (Not
blaiming, just identifying.)

        Respectfully,


                                Robert Huff


****************        ui.xml  ****************

<?xml version="1.0"?>
<!--Generated with glade3 3.4.5 on Tue Jul 29 13:14:20 2008 -->
<interface>
  <object class="GtkListStore" id="model1">
    <columns>
      <column type="gchararray"/>
    </columns>
    <data>
      <row>
        <col id="0">FOO</col>
      </row>
      <row>
        <col id="0">Bar</col>
      </row>
      <row>
        <col id="0">grill</col>
      </row>
      <row>
        <col id="0"/>
      </row>
    </data>
  </object>
  <object class="GtkUIManager" id="uimanager1">
    <child>
      <object class="GtkActionGroup" id="actiongroup1">
        <child>
          <object class="GtkAction" id="File">
            <property name="name">File</property>
            <property name="label" translatable="yes">_File</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="New">
            <property name="stock_id" translatable="yes">gtk-new</property>
            <property name="name">New</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="Open">
            <property name="stock_id" translatable="yes">gtk-open</property>
            <property name="name">Open</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="Save">
            <property name="stock_id" translatable="yes">gtk-save</property>
            <property name="name">Save</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="save_as">
            <property name="stock_id" translatable="yes">gtk-save-as</property>
            <property name="name">save_as</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="program_exit">
            <property name="stock_id" translatable="yes">gtk-quit</property>
            <property name="name">program_exit</property>
            <signal handler="gtk_main_quit" name="activate"/>
          </object>
          <accelerator key="Q" modifiers="GDK_CONTROL_MASK"/>
        </child>
        <child>
          <object class="GtkAction" id="Print">
            <property name="name">Print</property>
            <property name="label" translatable="yes">_Print</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="Prin">
            <property name="name">Prin</property>
            <property name="label" translatable="yes">_Edit</property>
            <signal handler="on_Print_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="imagemenuitem6">
            <property name="stock_id" translatable="yes">gtk-cut</property>
            <property name="name">imagemenuitem6</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="imagemenuitem7">
            <property name="stock_id" translatable="yes">gtk-copy</property>
            <property name="name">imagemenuitem7</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="imagemenuitem8">
            <property name="stock_id" translatable="yes">gtk-paste</property>
            <property name="name">imagemenuitem8</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="imagemenuitem9">
            <property name="stock_id" translatable="yes">gtk-delete</property>
            <property name="name">imagemenuitem9</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="List">
            <property name="name">List</property>
            <property name="label" translatable="yes">_View</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="list_all">
            <property name="name">list_all</property>
            <property name="label" translatable="yes">All</property>
            <signal handler="on_list_all_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="list_select">
            <property name="name">list_select</property>
            <property name="label" translatable="yes">Select</property>
            <signal handler="on_list_select_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="Insert">
            <property name="name">Insert</property>
            <property name="label" translatable="yes">_Insert</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="insert_single">
            <property name="name">insert_single</property>
            <property name="label" translatable="yes">Single</property>
            <signal handler="on_insert_single_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="insert_from_file">
            <property name="name">insert_from_file</property>
            <property name="label" translatable="yes">From file</property>
            <signal handler="on_insert_from_file_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="Delete">
            <property name="name">Delete</property>
            <property name="label" translatable="yes">_Delete</property>
            <signal handler="on_Delete_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="Update">
            <property name="name">Update</property>
            <property name="label" translatable="yes">_Update</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="update_single">
            <property name="name">update_single</property>
            <property name="label" translatable="yes">Single</property>
            <signal handler="on_update_single_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="update_from_file">
            <property name="name">update_from_file</property>
            <property name="label" translatable="yes">From file</property>
            <signal handler="on_update_from_file_activate" name="activate"/>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="Help">
            <property name="name">Help</property>
            <property name="label" translatable="yes">_Help</property>
          </object>
        </child>
        <child>
          <object class="GtkAction" id="imagemenuitem10">
            <property name="stock_id" translatable="yes">gtk-about</property>
            <property name="name">imagemenuitem10</property>
          </object>
        </child>
      </object>
    </child>
    <ui>
      <menubar name="menubar1">
        <menu action="File">
          <menuitem action="New"/>
          <menuitem action="Open"/>
          <menuitem action="Save"/>
          <menuitem action="save_as"/>
          <separator/>
          <menuitem action="program_exit"/>
        </menu>
        <menuitem action="Print"/>
        <menu action="Prin">
          <menuitem action="imagemenuitem6"/>
          <menuitem action="imagemenuitem7"/>
          <menuitem action="imagemenuitem8"/>
          <menuitem action="imagemenuitem9"/>
        </menu>
        <menu action="List">
          <menuitem action="list_all"/>
          <menuitem action="list_select"/>
        </menu>
        <menu action="Insert">
          <menuitem action="insert_single"/>
          <menuitem action="insert_from_file"/>
        </menu>
        <menuitem action="Delete"/>
        <menu action="Update">
          <menuitem action="update_single"/>
          <menuitem action="update_from_file"/>
        </menu>
        <menu action="Help">
          <menuitem action="imagemenuitem10"/>
        </menu>
      </menubar>
    </ui>
  </object>
  <object class="GtkWindow" id="root_window">
    <property name="title" translatable="yes">River City management UI</property>
    <property name="window_position">GTK_WIN_POS_CENTER</property>
    <property name="default_width">640</property>
    <property name="default_height">480</property>
    <property name="skip_taskbar_hint">True</property>
    <signal handler="on_root_window_destroy" name="destroy"/>
    <child>
      <object class="GtkVBox" id="vbox1">
        <property name="visible">True</property>
        <child>
          <object class="GtkMenuBar" constructor="uimanager1" id="menubar1">
            <property name="visible">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
          </packing>
        </child>
        <child>
          <object class="GtkScrolledWindow" id="scrolledwindow1">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="border_width">2</property>
            <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
            <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
            <child>
              <object class="GtkTextView" id="main_text_area">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="editable">False</property>
              </object>
            </child>
          </object>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkStatusbar" id="status_bar">
            <property name="visible">True</property>
            <property name="spacing">2</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="position">2</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
  <object class="GtkWindow" id="window1">
    <child>
      <object class="GtkVBox" id="vbox2">
        <property name="visible">True</property>
        <child>
          <object class="GtkComboBox" id="ind_list">
            <property name="height_request">150</property>
            <property name="visible">True</property>
            <property name="border_width">3</property>
            <signal handler="on_ind_list_changed" name="changed"/>
            <property name="model">model1</property>
            <child>
              <object class="GtkCellRendererText" id="renderer1"/>
              <attributes>
                <attribute name="text">0</attribute>
              </attributes>
            </child>
          </object>
        </child>
        <child>
          <object class="GtkHBox" id="hbox1">
            <property name="visible">True</property>
            <child>
              <object class="GtkButton" id="button1">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="label" translatable="yes">gtk-ok</property>
                <property name="use_stock">True</property>
              </object>
            </child>
            <child>
              <object class="GtkButton" id="button2">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="label" translatable="yes">gtk-cancel</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
                <property name="position">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>



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