]> saetta.ns0.it Git - libgdaex/commitdiff
Changed GUI.
authorAndrea Zagli <azagli@libero.it>
Sat, 5 Mar 2011 16:48:57 +0000 (17:48 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 5 Mar 2011 16:48:57 +0000 (17:48 +0100)
Added function GdaExQueryEditor::clean_choices.

data/libgdaex/gui/libgdaex.ui
src/queryeditor.c
src/queryeditor.h
tests/query_editor.c

index 85edf0df8fc568fad69874cacea04288fdd27ba4..cbd0925c2833e86f759980aae08aaf161e91f539 100644 (file)
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkDialog" id="diag_query_editor">
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Query Editor</property>
-    <property name="modal">True</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="default_width">600</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">normal</property>
-    <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox1">
+  <object class="GtkWindow" id="w_query_editor">
+    <child>
+      <object class="GtkHPaned" id="hpaned_query_editor">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">5</property>
+        <property name="can_focus">True</property>
+        <property name="border_width">4</property>
+        <property name="position">200</property>
+        <property name="position_set">True</property>
         <child>
-          <object class="GtkHPaned" id="hpaned1">
+          <object class="GtkScrolledWindow" id="scrolledwindow1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="position">200</property>
-            <property name="position_set">True</property>
+            <property name="hscrollbar_policy">automatic</property>
+            <property name="vscrollbar_policy">automatic</property>
+            <property name="shadow_type">etched-in</property>
             <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow1">
+              <object class="GtkTreeView" id="treeview1">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="hscrollbar_policy">automatic</property>
-                <property name="vscrollbar_policy">automatic</property>
-                <property name="shadow_type">etched-in</property>
+                <property name="model">tstore_fields</property>
+                <property name="headers_clickable">False</property>
+                <property name="search_column">0</property>
+                <property name="tooltip_column">3</property>
                 <child>
-                  <object class="GtkTreeView" id="treeview1">
+                  <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                    <property name="title">Fields</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                      <attributes>
+                        <attribute name="text">2</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="resize">False</property>
+            <property name="shrink">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">5</property>
+            <child>
+              <object class="GtkVBox" id="vbox3">
+                <property name="no_show_all">True</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">5</property>
+                <child>
+                  <object class="GtkVBox" id="vbox4">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="model">tstore_fields</property>
-                    <property name="tooltip_column">3</property>
+                    <property name="orientation">vertical</property>
                     <child>
-                      <object class="GtkTreeViewColumn" id="treeviewcolumn1">
-                        <property name="title">Fields</property>
-                        <child>
-                          <object class="GtkCellRendererText" id="cellrenderertext1"/>
-                          <attributes>
-                            <attribute name="text">2</attribute>
-                          </attributes>
-                        </child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHButtonBox" id="hbuttonbox1">
+                    <property name="visible">True</property>
+                    <property name="spacing">5</property>
+                    <property name="layout_style">end</property>
+                    <child>
+                      <object class="GtkButton" id="button16">
+                        <property name="label">gtk-cancel</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_stock">True</property>
                       </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="button15">
+                        <property name="label">gtk-save</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_stock">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
                     </child>
                   </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
                 </child>
               </object>
               <packing>
-                <property name="resize">False</property>
-                <property name="shrink">True</property>
+                <property name="expand">False</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="vbox1">
+              <object class="GtkNotebook" id="notebook1">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">5</property>
+                <property name="can_focus">True</property>
                 <child>
-                  <object class="GtkVBox" id="vbox3">
-                    <property name="orientation">vertical</property>
+                  <object class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
+                    <property name="border_width">5</property>
                     <property name="spacing">5</property>
                     <child>
-                      <object class="GtkVBox" id="vbox4">
+                      <object class="GtkScrolledWindow" id="scrolledwindow2">
                         <property name="visible">True</property>
-                        <property name="orientation">vertical</property>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">automatic</property>
+                        <property name="vscrollbar_policy">automatic</property>
+                        <property name="shadow_type">etched-in</property>
                         <child>
-                          <placeholder/>
+                          <object class="GtkTreeView" id="treeview2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="model">lstore_show</property>
+                            <property name="headers_clickable">False</property>
+                            <property name="search_column">0</property>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                                <property name="title">Field</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                                  <attributes>
+                                    <attribute name="text">2</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
                         </child>
                       </object>
                       <packing>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkHButtonBox" id="hbuttonbox1">
+                      <object class="GtkVButtonBox" id="vbuttonbox1">
                         <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
                         <property name="spacing">5</property>
-                        <property name="layout_style">end</property>
+                        <property name="layout_style">start</property>
                         <child>
-                          <object class="GtkButton" id="button16">
-                            <property name="label">gtk-cancel</property>
+                          <object class="GtkButton" id="button3">
+                            <property name="label">gtk-add</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="button15">
-                            <property name="label">gtk-save</property>
+                          <object class="GtkButton" id="button4">
+                            <property name="label">gtk-remove</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkButton" id="button5">
+                            <property name="label">gtk-go-up</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button6">
+                            <property name="label">gtk-go-down</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button1">
+                            <property name="label">gtk-clear</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">4</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
+                        <property name="expand">False</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Show</property>
+                  </object>
                   <packing>
-                    <property name="position">0</property>
+                    <property name="tab_fill">False</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkFrame" id="frame1">
+                  <object class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
-                    <property name="label_xalign">0</property>
+                    <property name="border_width">5</property>
+                    <property name="spacing">5</property>
                     <child>
-                      <object class="GtkAlignment" id="alignment1">
+                      <object class="GtkScrolledWindow" id="scrolledwindow3">
                         <property name="visible">True</property>
-                        <property name="left_padding">12</property>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">automatic</property>
+                        <property name="vscrollbar_policy">automatic</property>
+                        <property name="shadow_type">etched-in</property>
                         <child>
-                          <object class="GtkHBox" id="hbox1">
+                          <object class="GtkTreeView" id="treeview3">
                             <property name="visible">True</property>
-                            <property name="spacing">5</property>
+                            <property name="can_focus">True</property>
+                            <property name="model">tstore_where</property>
+                            <property name="headers_clickable">False</property>
+                            <property name="search_column">0</property>
                             <child>
-                              <object class="GtkScrolledWindow" id="scrolledwindow2">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="hscrollbar_policy">automatic</property>
-                                <property name="vscrollbar_policy">automatic</property>
-                                <property name="shadow_type">etched-in</property>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+                                <property name="title">Field</property>
                                 <child>
-                                  <object class="GtkTreeView" id="treeview2">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="model">lstore_show</property>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn2">
-                                        <property name="title">Field</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext2"/>
-                                          <attributes>
-                                            <attribute name="text">2</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
+                                  <object class="GtkCellRendererText" id="cellrenderertext5"/>
+                                  <attributes>
+                                    <attribute name="text">2</attribute>
+                                  </attributes>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">0</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkVButtonBox" id="vbuttonbox1">
-                                <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
-                                <property name="spacing">5</property>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn9">
+                                <property name="title">Not</property>
                                 <child>
-                                  <object class="GtkButton" id="button3">
-                                    <property name="label">gtk-add</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
+                                  <object class="GtkCellRendererToggle" id="cellrenderertoggle1"/>
+                                  <attributes>
+                                    <attribute name="active">3</attribute>
+                                  </attributes>
                                 </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn6">
+                                <property name="title">Condition</property>
                                 <child>
-                                  <object class="GtkButton" id="button4">
-                                    <property name="label">gtk-remove</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
+                                  <object class="GtkCellRendererText" id="cellrenderertext6"/>
+                                  <attributes>
+                                    <attribute name="text">5</attribute>
+                                  </attributes>
                                 </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn7">
+                                <property name="title">From</property>
                                 <child>
-                                  <object class="GtkButton" id="button5">
-                                    <property name="label">gtk-go-up</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">2</property>
-                                  </packing>
+                                  <object class="GtkCellRendererText" id="cellrenderertext7"/>
+                                  <attributes>
+                                    <attribute name="text">6</attribute>
+                                  </attributes>
                                 </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn8">
+                                <property name="title">To</property>
                                 <child>
-                                  <object class="GtkButton" id="button6">
-                                    <property name="label">gtk-go-down</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">3</property>
-                                  </packing>
+                                  <object class="GtkCellRendererText" id="cellrenderertext8"/>
+                                  <attributes>
+                                    <attribute name="text">7</attribute>
+                                  </attributes>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                       </object>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
                     </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label1">
+                    <child>
+                      <object class="GtkVButtonBox" id="vbuttonbox2">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Show&lt;/b&gt;</property>
-                        <property name="use_markup">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">5</property>
+                        <property name="layout_style">start</property>
+                        <child>
+                          <object class="GtkButton" id="button7">
+                            <property name="label">gtk-add</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button8">
+                            <property name="label">gtk-remove</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button9">
+                            <property name="label">gtk-go-up</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button10">
+                            <property name="label">gtk-go-down</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button2">
+                            <property name="label">gtk-clear</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">4</property>
+                          </packing>
+                        </child>
                       </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="label5">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Where</property>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
                 <child>
-                  <object class="GtkFrame" id="frame2">
+                  <object class="GtkHBox" id="hbox3">
                     <property name="visible">True</property>
-                    <property name="label_xalign">0</property>
+                    <property name="border_width">5</property>
+                    <property name="spacing">5</property>
                     <child>
-                      <object class="GtkAlignment" id="alignment2">
+                      <object class="GtkScrolledWindow" id="scrolledwindow4">
                         <property name="visible">True</property>
-                        <property name="left_padding">12</property>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">automatic</property>
+                        <property name="vscrollbar_policy">automatic</property>
+                        <property name="shadow_type">etched-in</property>
                         <child>
-                          <object class="GtkHBox" id="hbox2">
+                          <object class="GtkTreeView" id="treeview4">
                             <property name="visible">True</property>
-                            <property name="spacing">5</property>
+                            <property name="can_focus">True</property>
+                            <property name="model">lstore_order</property>
+                            <property name="headers_clickable">False</property>
+                            <property name="search_column">0</property>
                             <child>
-                              <object class="GtkScrolledWindow" id="scrolledwindow3">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="hscrollbar_policy">automatic</property>
-                                <property name="vscrollbar_policy">automatic</property>
-                                <property name="shadow_type">etched-in</property>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+                                <property name="title">Field</property>
                                 <child>
-                                  <object class="GtkTreeView" id="treeview3">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="model">tstore_where</property>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn5">
-                                        <property name="title">Field</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext5"/>
-                                          <attributes>
-                                            <attribute name="text">2</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn9">
-                                        <property name="title">Not</property>
-                                        <child>
-                                          <object class="GtkCellRendererToggle" id="cellrenderertoggle1"/>
-                                          <attributes>
-                                            <attribute name="active">3</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn6">
-                                        <property name="title">Condition</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext6"/>
-                                          <attributes>
-                                            <attribute name="text">5</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn7">
-                                        <property name="title">From</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext7"/>
-                                          <attributes>
-                                            <attribute name="text">6</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn8">
-                                        <property name="title">To</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext8"/>
-                                          <attributes>
-                                            <attribute name="text">7</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
+                                  <object class="GtkCellRendererText" id="cellrenderertext3"/>
+                                  <attributes>
+                                    <attribute name="text">2</attribute>
+                                  </attributes>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">0</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkVButtonBox" id="vbuttonbox2">
-                                <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
-                                <property name="spacing">5</property>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+                                <property name="title">Order</property>
                                 <child>
-                                  <object class="GtkButton" id="button7">
-                                    <property name="label">gtk-add</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="button8">
-                                    <property name="label">gtk-remove</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="button9">
-                                    <property name="label">gtk-go-up</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="button10">
-                                    <property name="label">gtk-go-down</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">3</property>
-                                  </packing>
+                                  <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                                  <attributes>
+                                    <attribute name="text">3</attribute>
+                                  </attributes>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                       </object>
+                      <packing>
+                        <property name="position">0</property>
+                      </packing>
                     </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label2">
+                    <child>
+                      <object class="GtkVButtonBox" id="vbuttonbox3">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Where&lt;/b&gt;</property>
-                        <property name="use_markup">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">5</property>
+                        <property name="layout_style">start</property>
+                        <child>
+                          <object class="GtkButton" id="button11">
+                            <property name="label">gtk-add</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button12">
+                            <property name="label">gtk-remove</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button13">
+                            <property name="label">gtk-go-up</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button14">
+                            <property name="label">gtk-go-down</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button17">
+                            <property name="label">gtk-clear</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_stock">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">4</property>
+                          </packing>
+                        </child>
                       </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="position">2</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkFrame" id="frame3">
+                <child type="tab">
+                  <object class="GtkLabel" id="label6">
                     <property name="visible">True</property>
-                    <property name="label_xalign">0</property>
-                    <child>
-                      <object class="GtkAlignment" id="alignment3">
-                        <property name="visible">True</property>
-                        <property name="left_padding">12</property>
-                        <child>
-                          <object class="GtkHBox" id="hbox3">
-                            <property name="visible">True</property>
-                            <property name="spacing">5</property>
-                            <child>
-                              <object class="GtkScrolledWindow" id="scrolledwindow4">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="hscrollbar_policy">automatic</property>
-                                <property name="vscrollbar_policy">automatic</property>
-                                <property name="shadow_type">etched-in</property>
-                                <child>
-                                  <object class="GtkTreeView" id="treeview4">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="model">lstore_order</property>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn3">
-                                        <property name="title">Field</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext3"/>
-                                          <attributes>
-                                            <attribute name="text">2</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                    <child>
-                                      <object class="GtkTreeViewColumn" id="treeviewcolumn4">
-                                        <property name="title">Order</property>
-                                        <child>
-                                          <object class="GtkCellRendererText" id="cellrenderertext4"/>
-                                          <attributes>
-                                            <attribute name="text">3</attribute>
-                                          </attributes>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkVButtonBox" id="vbuttonbox3">
-                                <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
-                                <property name="spacing">5</property>
-                                <child>
-                                  <object class="GtkButton" id="button11">
-                                    <property name="label">gtk-add</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="button12">
-                                    <property name="label">gtk-remove</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="button13">
-                                    <property name="label">gtk-go-up</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkButton" id="button14">
-                                    <property name="label">gtk-go-down</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_stock">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">3</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label3">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">&lt;b&gt;Order&lt;/b&gt;</property>
-                        <property name="use_markup">True</property>
-                      </object>
-                    </child>
+                    <property name="label" translatable="yes">Order</property>
                   </object>
                   <packing>
-                    <property name="position">3</property>
+                    <property name="position">2</property>
+                    <property name="tab_fill">False</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area1">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="button1">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button2">
-                <property name="label">gtk-ok</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
                 <property name="position">1</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
+            <property name="resize">True</property>
+            <property name="shrink">True</property>
           </packing>
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="1">button1</action-widget>
-      <action-widget response="2">button2</action-widget>
-    </action-widgets>
   </object>
 </interface>
index d5ba5d3130ae81a423e426429f54988c45ca2929..40289ea9f51cd17846cae6c2065d8a828ba28e71 100644 (file)
@@ -64,6 +64,8 @@ static void gdaex_query_editor_refresh_gui_add_fields (GdaExQueryEditor *qe,
                                                        GdaExQueryEditorTable *table,
                                                        GtkTreeIter *iter_parent);
 
+static void gdaex_query_editor_refill_always_show (GdaExQueryEditor *qe);
+
 static void gdaex_query_editor_store_remove_iter (GdaExQueryEditor *qe,
                                        GtkTreeSelection *sel,
                                        GObject *store);
@@ -98,6 +100,8 @@ static void gdaex_query_editor_on_btn_show_up_clicked (GtkButton *button,
                                     gpointer user_data);
 static void gdaex_query_editor_on_btn_show_down_clicked (GtkButton *button,
                                     gpointer user_data);
+static void gdaex_query_editor_on_btn_show_clean_clicked (GtkButton *button,
+                                    gpointer user_data);
 static void gdaex_query_editor_on_sel_show_changed (GtkTreeSelection *treeselection,
                                                     gpointer user_data);
 
@@ -109,6 +113,8 @@ static void gdaex_query_editor_on_btn_where_up_clicked (GtkButton *button,
                                     gpointer user_data);
 static void gdaex_query_editor_on_btn_where_down_clicked (GtkButton *button,
                                     gpointer user_data);
+static void gdaex_query_editor_on_btn_where_clean_clicked (GtkButton *button,
+                                    gpointer user_data);
 static void gdaex_query_editor_on_sel_where_changed (GtkTreeSelection *treeselection,
                                                     gpointer user_data);
 
@@ -120,6 +126,8 @@ static void gdaex_query_editor_on_btn_order_up_clicked (GtkButton *button,
                                     gpointer user_data);
 static void gdaex_query_editor_on_btn_order_down_clicked (GtkButton *button,
                                     gpointer user_data);
+static void gdaex_query_editor_on_btn_order_clean_clicked (GtkButton *button,
+                                    gpointer user_data);
 static void gdaex_query_editor_on_sel_order_changed (GtkTreeSelection *treeselection,
                                                     gpointer user_data);
 
@@ -132,7 +140,6 @@ struct _GdaExQueryEditorPrivate
 
                GtkBuilder *gtkbuilder;
 
-               GtkWidget *dialog;
                GtkWidget *hpaned_main;
 
                GtkWidget *vbx_values_container;
@@ -219,7 +226,6 @@ gdaex_query_editor_init (GdaExQueryEditor *gdaex_query_editor)
 
        priv->tables = g_hash_table_new (g_str_hash, g_str_equal);
 
-       priv->dialog = NULL;
        priv->hpaned_main = NULL;
        priv->relations = NULL;
 
@@ -259,7 +265,7 @@ GdaExQueryEditor
                                                       "|lstore_show"
                                                       "|tstore_where"
                                                       "|lstore_order"
-                                                      "|diag_query_editor",
+                                                      "|hpaned_query_editor",
                                                       "|", -1),
                                           &error);
        if (error != NULL)
@@ -298,6 +304,8 @@ GdaExQueryEditor
                          G_CALLBACK (gdaex_query_editor_on_btn_show_up_clicked), (gpointer)gdaex_query_editor);
        g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button6"), "clicked",
                          G_CALLBACK (gdaex_query_editor_on_btn_show_down_clicked), (gpointer)gdaex_query_editor);
+       g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button1"), "clicked",
+                         G_CALLBACK (gdaex_query_editor_on_btn_show_clean_clicked), (gpointer)gdaex_query_editor);
        g_signal_connect (priv->sel_show, "changed",
                          G_CALLBACK (gdaex_query_editor_on_sel_show_changed), (gpointer)gdaex_query_editor);
 
@@ -309,6 +317,8 @@ GdaExQueryEditor
                          G_CALLBACK (gdaex_query_editor_on_btn_where_up_clicked), (gpointer)gdaex_query_editor);
        g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button10"), "clicked",
                          G_CALLBACK (gdaex_query_editor_on_btn_where_down_clicked), (gpointer)gdaex_query_editor);
+       g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button2"), "clicked",
+                         G_CALLBACK (gdaex_query_editor_on_btn_where_clean_clicked), (gpointer)gdaex_query_editor);
        g_signal_connect (priv->sel_where, "changed",
                          G_CALLBACK (gdaex_query_editor_on_sel_where_changed), (gpointer)gdaex_query_editor);
 
@@ -320,6 +330,8 @@ GdaExQueryEditor
                          G_CALLBACK (gdaex_query_editor_on_btn_order_up_clicked), (gpointer)gdaex_query_editor);
        g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button14"), "clicked",
                          G_CALLBACK (gdaex_query_editor_on_btn_order_down_clicked), (gpointer)gdaex_query_editor);
+       g_signal_connect (gtk_builder_get_object (priv->gtkbuilder, "button17"), "clicked",
+                         G_CALLBACK (gdaex_query_editor_on_btn_order_clean_clicked), (gpointer)gdaex_query_editor);
        g_signal_connect (priv->sel_order, "changed",
                          G_CALLBACK (gdaex_query_editor_on_sel_order_changed), (gpointer)gdaex_query_editor);
 
@@ -330,25 +342,6 @@ GdaExQueryEditor
        return gdaex_query_editor;
 }
 
-GtkWidget
-*gdaex_query_editor_get_dialog (GdaExQueryEditor *gdaex_query_editor)
-{
-       GdaExQueryEditorPrivate *priv;
-
-       g_return_if_fail (GDAEX_IS_QUERY_EDITOR (gdaex_query_editor));
-
-       priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor);
-
-       if (priv->dialog == NULL)
-               {
-                       priv->dialog = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "diag_query_editor"));
-               }
-
-       gdaex_query_editor_refresh_gui (gdaex_query_editor);
-
-       return priv->dialog;
-}
-
 GtkWidget
 *gdaex_query_editor_get_widget (GdaExQueryEditor *gdaex_query_editor)
 {
@@ -360,7 +353,7 @@ GtkWidget
 
        if (priv->hpaned_main == NULL)
                {
-                       priv->hpaned_main = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "hpaned1"));
+                       priv->hpaned_main = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "hpaned_query_editor"));
                }
 
        gdaex_query_editor_refresh_gui (gdaex_query_editor);
@@ -464,6 +457,24 @@ gdaex_query_editor_add_relation (GdaExQueryEditor *qe,
        return TRUE;
 }
 
+void
+gdaex_query_editor_clean_choices (GdaExQueryEditor *qe)
+{
+       GdaExQueryEditorPrivate *priv;
+
+       g_return_if_fail (GDAEX_IS_QUERY_EDITOR (qe));
+
+       priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (qe);
+
+       gtk_list_store_clear (priv->lstore_show);
+       gtk_tree_store_clear (priv->tstore_where);
+       gtk_list_store_clear (priv->lstore_order);
+
+       gdaex_query_editor_refill_always_show (qe);
+
+       gtk_button_clicked (GTK_BUTTON (gtk_builder_get_object (priv->gtkbuilder, "button16")));
+}
+
 const gchar
 *gdaex_query_editor_get_sql (GdaExQueryEditor *qe)
 {
@@ -996,6 +1007,46 @@ gdaex_query_editor_refresh_gui_add_fields (GdaExQueryEditor *qe,
                }
 }
 
+static void
+gdaex_query_editor_refill_always_show (GdaExQueryEditor *qe)
+{
+       GdaExQueryEditorPrivate *priv;
+
+       GtkTreeIter iter_table;
+       GtkTreeIter iter;
+
+       gchar *table_name;
+       gchar *field_name;
+
+       GdaExQueryEditorTable *table;
+       GdaExQueryEditorField *field;
+
+       priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (qe);
+
+       if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->tstore_fields), &iter_table))
+               {
+                       do
+                               {
+                                       if (gtk_tree_model_iter_children (GTK_TREE_MODEL (priv->tstore_fields), &iter, &iter_table))
+                                               {
+                                                       do
+                                                               {
+                                                                       gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_fields), &iter,
+                                                                                           COL_FIELDS_TABLE_NAME, &table_name,
+                                                                                           COL_FIELDS_NAME, &field_name,
+                                                                                           -1);
+                                                                       table = g_hash_table_lookup (priv->tables, table_name);
+                                                                       field = g_hash_table_lookup (table->fields, field_name);
+                                                                       if (field->always_showed)
+                                                                               {
+                                                                                       gdaex_query_editor_show_add_iter (qe, &iter);
+                                                                               }
+                                                               } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->tstore_fields), &iter));
+                                               }
+                               } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->tstore_fields), &iter_table));
+               }
+}
+
 static void
 gdaex_query_editor_store_remove_iter (GdaExQueryEditor *qe,
                                       GtkTreeSelection *sel,
@@ -1014,8 +1065,7 @@ gdaex_query_editor_store_remove_iter (GdaExQueryEditor *qe,
 
        if (gtk_tree_selection_get_selected (sel, NULL, &iter))
                {
-                       /* TODO if get_widget dialog isn't valid */
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->dialog),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (priv->hpaned_main)),
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_QUESTION,
                                                         GTK_BUTTONS_YES_NO,
@@ -1036,8 +1086,7 @@ gdaex_query_editor_store_remove_iter (GdaExQueryEditor *qe,
                }
        else
                {
-                       /* TODO if get_widget dialog isn't valid */
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->dialog),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (priv->hpaned_main)),
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_WARNING,
                                                         GTK_BUTTONS_OK,
@@ -1100,8 +1149,7 @@ gdaex_query_editor_store_move_iter_up_down (GdaExQueryEditor *qe,
                }
        else
                {
-                       /* TODO if get_widget dialog isn't valid */
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->dialog),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (priv->hpaned_main)),
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_WARNING,
                                                         GTK_BUTTONS_OK,
@@ -1293,7 +1341,18 @@ gdaex_query_editor_on_btn_save_clicked (GtkButton *button,
                                        guint where_type;
                                        
                                        GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->cb_where_type));
-                                       gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->cb_where_type), &iter_val);
+                                       if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->cb_where_type), &iter_val))
+                                               {
+                                                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (priv->hpaned_main)),
+                                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                                                                        GTK_MESSAGE_WARNING,
+                                                                                                        GTK_BUTTONS_OK,
+                                                                                                        "You must select a condition's type before.");
+                                                       gtk_dialog_run (GTK_DIALOG (dialog));
+                                                       gtk_widget_destroy (dialog);
+                                                       return;
+                                               }
+
                                        gtk_tree_model_get (model, &iter_val,
                                                            0, &where_type,
                                                            -1);
@@ -1376,8 +1435,7 @@ gdaex_query_editor_on_btn_show_add_clicked (GtkButton *button,
                }
        else
                {
-                       /* TODO if get_widget dialog isn't valid */
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->dialog),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (priv->hpaned_main)),
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_WARNING,
                                                         GTK_BUTTONS_OK,
@@ -1425,6 +1483,17 @@ gdaex_query_editor_on_btn_show_down_clicked (GtkButton *button,
                                              FALSE);
 }
 
+static void
+gdaex_query_editor_on_btn_show_clean_clicked (GtkButton *button,
+                                    gpointer user_data)
+{
+       GdaExQueryEditor *qe = (GdaExQueryEditor *)user_data;
+       GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (qe);
+
+       gtk_list_store_clear (priv->lstore_show);
+       gdaex_query_editor_refill_always_show (qe);
+}
+
 static void
 gdaex_query_editor_on_sel_show_changed (GtkTreeSelection *treeselection,
                                           gpointer user_data)
@@ -1496,8 +1565,7 @@ gdaex_query_editor_on_btn_where_add_clicked (GtkButton *button,
                }
        else
                {
-                       /* TODO if get_widget dialog isn't valid */
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->dialog),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (priv->hpaned_main)),
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_WARNING,
                                                         GTK_BUTTONS_OK,
@@ -1545,6 +1613,18 @@ gdaex_query_editor_on_btn_where_down_clicked (GtkButton *button,
                                              FALSE);
 }
 
+static void
+gdaex_query_editor_on_btn_where_clean_clicked (GtkButton *button,
+                                    gpointer user_data)
+{
+       GdaExQueryEditor *qe = (GdaExQueryEditor *)user_data;
+       GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (qe);
+
+       gtk_tree_store_clear (priv->tstore_where);
+
+       gtk_button_clicked (GTK_BUTTON (gtk_builder_get_object (priv->gtkbuilder, "button16")));
+}
+
 static void
 gdaex_query_editor_on_sel_where_changed (GtkTreeSelection *treeselection,
                                          gpointer user_data)
@@ -1771,7 +1851,8 @@ gdaex_query_editor_on_sel_where_changed (GtkTreeSelection *treeselection,
 
                        gtk_box_pack_start (GTK_BOX (priv->vbx_values), priv->hbox, FALSE, FALSE, 0);
 
-                       gtk_widget_show_all (priv->vbx_values_container);
+                       gtk_widget_show_all (priv->vbx_values);
+                       gtk_widget_show (priv->vbx_values_container);
                }
 }
 
@@ -1816,8 +1897,7 @@ gdaex_query_editor_on_btn_order_add_clicked (GtkButton *button,
                }
        else
                {
-                       /* TODO if get_widget dialog isn't valid */
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->dialog),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (priv->hpaned_main)),
                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_WARNING,
                                                         GTK_BUTTONS_OK,
@@ -1865,6 +1945,18 @@ gdaex_query_editor_on_btn_order_down_clicked (GtkButton *button,
                                              FALSE);
 }
 
+static void
+gdaex_query_editor_on_btn_order_clean_clicked (GtkButton *button,
+                                    gpointer user_data)
+{
+       GdaExQueryEditor *qe = (GdaExQueryEditor *)user_data;
+       GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (qe);
+
+       gtk_list_store_clear (priv->lstore_order);
+
+       gtk_button_clicked (GTK_BUTTON (gtk_builder_get_object (priv->gtkbuilder, "button16")));
+}
+
 static void
 gdaex_query_editor_on_sel_order_changed (GtkTreeSelection *treeselection,
                                          gpointer user_data)
@@ -1915,6 +2007,7 @@ gdaex_query_editor_on_sel_order_changed (GtkTreeSelection *treeselection,
 
                        gtk_box_pack_start (GTK_BOX (priv->vbx_values), priv->hbox, FALSE, FALSE, 0);
 
-                       gtk_widget_show_all (priv->vbx_values_container);
+                       gtk_widget_show_all (priv->vbx_values);
+                       gtk_widget_show (priv->vbx_values_container);
                }
 }
index 9193ce19413b055956c8a66b1d0774851c26e320..4de344313c119eb376c4ffe6136eb04873dad528 100644 (file)
@@ -55,7 +55,6 @@ GType gdaex_query_editor_get_type (void) G_GNUC_CONST;
 
 GdaExQueryEditor *gdaex_query_editor_new (GdaEx *gdaex);
 
-GtkWidget *gdaex_query_editor_get_dialog (GdaExQueryEditor *gdaex_query_editor);
 GtkWidget *gdaex_query_editor_get_widget (GdaExQueryEditor *gdaex_query_editor);
 
 typedef enum
@@ -114,6 +113,8 @@ gboolean gdaex_query_editor_add_relation (GdaExQueryEditor *qe,
                                           const gchar *table2,
                                           ...);
 
+void gdaex_query_editor_clean_choices (GdaExQueryEditor *qe);
+
 const gchar *gdaex_query_editor_get_sql (GdaExQueryEditor *qe);
 
 xmlNode *gdaex_query_editor_get_sql_as_xml (GdaExQueryEditor *qe);
index c709babec59d05a83dbcc1b49411d29b2b170ba7..60a0d89995ec0ab7dc5781a524d92c2dffe2ae3d 100644 (file)
 #include <gdaex.h>
 #include <queryeditor.h>
 
+GtkWidget *w;
+
+on_btn_clean_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       gdaex_query_editor_clean_choices ((GdaExQueryEditor *)user_data);
+}
+
+on_btn_get_sql_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       xmlDoc *doc;
+       xmlNode *node;
+       xmlChar *buf;
+       gint size;
+
+       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (w),
+                                                GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                GTK_MESSAGE_INFO,
+                                                GTK_BUTTONS_OK,
+                                                gdaex_query_editor_get_sql ((GdaExQueryEditor *)user_data));
+       gtk_dialog_run (GTK_DIALOG (dialog));
+       gtk_widget_destroy (dialog);;
+
+       doc = xmlNewDoc ("1.0");
+       node = gdaex_query_editor_get_sql_as_xml ((GdaExQueryEditor *)user_data);
+       xmlDocSetRootElement (doc, node);
+       xmlDocDumpMemory (doc, &buf, &size);
+
+       dialog = gtk_message_dialog_new (GTK_WINDOW (w),
+                                                GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                GTK_MESSAGE_INFO,
+                                                GTK_BUTTONS_OK,
+                                                buf);
+       gtk_dialog_run (GTK_DIALOG (dialog));
+       gtk_widget_destroy (dialog);;
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -31,11 +69,16 @@ main (int argc, char *argv[])
 
        GdaExQueryEditorField *field;
 
-       GtkWidget *dialog;
+       GtkWidget *vbox;
+       GtkWidget *widget_qe;
+       GtkWidget *hbtnbox;
+       GtkWidget *btn_clean;
+       GtkWidget *btn_get_sql;
+       GtkWidget *btn_ok;
 
        gtk_init (&argc, &argv);
 
-       gdaex =         gdaex = gdaex_new_from_string (g_strdup_printf ("SQLite://DB_DIR=%s;DB_NAME=test_prefix.db", TESTSDIR));
+       gdaex = gdaex_new_from_string (g_strdup_printf ("SQLite://DB_DIR=%s;DB_NAME=test_prefix.db", TESTSDIR));
        if (gdaex == NULL)
                {
                        g_error ("Error on GdaEx initialization.");
@@ -123,22 +166,42 @@ main (int argc, char *argv[])
        gdaex_query_editor_table_add_field (qe, "clients", *field);
        g_free (field);
 
-       dialog = gdaex_query_editor_get_dialog (qe);
-       gtk_dialog_run (GTK_DIALOG (dialog));
-       gtk_widget_destroy (dialog);
+       w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+       gtk_window_set_default_size (GTK_WINDOW (w), 610, 400);
+       gtk_window_set_modal (GTK_WINDOW (w), TRUE);
+       gtk_window_set_position (GTK_WINDOW (w), GTK_WIN_POS_CENTER);
+       g_signal_connect (G_OBJECT (w), "delete-event",
+                         gtk_main_quit, NULL);
 
-       g_message (gdaex_query_editor_get_sql (qe));
+       vbox = gtk_vbox_new (FALSE, 5);
+       gtk_container_add (GTK_CONTAINER (w), vbox);
 
-       xmlDoc *doc;
-       xmlNode *node;
-       xmlChar *buf;
-       gint size;
+       widget_qe = gdaex_query_editor_get_widget (qe);
+       gtk_box_pack_start (GTK_BOX (vbox), widget_qe, TRUE, TRUE, 5);
 
-       doc = xmlNewDoc ("1.0");
-       node = gdaex_query_editor_get_sql_as_xml (qe);
-       xmlDocSetRootElement (doc, node);
-       xmlDocDumpMemory (doc, &buf, &size);
-       g_message (buf);
+       hbtnbox = gtk_hbutton_box_new ();
+       gtk_button_box_set_layout (GTK_BUTTON_BOX (hbtnbox), GTK_BUTTONBOX_END);
+       gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbtnbox), 5);
+       gtk_box_pack_start (GTK_BOX (vbox), hbtnbox, FALSE, FALSE, 5);
+
+       btn_clean = gtk_button_new_from_stock ("gtk-clear");
+       gtk_box_pack_start (GTK_BOX (hbtnbox), btn_clean, TRUE, TRUE, 5);
+       g_signal_connect (G_OBJECT (btn_clean), "clicked",
+                         G_CALLBACK (on_btn_clean_clicked), qe);
+
+       btn_get_sql = gtk_button_new_with_mnemonic ("Get _Sql");
+       gtk_box_pack_start (GTK_BOX (hbtnbox), btn_get_sql, TRUE, TRUE, 5);
+       g_signal_connect (G_OBJECT (btn_get_sql), "clicked",
+                         G_CALLBACK (on_btn_get_sql_clicked), qe);
+
+       btn_ok = gtk_button_new_from_stock ("gtk-close");
+       gtk_box_pack_start (GTK_BOX (hbtnbox), btn_ok, TRUE, TRUE, 5);
+       g_signal_connect (G_OBJECT (btn_ok), "clicked",
+                         gtk_main_quit, NULL);
+
+       gtk_widget_show_all (w);
+
+       gtk_main ();
 
        return 0;
 }