Building a simple composite widget?

Pat Riehecky <[email protected]> Tue, 20 Feb 2018 16:03:35 -0600
Newsgroups gmane.comp.gnome.glade.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------DDD59CDF835649666044341D
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

I'm trying to build a set of reusable widgets.  Basically I have a bunch 
of places where I need the same dropdown boxes.  Each box may have a 
different selected value (Instance A uses Index 1 while Instance B uses 
Index 2), but the items in the list are the same.

I'm really just looking to build a set of Pre-populated "GtkComboBox" 
items - A simplified example is attached.

I'd prefer to store the possible enum values within a widget and then 
interrogate it rather than a bunch of "GtkListStore" items I need to 
edit over and over.

Is there a way I can convert the attached "ProtocolDropdown" object into 
a widget?  I'd want it to stay associated with the "Protocols" 
"GtkListStore".

Building a C program to track this feels like massive overkill, but I 
don't see a way to "Export object as widget".

Pat


-- 
Pat Riehecky

Fermi National Accelerator Laboratory
www.fnal.gov
www.scientificlinux.org


--------------DDD59CDF835649666044341D
Content-Type: text/xml;
 name="widgets.xml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="widgets.xml"

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkListStore" id="Protocols">
    <columns>
      <!-- column-name Display -->
      <column type="gchararray"/>
      <!-- column-name URI -->
      <column type="gchararray"/>
    </columns>
    <data>
      <row>
        <col id="0" translatable="yes">Over the web</col>
        <col id="1">http://</col>
      </row>
      <row>
        <col id="0" translatable="yes">Use legacy</col>
        <col id="1">ftp://</col>
      </row>
    </data>
  </object>
  <object class="GtkWindow">
    <property name="can_focus">False</property>
    <child>
      <object class="GtkComboBox" id="ProtocolDropdown">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="model">Protocols</property>
        <child>
          <object class="GtkCellRendererText" id="ProtocolDropownMenu"/>
          <attributes>
            <attribute name="text">0</attribute>
          </attributes>
        </child>
      </object>
    </child>
  </object>
</interface>

--------------DDD59CDF835649666044341D
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KR2xhZGUtdXNl
cnMgbWFpbGxpc3QgIC0gIEdsYWRlLXVzZXJzQGxpc3RzLmRvdC5uZXQKaHR0cDovL2xpc3RzLmRv
dC5uZXQvbWFpbG1hbi9saXN0aW5mby9nbGFkZS11c2Vycwo=

--------------DDD59CDF835649666044341D--