]> git.sur5r.net Git - glabels/commitdiff
Yet another new "New Label Dialog"
authorJim Evins <evins@snaught.com>
Sun, 21 Mar 2010 05:14:35 +0000 (01:14 -0400)
committerJim Evins <evins@snaught.com>
Sun, 21 Mar 2010 05:19:58 +0000 (01:19 -0400)
Re-designed the "New label dialog" again.  This time as a "wizard" or
GtkAssistant.  This is an attempt to keep the easy navigation of the
2.2.x dialog, to keep the added meta data and preview of the latest
incarnation, and to maintain a compact dialog that should work on fairly
small displays such on netbooks (probably not hand-helds still).

18 files changed:
data/builder/Makefile.am
data/builder/media-select.builder [new file with mode: 0644]
data/builder/new-label-dialog.builder
po/POTFILES.in
src/Makefile.am
src/file.c
src/media-combo-menu-item.c [deleted file]
src/media-combo-menu-item.h [deleted file]
src/media-combo-menu.c [deleted file]
src/media-combo-menu.h [deleted file]
src/media-combo.c [deleted file]
src/media-combo.h [deleted file]
src/media-select.c [new file with mode: 0644]
src/media-select.h [new file with mode: 0644]
src/new-label-dialog.c
src/new-label-dialog.h
src/rotate-label-button.c [deleted file]
src/rotate-label-button.h [deleted file]

index 4b48a699dea6ddab9df4b64ea8c8e5a212378dfd..1c8744d6efb3d57e59122374e393d9fc25ce936c 100644 (file)
@@ -5,6 +5,7 @@ builderdir = $(datadir)/$(GLABELS_BRANCH)/builder/
 builder_DATA = \
        property-bar.builder            \
        print-op-dialog-custom-widget.builder   \
+       media-select.builder    \
        new-label-dialog.builder        \
        merge-properties-dialog.builder \
        template-designer.builder       \
diff --git a/data/builder/media-select.builder b/data/builder/media-select.builder
new file mode 100644 (file)
index 0000000..9cb814f
--- /dev/null
@@ -0,0 +1,229 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkWindow" id="window1">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">window1</property>
+    <child>
+      <object class="GtkHBox" id="media_select_hbox">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkNotebook" id="notebook">
+            <property name="visible">True</property>
+            <property name="tab_hborder">0</property>
+            <child>
+              <object class="GtkVBox" id="recent_tab_vbox">
+                <property name="height_request">320</property>
+                <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkVBox" id="recent_info_vbox">
+                    <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <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">in</property>
+                    <child>
+                      <object class="GtkTreeView" id="recent_treeview">
+                        <property name="visible">True</property>
+                        <property name="headers_visible">False</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="recent_tab_label">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Recent templates</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="search_all_tab_vbox">
+                <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkHBox" id="hbox6">
+                    <property name="visible">True</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <object class="GtkHBox" id="hbox9">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label14">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Brand:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBox" id="brand_combo">
+                            <property name="visible">True</property>
+                            <property name="focus_on_click">False</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHBox" id="hbox7">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label12">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Page size:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBox" id="page_size_combo">
+                            <property name="visible">True</property>
+                            <property name="focus_on_click">False</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHBox" id="hbox8">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label13">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Category:</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBox" id="category_combo">
+                            <property name="visible">True</property>
+                            <property name="focus_on_click">False</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="padding">6</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkVBox" id="search_all_info_vbox">
+                    <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                    <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">in</property>
+                    <child>
+                      <object class="GtkTreeView" id="search_all_treeview">
+                        <property name="visible">True</property>
+                        <property name="headers_visible">False</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="search_all_tabLlabel">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Search all templates</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
index e5914100d0b1ec3db0797edbe343afcdf1e0b6e1..9f3f5d07a4fd25cba8e4f2ac3ece854124bdd3b0 100644 (file)
         <property name="border_width">6</property>
         <property name="spacing">18</property>
         <child>
-          <object class="GtkVBox" id="vbox1">
+          <object class="GtkNotebook" id="notebook2">
             <property name="visible">True</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
+            <property name="can_focus">True</property>
             <child>
-              <object class="GtkFrame" id="frame1">
+              <object class="GtkVBox" id="template_page_vbox">
                 <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="label19">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Choose label or card product from hundreds of predefined templates.  You may also
+define your own templates.</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="combo_hbox">
+                    <property name="visible">True</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label6">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">page 1</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="rotate_page_vbox">
+                <property name="visible">True</property>
+                <property name="border_width">6</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="label10">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Select orientation of label content.</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
                 <child>
-                  <object class="GtkAlignment" id="alignment1">
+                  <object class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
-                    <property name="left_padding">12</property>
+                    <property name="homogeneous">True</property>
                     <child>
-                      <object class="GtkTable" id="table2">
+                      <object class="GtkVBox" id="vbox1">
                         <property name="visible">True</property>
-                        <property name="n_rows">2</property>
-                        <property name="n_columns">2</property>
-                        <property name="column_spacing">12</property>
-                        <property name="row_spacing">6</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkLabel" id="label6">
+                          <object class="GtkHBox" id="normal_preview_hbox">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Template:</property>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
-                            <property name="x_options">GTK_FILL</property>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkHBox" id="combo_hbox">
+                          <object class="GtkHBox" id="hbox4">
                             <property name="visible">True</property>
                             <child>
-                              <placeholder/>
+                              <object class="GtkRadioButton" id="normal_radio">
+                                <property name="label" translatable="yes">Normal</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                              <packing>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
                             </child>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
+                            <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="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkVBox" id="vbox2">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkLabel" id="label12">
+                          <object class="GtkHBox" id="rotated_preview_hbox">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="label" translatable="yes">Orientation:</property>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkHBox" id="rotate_hbox">
+                          <object class="GtkHBox" id="hbox5">
                             <property name="visible">True</property>
                             <child>
-                              <placeholder/>
+                              <object class="GtkRadioButton" id="rotated_radio">
+                                <property name="label" translatable="yes">Rotated</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">normal_radio</property>
+                              </object>
+                              <packing>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
                             </child>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options">GTK_FILL</property>
+                            <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="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
                     </child>
                   </object>
-                </child>
-                <child type="label">
-                  <object class="GtkLabel" id="label9">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Select media&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </object>
+                  <packing>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
                 </child>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
-            <child>
-              <placeholder/>
-            </child>
-          </object>
-          <packing>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkNotebook" id="notebook1">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <child>
-              <object class="GtkVBox" id="preview_vbox">
-                <property name="visible">True</property>
-                <property name="border_width">3</property>
-                <property name="orientation">vertical</property>
-                <child>
-                  <placeholder/>
-                </child>
-              </object>
-            </child>
             <child type="tab">
-              <object class="GtkLabel" id="label13">
+              <object class="GtkLabel" id="label9">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Preview</property>
+                <property name="label" translatable="yes">page 2</property>
               </object>
               <packing>
+                <property name="position">1</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="vbox2">
+              <object class="GtkVBox" id="confirm_page_vbox">
                 <property name="visible">True</property>
-                <property name="border_width">9</property>
+                <property name="border_width">6</property>
                 <property name="orientation">vertical</property>
+                <property name="spacing">12</property>
                 <child>
-                  <object class="GtkTable" id="table1">
+                  <object class="GtkLabel" id="label11">
                     <property name="visible">True</property>
-                    <property name="n_rows">7</property>
-                    <property name="n_columns">2</property>
-                    <property name="column_spacing">12</property>
-                    <property name="row_spacing">6</property>
-                    <child>
-                      <object class="GtkLabel" id="label1">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Description:</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label2">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Page size:</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label3">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Label size:</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label4">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Layout:</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">5</property>
-                        <property name="bottom_attach">6</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label7">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="yalign">0</property>
-                        <property name="label" translatable="yes">Similar products:</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">6</property>
-                        <property name="bottom_attach">7</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="desc_label">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="page_size_label">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label_size_label">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="layout_label">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">5</property>
-                        <property name="bottom_attach">6</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="vendor_label">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label8">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Part #:</property>
-                      </object>
-                      <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Please review and confirm your selection.</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox3">
+                    <property name="visible">True</property>
+                    <property name="spacing">24</property>
                     <child>
-                      <object class="GtkLabel" id="part_label">
+                      <object class="GtkVBox" id="vbox3">
                         <property name="visible">True</property>
-                        <property name="xalign">0</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkVBox" id="preview_vbox">
+                            <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkScrolledWindow" id="scrolledwindow1">
-                        <property name="height_request">77</property>
+                      <object class="GtkTable" id="table1">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">never</property>
-                        <property name="vscrollbar_policy">automatic</property>
-                        <property name="shadow_type">in</property>
+                        <property name="n_rows">7</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">12</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label1">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Description:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Page size:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Label size:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
                         <child>
-                          <object class="GtkViewport" id="viewport1">
+                          <object class="GtkLabel" id="label4">
                             <property name="visible">True</property>
-                            <property name="resize_mode">queue</property>
-                            <property name="shadow_type">none</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Layout:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label7">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
+                            <property name="label" translatable="yes">Similar products:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">6</property>
+                            <property name="bottom_attach">7</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="desc_label">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="page_size_label">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label_size_label">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="layout_label">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="vendor_label">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label8">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Part #:</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="part_label">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="y_options"></property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkScrolledWindow" id="scrolledwindow1">
+                            <property name="height_request">77</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hscrollbar_policy">never</property>
+                            <property name="vscrollbar_policy">automatic</property>
                             <child>
-                              <object class="GtkLabel" id="similar_label">
+                              <object class="GtkViewport" id="viewport1">
                                 <property name="visible">True</property>
-                                <property name="xalign">0</property>
-                                <property name="yalign">0</property>
-                                <property name="label" translatable="yes">1
+                                <property name="resize_mode">queue</property>
+                                <property name="shadow_type">etched-in</property>
+                                <child>
+                                  <object class="GtkLabel" id="similar_label">
+                                    <property name="visible">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="yalign">0</property>
+                                    <property name="label" translatable="yes">1
 2
 3
 4</property>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                           </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">6</property>
+                            <property name="bottom_attach">7</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label5">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Vendor:</property>
+                          </object>
+                          <packing>
+                            <property name="x_options">GTK_FILL</property>
+                            <property name="y_options"></property>
+                          </packing>
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">6</property>
-                        <property name="bottom_attach">7</property>
-                        <property name="y_options"></property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="label5">
-                        <property name="visible">True</property>
-                        <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Vendor:</property>
-                      </object>
-                      <packing>
-                        <property name="x_options">GTK_FILL</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="label14">
+              <object class="GtkLabel" id="label18">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Information</property>
+                <property name="label" translatable="yes">page 3</property>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="position">2</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child type="tab">
-              <placeholder/>
-            </child>
           </object>
           <packing>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
index 1c35ca9a212381c7b9a31eb4eb27bd9a8cd60f59..24ce7cda4e3c5d2b7aa91d9c1273ff047b1e03ac 100644 (file)
@@ -81,12 +81,8 @@ src/label-text.c
 src/label-text.h
 #src/marshal.c
 #src/marshal.h
-src/media-combo.c
-src/media-combo.h
-src/media-combo-menu.c
-src/media-combo-menu.h
-src/media-combo-menu-item.c
-src/media-combo-menu-item.h
+src/media-select.c
+src/media-select.h
 src/merge.c
 src/merge.h
 src/merge-evolution.c
@@ -141,8 +137,6 @@ src/message-bar.c
 src/message-bar.h
 src/recent.c
 src/recent.h
-src/rotate-label-button.c
-src/rotate-label-button.h
 src/stock.c
 src/stock.h
 src/str-util.c
index 49e6e0ef26952712584dc4fa5346fe359005ec6b..9c9f5f1524d917e6013ec793b6bc5ce9ec7f1b0a 100644 (file)
@@ -162,12 +162,8 @@ glabels_3_SOURCES =                        \
        mini-preview-pixbuf.h           \
        mini-preview-pixbuf-cache.c     \
        mini-preview-pixbuf-cache.h     \
-       media-combo.c                   \
-       media-combo.h                   \
-       media-combo-menu.c              \
-       media-combo-menu.h              \
-       media-combo-menu-item.c         \
-       media-combo-menu-item.h         \
+       media-select.c                  \
+       media-select.h                  \
        message-bar.c                   \
        message-bar.h                   \
        template-history.c              \
@@ -178,8 +174,6 @@ glabels_3_SOURCES =                         \
        mini-preview.h                  \
        mini-label-preview.c            \
        mini-label-preview.h            \
-       rotate-label-button.c           \
-       rotate-label-button.h           \
        wdgt-chain-button.c             \
        wdgt-chain-button.h             \
        field-button.c                  \
index ca04e5fd0645186ba19f0464edbd0c30bdd117f1..2b49053586006110356ee09f568c388c43d6d3aa 100644 (file)
@@ -54,12 +54,10 @@ static gchar *save_path = NULL;
 /*===========================================*/
 /* Local function prototypes.                */
 /*===========================================*/
-static void new_response                     (GtkDialog         *dialog,
-                                             gint               response,
+static void new_complete                     (GtkDialog         *dialog,
                                              gpointer           user_data);
 
-static void properties_response              (GtkDialog         *dialog,
-                                             gint               response,
+static void properties_complete              (GtkDialog         *dialog,
                                              gpointer           user_data);
 
 static void open_response                    (GtkDialog         *chooser,
@@ -87,8 +85,7 @@ gl_file_new (glWindow  *window)
 
        g_object_set_data (G_OBJECT (dialog), "parent_window", window);
 
-       g_signal_connect (G_OBJECT(dialog), "response",
-                         G_CALLBACK (new_response), dialog);
+       g_signal_connect (G_OBJECT(dialog), "complete", G_CALLBACK (new_complete), dialog);
 
        if (page_size != NULL) {
                gl_new_label_dialog_set_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
@@ -112,8 +109,7 @@ gl_file_new (glWindow  *window)
 /* PRIVATE.  New "ok" button callback.                                       */
 /*---------------------------------------------------------------------------*/
 static void
-new_response (GtkDialog *dialog,
-             gint       response,
+new_complete (GtkDialog *dialog,
              gpointer   user_data)
 {
        lglTemplate *template;
@@ -123,48 +119,38 @@ new_response (GtkDialog *dialog,
 
        gl_debug (DEBUG_FILE, "START");
 
-       switch (response) {
-
-       case GTK_RESPONSE_OK:
+        gl_new_label_dialog_get_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
+                                                   &page_size,
+                                                   &category);
 
-               gl_new_label_dialog_get_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
-                                                           &page_size,
-                                                           &category);
+        if (sheet_name != NULL)
+        {
+                g_free (sheet_name);
+        }
 
-               if (sheet_name != NULL)
-                       g_free (sheet_name);
-               sheet_name =
-                       gl_new_label_dialog_get_template_name (GL_NEW_LABEL_DIALOG (dialog));
+        sheet_name = gl_new_label_dialog_get_template_name (GL_NEW_LABEL_DIALOG (dialog));
 
-               rotate_flag =
-                       gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog));
+        rotate_flag = gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog));
 
-               template = lgl_db_lookup_template_from_name (sheet_name);
+        template = lgl_db_lookup_template_from_name (sheet_name);
 
-               label = GL_LABEL(gl_label_new ());
-               gl_label_set_template (label, template, FALSE);
-               gl_label_set_rotate_flag (label, rotate_flag, FALSE);
+        label = GL_LABEL(gl_label_new ());
+        gl_label_set_template (label, template, FALSE);
+        gl_label_set_rotate_flag (label, rotate_flag, FALSE);
 
-               lgl_template_free (template);
+        lgl_template_free (template);
 
-               window =
-                       GL_WINDOW (g_object_get_data (G_OBJECT (dialog),
-                                                     "parent_window"));
-               if ( gl_window_is_empty (window) ) {
-                       gl_window_set_label (window, label);
-               } else {
-                       new_window = gl_window_new_from_label (label);
-                       gtk_widget_show_all (new_window);
-               }
+        window = GL_WINDOW (g_object_get_data (G_OBJECT (dialog), "parent_window"));
+        if ( gl_window_is_empty (window) )
+        {
+                gl_window_set_label (window, label);
+        }
+        else
+        {
+                new_window = gl_window_new_from_label (label);
+                gtk_widget_show_all (new_window);
+        }
                
-               break;
-
-       default:
-               break;
-       }
-
-       gtk_widget_destroy (GTK_WIDGET (dialog));
-
        gl_debug (DEBUG_FILE, "END");
 }
 
@@ -191,8 +177,7 @@ gl_file_properties (glLabel   *label,
 
        g_object_set_data (G_OBJECT (dialog), "label", label);
 
-       g_signal_connect (G_OBJECT(dialog), "response",
-                         G_CALLBACK (properties_response), dialog);
+       g_signal_connect (G_OBJECT(dialog), "complete", G_CALLBACK (properties_complete), dialog);
 
         template    = gl_label_get_template (label);
         rotate_flag = gl_label_get_rotate_flag (label);
@@ -221,45 +206,33 @@ gl_file_properties (glLabel   *label,
 /* PRIVATE.  Properties "ok" button callback.                                */
 /*---------------------------------------------------------------------------*/
 static void
-properties_response (GtkDialog *dialog,
-             gint       response,
-             gpointer   user_data)
+properties_complete (GtkDialog *dialog,
+                     gpointer   user_data)
 {
        lglTemplate *template;
        glLabel     *label;
 
        gl_debug (DEBUG_FILE, "START");
 
-       switch (response) {
-
-       case GTK_RESPONSE_OK:
-
-               gl_new_label_dialog_get_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
-                                                           &page_size,
-                                                           &category);
+        gl_new_label_dialog_get_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
+                                                   &page_size,
+                                                   &category);
 
-               if (sheet_name != NULL)
-                       g_free (sheet_name);
-               sheet_name =
-                       gl_new_label_dialog_get_template_name (GL_NEW_LABEL_DIALOG (dialog));
-
-               rotate_flag =
-                       gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog));
-
-               template = lgl_db_lookup_template_from_name (sheet_name);
+        if (sheet_name != NULL)
+        {
+                g_free (sheet_name);
+        }
 
-                label = GL_LABEL(g_object_get_data (G_OBJECT (dialog), "label"));
+        sheet_name = gl_new_label_dialog_get_template_name (GL_NEW_LABEL_DIALOG (dialog));
 
-                gl_label_set_template (label, template, TRUE);
-                gl_label_set_rotate_flag (label, rotate_flag, TRUE);
+        rotate_flag = gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog));
 
-               break;
+        template = lgl_db_lookup_template_from_name (sheet_name);
 
-       default:
-               break;
-       }
+        label = GL_LABEL(g_object_get_data (G_OBJECT (dialog), "label"));
 
-       gtk_widget_destroy (GTK_WIDGET (dialog));
+        gl_label_set_template (label, template, TRUE);
+        gl_label_set_rotate_flag (label, rotate_flag, TRUE);
 
        gl_debug (DEBUG_FILE, "END");
 }
diff --git a/src/media-combo-menu-item.c b/src/media-combo-menu-item.c
deleted file mode 100644 (file)
index 0c3225f..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- *  media-combo-menu-item.c
- *  Copyright (C) 2010  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include "media-combo-menu-item.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include <libglabels/libglabels.h>
-#include "mini-preview-pixbuf-cache.h"
-#include "prefs.h"
-#include "str-util.h"
-#include "marshal.h"
-
-
-
-/*===========================================*/
-/* Private macros and constants.             */
-/*===========================================*/
-
-
-/*===========================================*/
-/* Private types                             */
-/*===========================================*/
-
-struct _glMediaComboMenuItemPrivate {
-
-        gchar *name;
-
-};
-
-
-/*===========================================*/
-/* Private globals                           */
-/*===========================================*/
-
-
-/*===========================================*/
-/* Local function prototypes                 */
-/*===========================================*/
-
-static void   gl_media_combo_menu_item_finalize    (GObject                *object);
-
-
-/****************************************************************************/
-/* Boilerplate Object stuff.                                                */
-/****************************************************************************/
-G_DEFINE_TYPE (glMediaComboMenuItem, gl_media_combo_menu_item, GTK_TYPE_MENU_ITEM);
-
-
-/*****************************************************************************/
-/* Class Init Function.                                                      */
-/*****************************************************************************/
-static void
-gl_media_combo_menu_item_class_init (glMediaComboMenuItemClass *class)
-{
-       GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
-
-        gl_media_combo_menu_item_parent_class = g_type_class_peek_parent (class);
-
-       gobject_class->finalize = gl_media_combo_menu_item_finalize;
-}
-
-
-/*****************************************************************************/
-/* Object Instance Init Function.                                            */
-/*****************************************************************************/
-static void
-gl_media_combo_menu_item_init (glMediaComboMenuItem *this)
-{
-       this->priv = g_new0 (glMediaComboMenuItemPrivate, 1);
-}
-
-
-/*****************************************************************************/
-/* Finalize Method.                                                          */
-/*****************************************************************************/
-static void
-gl_media_combo_menu_item_finalize (GObject *object)
-{
-       glMediaComboMenuItem *this = GL_MEDIA_COMBO_MENU_ITEM (object);
-
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (GL_IS_MEDIA_COMBO_MENU_ITEM (object));
-
-        g_free (this->priv->name);
-       g_free (this->priv);
-
-       G_OBJECT_CLASS (gl_media_combo_menu_item_parent_class)->finalize (object);
-}
-
-
-/*****************************************************************************/
-/** New Object Generator.                                                    */
-/*****************************************************************************/
-GtkWidget *
-gl_media_combo_menu_item_new (gchar *name)
-{
-       glMediaComboMenuItem *this;
-        GtkWidget            *hbox;
-        GtkWidget            *preview;
-        GtkWidget            *label;
-        GdkPixbuf            *pixbuf;
-        lglTemplate          *template;
-        lglTemplateFrame     *frame;
-        gchar                *size_string;
-        gchar                *layout_string;
-        gchar                *label_markup;
-
-       this = g_object_new (GL_TYPE_MEDIA_COMBO_MENU_ITEM, NULL);
-
-        this->priv->name = g_strdup (name);
-
-        hbox = gtk_hbox_new (FALSE, 6);
-        gtk_container_add (GTK_CONTAINER (this), hbox);
-
-        pixbuf = gl_mini_preview_pixbuf_cache_get_pixbuf (name);
-        preview = gtk_image_new_from_pixbuf (pixbuf);
-        gtk_box_pack_start (GTK_BOX (hbox), preview, FALSE, FALSE, 0);
-        g_object_unref (G_OBJECT (pixbuf));
-
-        template      = lgl_db_lookup_template_from_name (name);
-        frame         = (lglTemplateFrame *)template->frames->data;
-        size_string   = lgl_template_frame_get_size_description (frame, gl_prefs_model_get_units (gl_prefs));
-        layout_string = lgl_template_frame_get_layout_description (frame);
-        label_markup  = g_strdup_printf ("<b>%s: %s</b>\n%s\n%s",
-                                         name, template->description, size_string, layout_string);
-        g_free (size_string);
-        g_free (layout_string);
-        lgl_template_free (template);
-
-        label = gtk_label_new (NULL);
-        gtk_label_set_markup (GTK_LABEL (label), label_markup);
-        g_free (label_markup);
-        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
-       return GTK_WIDGET (this);
-}
-
-
-/*****************************************************************************/
-/* Get family.                                                               */
-/*****************************************************************************/
-gchar *
-gl_media_combo_menu_item_get_name (glMediaComboMenuItem *this)
-{
-        return g_strdup (this->priv->name);
-}
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
diff --git a/src/media-combo-menu-item.h b/src/media-combo-menu-item.h
deleted file mode 100644 (file)
index 4aa6ad4..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  media-combo-menu-item.h
- *  Copyright (C) 2010  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __MEDIA_COMBO_MENU_ITEM_H__
-#define __MEDIA_COMBO_MENU_ITEM_H__
-
-
-#include <gtk/gtk.h>
-
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_MEDIA_COMBO_MENU_ITEM (gl_media_combo_menu_item_get_type ())
-#define GL_MEDIA_COMBO_MENU_ITEM(obj) \
-        (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_MEDIA_COMBO_MENU_ITEM, glMediaComboMenuItem ))
-#define GL_MEDIA_COMBO_MENU_ITEM_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_MEDIA_COMBO_MENU_ITEM, glMediaComboMenuItemClass))
-#define GL_IS_MEDIA_COMBO_MENU_ITEM(obj) \
-        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_MEDIA_COMBO_MENU_ITEM))
-#define GL_IS_MEDIA_COMBO_MENU_ITEM_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_MEDIA_COMBO_MENU_ITEM))
-
-typedef struct _glMediaComboMenuItem        glMediaComboMenuItem;
-typedef struct _glMediaComboMenuItemPrivate glMediaComboMenuItemPrivate;
-typedef struct _glMediaComboMenuItemClass   glMediaComboMenuItemClass;
-
-struct _glMediaComboMenuItem {
-       GtkMenuItem            parent_widget;
-
-       glMediaComboMenuItemPrivate *priv;
-};
-
-struct _glMediaComboMenuItemClass {
-       GtkMenuItemClass       parent_class;
-};
-
-
-GType      gl_media_combo_menu_item_get_type   (void) G_GNUC_CONST;
-
-GtkWidget *gl_media_combo_menu_item_new        (gchar                *name);
-
-gchar     *gl_media_combo_menu_item_get_name   (glMediaComboMenuItem *this);
-
-
-G_END_DECLS
-
-#endif /* __MEDIA_COMBO_MENU_ITEM_H__ */
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
diff --git a/src/media-combo-menu.c b/src/media-combo-menu.c
deleted file mode 100644 (file)
index 4f117d5..0000000
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- *  media-combo-menu.c
- *  Copyright (C) 2010  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include "media-combo-menu.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include <libglabels/libglabels.h>
-#include "media-combo-menu-item.h"
-#include "template-history.h"
-#include "marshal.h"
-
-
-/*===========================================*/
-/* Private macros and constants.             */
-/*===========================================*/
-
-
-/*===========================================*/
-/* Private types                             */
-/*===========================================*/
-
-struct _glMediaComboMenuPrivate {
-
-        gchar     *media;
-
-        GtkWidget *recent_menu_item;
-        GtkWidget *recent_sub_menu;
-
-};
-
-enum {
-        MEDIA_CHANGED,
-        LAST_SIGNAL
-};
-
-
-/*===========================================*/
-/* Private globals                           */
-/*===========================================*/
-
-static guint signals[LAST_SIGNAL] = {0};
-
-
-/*===========================================*/
-/* Local function prototypes                 */
-/*===========================================*/
-
-static void       gl_media_combo_menu_finalize (GObject             *object);
-
-static void       menu_item_activate_cb        (glMediaComboMenuItem *item,
-                                                glMediaComboMenu     *this);
-
-static GtkWidget *new_brand_sub_menu           (glMediaComboMenu     *this,
-                                                const gchar          *paper_id,
-                                                const GList          *brand_list);
-
-static GtkWidget *new_part_sub_menu            (glMediaComboMenu     *this,
-                                                const GList          *part_list);
-
-static void       media_history_changed_cb     (glMediaComboMenu     *this);
-
-
-
-/****************************************************************************/
-/* Boilerplate Object stuff.                                                */
-/****************************************************************************/
-G_DEFINE_TYPE (glMediaComboMenu, gl_media_combo_menu, GTK_TYPE_MENU);
-
-
-/*****************************************************************************/
-/* Class Init Function.                                                      */
-/*****************************************************************************/
-static void
-gl_media_combo_menu_class_init (glMediaComboMenuClass *class)
-{
-       GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
-
-        gl_media_combo_menu_parent_class = g_type_class_peek_parent (class);
-
-       gobject_class->finalize = gl_media_combo_menu_finalize;
-
-        signals[MEDIA_CHANGED] =
-                g_signal_new ("media_changed",
-                              G_OBJECT_CLASS_TYPE (gobject_class),
-                              G_SIGNAL_RUN_LAST,
-                              G_STRUCT_OFFSET (glMediaComboMenuClass, media_changed),
-                              NULL, NULL,
-                              gl_marshal_VOID__VOID,
-                              G_TYPE_NONE, 0);
-}
-
-
-/*****************************************************************************/
-/* Object Instance Init Function.                                            */
-/*****************************************************************************/
-static void
-gl_media_combo_menu_init (glMediaComboMenu *this)
-{
-        GtkWidget    *menu_item;
-        GtkWidget    *sub_menu;
-        const GList  *list;
-        GList        *paper_id_list, *p_id;
-        gchar        *paper_id, *paper_name;
-        GList        *brand_list;
-
-       this->priv = g_new0 (glMediaComboMenuPrivate, 1);
-
-
-        menu_item = gtk_menu_item_new_with_label (_("Recent templates"));
-        gtk_menu_shell_append (GTK_MENU_SHELL (this), menu_item);
-
-        list = gl_template_history_model_get_name_list (gl_template_history);
-        sub_menu = new_part_sub_menu (this, list);
-        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), sub_menu);
-        gtk_widget_set_sensitive (menu_item, list != NULL);
-
-        this->priv->recent_menu_item = menu_item;
-        this->priv->recent_sub_menu  = sub_menu;
-
-        menu_item = gtk_separator_menu_item_new ();
-        gtk_menu_shell_append (GTK_MENU_SHELL (this), menu_item);
-
-        paper_id_list = lgl_db_get_paper_id_list ();
-
-        for ( p_id = paper_id_list; p_id; p_id = p_id->next )
-        {
-                paper_id = p_id->data;
-                paper_name = lgl_db_lookup_paper_name_from_id (paper_id);
-
-                brand_list = lgl_db_get_brand_list (paper_id, NULL);
-                if ( brand_list )
-                {
-                        menu_item = gtk_menu_item_new_with_label (paper_name);
-                        gtk_menu_shell_append (GTK_MENU_SHELL (this), menu_item);
-
-                        sub_menu = new_brand_sub_menu (this, paper_id, brand_list);
-                        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), sub_menu);
-                }
-                lgl_db_free_brand_list ( brand_list );
-        }
-
-        lgl_db_free_paper_id_list (paper_id_list);
-
-        g_signal_connect_swapped (gl_template_history, "changed",
-                                  G_CALLBACK (media_history_changed_cb), this);
-
-}
-
-
-/*****************************************************************************/
-/* Finalize Method.                                                          */
-/*****************************************************************************/
-static void
-gl_media_combo_menu_finalize (GObject *object)
-{
-       glMediaComboMenu *this = GL_MEDIA_COMBO_MENU (object);
-
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (GL_IS_MEDIA_COMBO_MENU (object));
-
-       g_free (this->priv);
-
-       G_OBJECT_CLASS (gl_media_combo_menu_parent_class)->finalize (object);
-}
-
-
-/*****************************************************************************/
-/** New Object Generator.                                                    */
-/*****************************************************************************/
-GtkWidget *
-gl_media_combo_menu_new (void)
-{
-       glMediaComboMenu *this;
-
-       this = g_object_new (gl_media_combo_menu_get_type (), NULL);
-
-       return GTK_WIDGET (this);
-}
-
-
-/*****************************************************************************/
-/* menu_item activate callback.                                              */
-/*****************************************************************************/
-static void menu_item_activate_cb (glMediaComboMenuItem *item,
-                                   glMediaComboMenu     *this)
-{
-        this->priv->media = gl_media_combo_menu_item_get_name (item);
-
-        g_signal_emit (this, signals[MEDIA_CHANGED], 0);
-
-        gtk_widget_hide (GTK_WIDGET (this));
-}
-
-
-/*****************************************************************************/
-/* Get media name.                                                           */
-/*****************************************************************************/
-gchar *
-gl_media_combo_menu_get_name (glMediaComboMenu *this)
-{
-        return g_strdup (this->priv->media);
-}
-
-
-/*****************************************************************************/
-/* Create a new brand sub menu from media list.                              */
-/*****************************************************************************/
-static GtkWidget *
-new_brand_sub_menu (glMediaComboMenu *this,
-                    const gchar      *paper_id,
-                    const GList      *brand_list)
-{
-        GtkWidget   *menu;
-        GtkWidget   *menu_item;
-        GtkWidget    *sub_menu;
-        GList       *p_brand;
-        gchar       *brand;
-        GList       *part_list;
-
-        menu = gtk_menu_new ();
-
-        for ( p_brand = (GList *)brand_list; p_brand; p_brand = p_brand->next )
-        {
-                brand = p_brand->data;
-
-                part_list = lgl_db_get_template_name_list_all (brand, paper_id, NULL);
-                if ( part_list )
-                {
-                        menu_item = gtk_menu_item_new_with_label (brand);
-                        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
-
-                        sub_menu = new_part_sub_menu (this, part_list);
-                        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), sub_menu);
-                }
-                lgl_db_free_brand_list ( part_list );
-        }
-
-        gtk_widget_show (menu);
-
-        return menu;
-}
-
-
-/*****************************************************************************/
-/* Create a new part sub menu from part list.                                */
-/*****************************************************************************/
-static GtkWidget *
-new_part_sub_menu (glMediaComboMenu *this,
-                   const GList      *part_list)
-{
-        GtkWidget   *menu;
-        GtkWidget   *menu_item;
-        GList       *p;
-
-        menu = gtk_menu_new ();
-
-        for ( p = (GList *)part_list; p != NULL; p = p->next )
-        {
-                menu_item = gl_media_combo_menu_item_new (p->data);
-                gtk_widget_show_all (menu_item);
-                gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
-                g_signal_connect (menu_item, "activate",
-                                  G_CALLBACK (menu_item_activate_cb), this);
-        }
-
-        gtk_widget_show (menu);
-        return menu;
-}
-
-
-/*****************************************************************************/
-/* Media history changed callback.                                           */
-/*****************************************************************************/
-static void
-media_history_changed_cb (glMediaComboMenu     *this)
-{
-        GList *list;
-
-        /*
-         * Remove old sub menu
-         */
-        gtk_menu_item_set_submenu (GTK_MENU_ITEM (this->priv->recent_menu_item),
-                                   NULL);
-
-        /*
-         * Build new sub menu
-         */
-        list = gl_template_history_model_get_name_list (gl_template_history);
-        this->priv->recent_sub_menu = new_part_sub_menu (this, list);
-
-        /*
-         * Attach to top-level menu item
-         */
-        gtk_menu_item_set_submenu (GTK_MENU_ITEM (this->priv->recent_menu_item),
-                                   this->priv->recent_sub_menu);
-        gtk_widget_set_sensitive (this->priv->recent_menu_item, list != NULL);
-
-        gl_template_history_model_free_name_list (list);
-}
-
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
diff --git a/src/media-combo-menu.h b/src/media-combo-menu.h
deleted file mode 100644 (file)
index 5c83e58..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *  media-combo-menu.h
- *  Copyright (C) 2010  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __MEDIA_COMBO_MENU_H__
-#define __MEDIA_COMBO_MENU_H__
-
-#include <gtk/gtk.h>
-
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_MEDIA_COMBO_MENU (gl_media_combo_menu_get_type ())
-#define GL_MEDIA_COMBO_MENU(obj) \
-        (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_MEDIA_COMBO_MENU, glMediaComboMenu ))
-#define GL_MEDIA_COMBO_MENU_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_MEDIA_COMBO_MENU, glMediaComboMenuClass))
-#define GL_IS_MEDIA_COMBO_MENU(obj) \
-        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_MEDIA_COMBO_MENU))
-#define GL_IS_MEDIA_COMBO_MENU_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_MEDIA_COMBO_MENU))
-
-typedef struct _glMediaComboMenu        glMediaComboMenu;
-typedef struct _glMediaComboMenuPrivate glMediaComboMenuPrivate;
-typedef struct _glMediaComboMenuClass   glMediaComboMenuClass;
-
-struct _glMediaComboMenu {
-       GtkMenu                  parent_widget;
-
-       glMediaComboMenuPrivate *priv;
-};
-
-struct _glMediaComboMenuClass {
-       GtkMenuClass             parent_class;
-
-        /*
-         * Signals
-         */
-        void (*media_changed) (glMediaComboMenu *object,
-                               gpointer          user_data);
-
-};
-
-
-GType      gl_media_combo_menu_get_type     (void) G_GNUC_CONST;
-
-GtkWidget *gl_media_combo_menu_new          (void);
-
-gchar     *gl_media_combo_menu_get_name     (glMediaComboMenu *this);
-
-
-G_END_DECLS
-
-
-#endif /* __MEDIA_COMBO_MENU_H__ */
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
-
diff --git a/src/media-combo.c b/src/media-combo.c
deleted file mode 100644 (file)
index 6c7104e..0000000
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- *  media-combo.c
- *  Copyright (C) 2010  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include "media-combo.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "media-combo-menu.h"
-#include "marshal.h"
-
-
-
-/*========================================================*/
-/* Private types.                                         */
-/*========================================================*/
-
-/** GL_MEDIA_COMBO Private fields */
-struct _glMediaComboPrivate {
-
-        gchar      *name;
-
-        GtkWidget  *label;
-
-        GtkWidget  *menu;
-};
-
-enum {
-        CHANGED,
-        LAST_SIGNAL
-};
-
-
-/*========================================================*/
-/* Private globals.                                       */
-/*========================================================*/
-
-static guint signals[LAST_SIGNAL] = {0};
-
-
-/*========================================================*/
-/* Private function prototypes.                           */
-/*========================================================*/
-
-static void gl_media_combo_finalize      (GObject             *object);
-
-static gboolean
-button_press_event_cb   (GtkWidget         *widget,
-                         GdkEventButton    *event,
-                         glMediaCombo      *this);
-
-static void
-menu_media_changed_cb   (glMediaComboMenu  *menu,
-                         glMediaCombo      *this);
-
-static void
-menu_selection_done_cb  (GtkMenuShell      *object,
-                         glMediaCombo      *this);
-
-
-/*****************************************************************************/
-/* Object infrastructure.                                                    */
-/*****************************************************************************/
-G_DEFINE_TYPE (glMediaCombo, gl_media_combo, GTK_TYPE_TOGGLE_BUTTON);
-
-
-/*****************************************************************************/
-/* Class Init Function.                                                      */
-/*****************************************************************************/
-static void
-gl_media_combo_class_init (glMediaComboClass *class)
-{
-        GObjectClass      *gobject_class = (GObjectClass *) class;
-
-        gl_media_combo_parent_class = g_type_class_peek_parent (class);
-
-        gobject_class->finalize = gl_media_combo_finalize;
-
-        signals[CHANGED] =
-                g_signal_new ("changed",
-                              G_OBJECT_CLASS_TYPE (gobject_class),
-                              G_SIGNAL_RUN_LAST,
-                              G_STRUCT_OFFSET (glMediaComboClass, changed),
-                              NULL, NULL,
-                              gl_marshal_VOID__VOID,
-                              G_TYPE_NONE, 0);
-}
-
-
-/*****************************************************************************/
-/* Object Instance Init Function.                                            */
-/*****************************************************************************/
-static void
-gl_media_combo_init (glMediaCombo *this)
-{
-        GtkWidget *hbox;
-        GtkWidget *arrow;
-
-        this->priv = g_new0 (glMediaComboPrivate, 1);
-
-        hbox = gtk_hbox_new (FALSE, 3);
-        gtk_container_add (GTK_CONTAINER (this), hbox);
-        
-        this->priv->label = gtk_label_new ("");
-        gtk_misc_set_alignment (GTK_MISC (this->priv->label), 0.0, 0.5);
-       gtk_widget_set_size_request (this->priv->label, 180, -1);
-        gtk_box_pack_start (GTK_BOX (hbox), this->priv->label, TRUE, TRUE, 0);
-
-        arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
-        gtk_box_pack_end (GTK_BOX (hbox), arrow, FALSE, FALSE, 0);
-
-        g_signal_connect (this, "button_press_event",
-                          G_CALLBACK(button_press_event_cb), this);
-}
-
-
-/*****************************************************************************/
-/* Finalize Method.                                                          */
-/*****************************************************************************/
-static void
-gl_media_combo_finalize (GObject *object)
-{
-        glMediaCombo    *this;
-
-        g_return_if_fail (object && IS_GL_MEDIA_COMBO (object));
-        this = GL_MEDIA_COMBO (object);
-
-        g_free (this->priv->name);
-        g_object_ref_sink (this->priv->menu);
-        g_free (this->priv);
-
-        G_OBJECT_CLASS (gl_media_combo_parent_class)->finalize (object);
-}
-
-
-/*****************************************************************************/
-/** New Object Generator.                                                    */
-/*****************************************************************************/
-GtkWidget *
-gl_media_combo_new (void)
-{
-        glMediaCombo  *this;
-
-        this = g_object_new (TYPE_GL_MEDIA_COMBO, NULL);
-
-        this->priv->menu = gl_media_combo_menu_new ();
-
-        gtk_widget_show_all (this->priv->menu);
-
-        g_signal_connect (this->priv->menu, "media_changed",
-                          G_CALLBACK (menu_media_changed_cb), this);
-        g_signal_connect (this->priv->menu, "selection_done",
-                          G_CALLBACK (menu_selection_done_cb), this);
-
-        return GTK_WIDGET (this);
-}
-
-
-/*****************************************************************************/
-/* Set media name.                                                           */
-/*****************************************************************************/
-void
-gl_media_combo_set_name (glMediaCombo  *this,
-                         const gchar   *name)
-{
-
-        g_free (this->priv->name);
-        this->priv->name = g_strdup (name);
-
-        gtk_label_set_text (GTK_LABEL (this->priv->label), this->priv->name);
-}
-
-
-/*****************************************************************************/
-/* Get media name.                                                           */
-/*****************************************************************************/
-gchar *
-gl_media_combo_get_name (glMediaCombo  *this)
-{
-        return g_strdup (this->priv->name);
-}
-
-
-/*****************************************************************************/
-/* Menu positioning function.                                                */
-/*****************************************************************************/
-static void
-menu_position_function (GtkMenu       *menu,
-                        gint          *x,
-                        gint          *y,
-                        gboolean      *push_in,
-                        glMediaCombo  *this)
-{
-        GdkScreen          *screen;
-        gint                w_screen, h_screen;
-        GdkWindow          *window;
-        gint                x_window, y_window;
-        GtkAllocation       allocation;
-        gint                x_this, y_this, h_this;
-        GtkRequisition      menu_requisition;
-        gint                h_menu, w_menu;
-
-        /*
-         * Screen size
-         */
-        screen = gtk_widget_get_screen (GTK_WIDGET (this));
-        w_screen = gdk_screen_get_width (screen);
-        h_screen = gdk_screen_get_height (screen);
-
-        /*
-         * Absolute position of "this" window on screen.
-         */
-        window = gtk_widget_get_window (GTK_WIDGET (this));
-        gdk_window_get_origin (window, &x_window, &y_window);
-
-        /*
-         *  Position and size of "this" inside window
-         */
-        gtk_widget_get_allocation (GTK_WIDGET (this), &allocation);
-        x_this = allocation.x;
-        y_this = allocation.y;
-        h_this = allocation.height;
-
-        /*
-         * Size of menu.
-         */
-        gtk_widget_size_request (this->priv->menu, &menu_requisition);
-        h_menu = menu_requisition.height;
-        w_menu = menu_requisition.width;
-
-        /*
-         * Default position anchored to lower left corner of "this".
-         */
-        *x = x_window + x_this;
-        *y = y_window + y_this + h_this;
-                
-        /*
-         * Adjust vertical position if menu if extends past bottom of screen.
-         */
-        if ( (*y + h_menu) > h_screen )
-        {
-                *y = y_window + y_this - h_menu;
-
-                if ( *y < 0 )
-                {
-                        *y = h_screen - h_menu;
-                }
-        }
-
-        /*
-         * Adjust horizontal position if menu if extends past edge of screen.
-         */
-        if ( (*x + w_menu) > w_screen )
-        {
-                *x = w_screen - w_menu;
-        }
-
-
-        *push_in = TRUE;
-}
-
-
-/*****************************************************************************/
-/* Button "button_press_event" callback.                                     */
-/*****************************************************************************/
-static gboolean
-button_press_event_cb (GtkWidget      *widget,
-                       GdkEventButton *event,
-                       glMediaCombo   *this)
-{
-        switch (event->button)
-        {
-
-        case 1:
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (this), TRUE);
-
-                gtk_menu_popup (GTK_MENU (this->priv->menu),
-                                NULL, NULL,
-                                (GtkMenuPositionFunc)menu_position_function, this,
-                                event->button, event->time);
-                break;
-
-        default:
-                break;
-
-        }
-
-        return FALSE;
-}
-
-
-/*****************************************************************************/
-/* Menu "media changed" callback.                                            */
-/*****************************************************************************/
-static void
-menu_media_changed_cb (glMediaComboMenu     *menu,
-                       glMediaCombo         *this)
-{
-        this->priv->name = gl_media_combo_menu_get_name (menu);
-
-        gtk_label_set_text (GTK_LABEL (this->priv->label), this->priv->name);
-
-        g_signal_emit (this, signals[CHANGED], 0);
-}
-
-
-/*****************************************************************************/
-/* Menu "selection done" callback.                                           */
-/*****************************************************************************/
-static void
-menu_selection_done_cb (GtkMenuShell         *object,
-                        glMediaCombo         *this)
-{
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (this), FALSE);
-}
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
diff --git a/src/media-combo.h b/src/media-combo.h
deleted file mode 100644 (file)
index c413d14..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  media-combo.h
- *  Copyright (C) 2009  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GL_MEDIA_COMBO_H__
-#define __GL_MEDIA_COMBO_H__
-
-
-#include <gtk/gtk.h>
-
-
-G_BEGIN_DECLS
-
-#define TYPE_GL_MEDIA_COMBO              (gl_media_combo_get_type ())
-#define GL_MEDIA_COMBO(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GL_MEDIA_COMBO, glMediaCombo))
-#define GL_MEDIA_COMBO_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GL_MEDIA_COMBO, glMediaComboClass))
-#define IS_GL_MEDIA_COMBO(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GL_MEDIA_COMBO))
-#define IS_GL_MEDIA_COMBO_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GL_MEDIA_COMBO))
-#define GL_MEDIA_COMBO_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), TYPE_GL_MEDIA_COMBO, glMediaComboClass))
-
-
-typedef struct _glMediaCombo          glMediaCombo;
-typedef struct _glMediaComboPrivate   glMediaComboPrivate;
-typedef struct _glMediaComboClass     glMediaComboClass;
-
-
-struct _glMediaCombo {
-        GtkToggleButton               parent;
-
-        glMediaComboPrivate          *priv;
-};
-
-struct _glMediaComboClass {
-        GtkToggleButtonClass          parent_class;
-
-        /*
-         * Signals
-         */
-        void (*changed) (glMediaCombo *object,
-                         gpointer     user_data);
-
-};
-
-
-GType            gl_media_combo_get_type          (void) G_GNUC_CONST;
-
-GtkWidget       *gl_media_combo_new               (void);
-
-void             gl_media_combo_set_name          (glMediaCombo   *this,
-                                                   const gchar    *name);
-
-gchar           *gl_media_combo_get_name          (glMediaCombo   *this);
-
-
-G_END_DECLS
-
-#endif /* __GL_COLOR_COMBO_H__ */
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
diff --git a/src/media-select.c b/src/media-select.c
new file mode 100644 (file)
index 0000000..ae7860a
--- /dev/null
@@ -0,0 +1,847 @@
+/*
+ *  media-select.c
+ *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "media-select.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <string.h>
+
+#include <libglabels.h>
+#include "mini-preview-pixbuf-cache.h"
+#include "prefs.h"
+#include "message-bar.h"
+#include "template-history.h"
+#include "str-util.h"
+#include "combo-util.h"
+#include "builder-util.h"
+#include "color.h"
+#include "marshal.h"
+
+#include "debug.h"
+
+
+#define HISTORY_SIZE 5
+
+/*===========================================*/
+/* Private types                             */
+/*===========================================*/
+
+enum {
+       NAME_COLUMN,
+       PREVIEW_COLUMN,
+       PREVIEW_COLUMN_STOCK,
+       PREVIEW_COLUMN_STOCK_SIZE,
+       DESCRIPTION_COLUMN,
+       N_COLUMNS
+};
+
+struct _glMediaSelectPrivate {
+
+        GtkBuilder   *builder;
+
+        GtkWidget    *notebook;
+        guint         current_page_num;
+
+        gint          recent_page_num;
+        GtkWidget    *recent_tab_vbox;
+        GtkWidget    *recent_info_vbox;
+        GtkWidget    *recent_info_bar;
+        GtkWidget    *recent_treeview;
+        GtkListStore *recent_store;
+
+        gint          search_all_page_num;
+        GtkWidget    *search_all_tab_vbox;
+        GtkWidget    *search_all_info_vbox;
+        GtkWidget    *search_all_info_bar;
+        GtkWidget    *brand_combo;
+        GtkWidget    *page_size_combo;
+        GtkWidget    *category_combo;
+        GtkWidget    *search_all_treeview;
+        GtkListStore *search_all_store;
+
+        /* Prevent recursion */
+       gboolean    stop_signals;
+};
+
+enum {
+        CHANGED,
+        LAST_SIGNAL
+};
+
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+static gint media_select_signals[LAST_SIGNAL] = { 0 };
+
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static void   gl_media_select_finalize   (GObject                *object);
+
+static void   gl_media_select_construct  (glMediaSelect          *this);
+
+static void   filter_changed_cb          (GtkComboBox            *combo,
+                                          gpointer                user_data);
+
+static void   selection_changed_cb       (GtkTreeSelection       *selection,
+                                          gpointer                user_data);
+
+static void   page_changed_cb            (GtkNotebook            *notebook,
+                                          GtkNotebookPage        *page,
+                                          guint                   page_num,
+                                          gpointer                user_data);
+
+static void   load_recent_list           (glMediaSelect          *this,
+                                          GtkListStore           *store,
+                                          GtkTreeSelection       *selection,
+                                          GList                  *list);
+
+static void   load_search_all_list       (glMediaSelect          *this,
+                                          GtkListStore           *store,
+                                          GtkTreeSelection       *selection,
+                                          GList                  *list);
+
+
+/****************************************************************************/
+/* Boilerplate Object stuff.                                                */
+/****************************************************************************/
+G_DEFINE_TYPE (glMediaSelect, gl_media_select, GTK_TYPE_VBOX);
+
+
+static void
+gl_media_select_class_init (glMediaSelectClass *class)
+{
+        GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        gl_media_select_parent_class = g_type_class_peek_parent (class);
+
+        object_class->finalize = gl_media_select_finalize;
+
+        media_select_signals[CHANGED] =
+            g_signal_new ("changed",
+                          G_OBJECT_CLASS_TYPE(object_class),
+                          G_SIGNAL_RUN_LAST,
+                          G_STRUCT_OFFSET (glMediaSelectClass, changed),
+                          NULL, NULL,
+                          gl_marshal_VOID__VOID,
+                          G_TYPE_NONE, 0);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+static void
+gl_media_select_init (glMediaSelect *this)
+{
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        this->priv = g_new0 (glMediaSelectPrivate, 1);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+static void
+gl_media_select_finalize (GObject *object)
+{
+        glMediaSelect *this = GL_MEDIA_SELECT (object);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GL_IS_MEDIA_SELECT (object));
+
+        if (this->priv->builder)
+        {
+                g_object_unref (this->priv->builder);
+        }
+        g_object_unref (this->priv->recent_store);
+        g_object_unref (this->priv->search_all_store);
+        g_free (this->priv);
+
+        G_OBJECT_CLASS (gl_media_select_parent_class)->finalize (object);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+GtkWidget *
+gl_media_select_new (void)
+{
+        glMediaSelect *this;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        this = g_object_new (gl_media_select_get_type (), NULL);
+
+        gl_media_select_construct (this);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+
+        return GTK_WIDGET (this);
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Construct composite widget.                                    */
+/*--------------------------------------------------------------------------*/
+static void
+gl_media_select_construct (glMediaSelect *this)
+{
+        gchar             *builder_filename;
+        GtkBuilder        *builder;
+        static gchar      *object_ids[] = { "media_select_hbox", NULL };
+        GError            *error = NULL;
+        GtkWidget         *hbox;
+        GList             *recent_list = NULL;
+        GList             *brands = NULL;
+        GList             *page_sizes = NULL;
+        GList             *categories = NULL;
+        GList             *search_all_names = NULL;
+        const gchar       *page_size_id;
+        gchar             *page_size_name;
+        GtkCellRenderer   *renderer;
+        GtkTreeViewColumn *column;
+        GtkTreeSelection  *recent_selection;
+        GtkTreeSelection  *search_all_selection;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        g_return_if_fail (GL_IS_MEDIA_SELECT (this));
+        g_return_if_fail (this->priv != NULL);
+
+        builder = gtk_builder_new ();
+        builder_filename = g_build_filename (GLABELS_DATA_DIR, "builder", "media-select.builder", NULL);
+        gtk_builder_add_objects_from_file (builder, builder_filename, object_ids, &error);
+        g_free (builder_filename);
+       if (error) {
+               g_critical ("%s\n\ngLabels may not be installed correctly!", error->message);
+                g_error_free (error);
+               return;
+       }
+
+        gl_builder_util_get_widgets (builder,
+                                     "media_select_hbox",      &hbox,
+                                     "notebook",               &this->priv->notebook,
+                                     "recent_tab_vbox",        &this->priv->recent_tab_vbox,
+                                     "recent_info_vbox",       &this->priv->recent_info_vbox,
+                                     "recent_treeview",        &this->priv->recent_treeview,
+                                     "search_all_tab_vbox",    &this->priv->search_all_tab_vbox,
+                                     "brand_combo",            &this->priv->brand_combo,
+                                     "page_size_combo",        &this->priv->page_size_combo,
+                                     "category_combo",         &this->priv->category_combo,
+                                     "search_all_info_vbox",   &this->priv->search_all_info_vbox,
+                                     "search_all_treeview",    &this->priv->search_all_treeview,
+                                     NULL);
+
+        gtk_container_add (GTK_CONTAINER (this), hbox);
+        this->priv->builder = builder;
+
+        this->priv->recent_page_num =
+                gtk_notebook_page_num (GTK_NOTEBOOK (this->priv->notebook),
+                                       this->priv->recent_tab_vbox);
+        this->priv->search_all_page_num =
+                gtk_notebook_page_num (GTK_NOTEBOOK (this->priv->notebook),
+                                       this->priv->search_all_tab_vbox);
+
+        gtk_widget_show_all (GTK_WIDGET (this));
+
+        /* Recent templates treeview */
+        this->priv->recent_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
+        gtk_tree_view_set_model (GTK_TREE_VIEW (this->priv->recent_treeview),
+                                 GTK_TREE_MODEL (this->priv->recent_store));
+        renderer = gtk_cell_renderer_pixbuf_new ();
+        column = gtk_tree_view_column_new_with_attributes ("", renderer,
+                                                           "pixbuf", PREVIEW_COLUMN,
+                                                           "stock-id", PREVIEW_COLUMN_STOCK,
+                                                           "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
+                                                           NULL);
+        gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->recent_treeview), column);
+        renderer = gtk_cell_renderer_text_new ();
+        column = gtk_tree_view_column_new_with_attributes ("", renderer,
+                                                           "markup", DESCRIPTION_COLUMN,
+                                                           NULL);
+        gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->recent_treeview), column);
+        recent_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->recent_treeview));
+        recent_list = gl_template_history_model_get_name_list (gl_template_history);
+        load_recent_list (this, this->priv->recent_store, recent_selection, recent_list);
+
+        page_size_id = gl_prefs_model_get_default_page_size (gl_prefs);
+        page_size_name = lgl_db_lookup_paper_name_from_id (page_size_id);
+
+        /* Brand selection control */
+        gl_combo_util_add_text_model (GTK_COMBO_BOX (this->priv->brand_combo));
+        brands = lgl_db_get_brand_list (NULL, NULL);
+        brands = g_list_prepend (brands, g_strdup (_("Any")));
+        gl_combo_util_set_strings (GTK_COMBO_BOX (this->priv->brand_combo), brands);
+        lgl_db_free_brand_list (brands);
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->brand_combo),
+                                       _("Any"));
+
+        /* Page size selection control */
+        gl_combo_util_add_text_model (GTK_COMBO_BOX (this->priv->page_size_combo));
+        page_sizes = lgl_db_get_paper_name_list ();
+        page_sizes = g_list_prepend (page_sizes, g_strdup (_("Any")));
+        gl_combo_util_set_strings (GTK_COMBO_BOX (this->priv->page_size_combo), page_sizes);
+        lgl_db_free_paper_name_list (page_sizes);
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->page_size_combo),
+                                       page_size_name);
+
+        /* Category selection control */
+        gl_combo_util_add_text_model (GTK_COMBO_BOX (this->priv->category_combo));
+        categories = lgl_db_get_category_name_list ();
+        categories = g_list_prepend (categories, g_strdup (_("Any")));
+        gl_combo_util_set_strings (GTK_COMBO_BOX (this->priv->category_combo), categories);
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->category_combo),
+                                       _("Any"));
+        lgl_db_free_category_name_list (categories);
+
+        /* Search all treeview */
+        this->priv->search_all_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
+        gtk_tree_view_set_model (GTK_TREE_VIEW (this->priv->search_all_treeview),
+                                 GTK_TREE_MODEL (this->priv->search_all_store));
+        renderer = gtk_cell_renderer_pixbuf_new ();
+        column = gtk_tree_view_column_new_with_attributes ("", renderer,
+                                                           "pixbuf", PREVIEW_COLUMN,
+                                                           "stock-id", PREVIEW_COLUMN_STOCK,
+                                                           "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
+                                                           NULL);
+        gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->search_all_treeview), column);
+        renderer = gtk_cell_renderer_text_new ();
+        column = gtk_tree_view_column_new_with_attributes ("", renderer,
+                                                           "markup", DESCRIPTION_COLUMN,
+                                                           NULL);
+        gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (this->priv->search_all_treeview), column);
+        search_all_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
+        search_all_names = lgl_db_get_template_name_list_all (NULL, page_size_id, NULL);
+        load_search_all_list (this, this->priv->search_all_store, search_all_selection, search_all_names);
+        lgl_db_free_template_name_list (search_all_names);
+
+        /* Connect signals to controls */
+        g_signal_connect (G_OBJECT (this->priv->brand_combo), "changed",
+                          G_CALLBACK (filter_changed_cb),
+                          this);
+        g_signal_connect (G_OBJECT (this->priv->page_size_combo), "changed",
+                          G_CALLBACK (filter_changed_cb),
+                          this);
+        g_signal_connect (G_OBJECT (this->priv->category_combo), "changed",
+                          G_CALLBACK (filter_changed_cb),
+                          this);
+        g_signal_connect (G_OBJECT (recent_selection), "changed",
+                          G_CALLBACK (selection_changed_cb),
+                          this);
+        g_signal_connect (G_OBJECT (search_all_selection), "changed",
+                          G_CALLBACK (selection_changed_cb),
+                          this);
+        g_signal_connect (G_OBJECT (this->priv->notebook), "switch-page",
+                          G_CALLBACK (page_changed_cb),
+                          this);
+
+        g_free (page_size_name);
+
+        if ( recent_list )
+        {
+                gtk_notebook_set_current_page (GTK_NOTEBOOK (this->priv->notebook),
+                                               this->priv->recent_page_num);
+        }
+        else
+        {
+                gtk_notebook_set_current_page (GTK_NOTEBOOK (this->priv->notebook),
+                                               this->priv->search_all_page_num);
+        }
+        gl_template_history_model_free_name_list (recent_list);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  modify widget due to change in selection                       */
+/*--------------------------------------------------------------------------*/
+static void
+filter_changed_cb (GtkComboBox *combo,
+                   gpointer     user_data)
+{
+        glMediaSelect     *this = GL_MEDIA_SELECT (user_data);
+        gchar             *brand;
+        gchar             *page_size_name, *page_size_id;
+        gchar             *category_name, *category_id;
+        GList             *search_all_names;
+        GtkTreeSelection  *selection;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+
+       this->priv->stop_signals = TRUE;
+
+        /* Update template selections for new filter settings */
+        brand = gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->brand_combo));
+        page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->page_size_combo));
+        category_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->category_combo));
+        if ( brand && strlen(brand) &&
+             page_size_name && strlen(page_size_name) &&
+             category_name && strlen(category_name) )
+        {
+                gl_debug (DEBUG_MEDIA_SELECT, "brand = \"%s\"", brand);
+                gl_debug (DEBUG_MEDIA_SELECT, "page_size_name = \"%s\"", page_size_name);
+                gl_debug (DEBUG_MEDIA_SELECT, "category_name = \"%s\"", category_name);
+                if (!g_utf8_collate (brand, _("Any")))
+                {
+                        g_free (brand);
+                        brand = NULL;
+                }
+                page_size_id = lgl_db_lookup_paper_id_from_name (page_size_name);
+                category_id = lgl_db_lookup_category_id_from_name (category_name);
+                gl_debug (DEBUG_MEDIA_SELECT, "page_size_id = \"%s\"", page_size_id);
+                gl_debug (DEBUG_MEDIA_SELECT, "category_id = \"%s\"", category_id);
+                search_all_names = lgl_db_get_template_name_list_all (brand, page_size_id, category_id);
+                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
+                load_search_all_list (this, this->priv->search_all_store, selection, search_all_names);
+                lgl_db_free_template_name_list (search_all_names);
+                g_free (page_size_id);
+                g_free (category_id);
+
+                /* Emit our "changed" signal */
+                g_signal_emit (G_OBJECT (user_data),
+                               media_select_signals[CHANGED], 0);
+        }
+        g_free (brand);
+        g_free (page_size_name);
+        g_free (category_name);
+
+
+       this->priv->stop_signals = FALSE;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  modify widget due to change in selection                       */
+/*--------------------------------------------------------------------------*/
+static void
+selection_changed_cb (GtkTreeSelection       *selection,
+                      gpointer                user_data)
+{
+        glMediaSelect *this = GL_MEDIA_SELECT (user_data);
+
+       if (this->priv->stop_signals) return;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        /* Emit our "changed" signal */
+        g_signal_emit (G_OBJECT (user_data),
+                       media_select_signals[CHANGED], 0);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  modify widget due to change in selection                       */
+/*--------------------------------------------------------------------------*/
+static void
+page_changed_cb (GtkNotebook            *notebook,
+                 GtkNotebookPage        *page,
+                 guint                   page_num,
+                 gpointer                user_data)
+{
+        glMediaSelect *this = GL_MEDIA_SELECT (user_data);
+
+       if (this->priv->stop_signals) return;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        /*
+         * Store new current page, because this signal is emitted before the actual page change.
+         */
+       this->priv->current_page_num = page_num;
+
+        /* Emit our "changed" signal */
+        g_signal_emit (G_OBJECT (user_data),
+                       media_select_signals[CHANGED], 0);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+/****************************************************************************/
+/* query selected label template name.                                      */
+/****************************************************************************/
+gchar *
+gl_media_select_get_name (glMediaSelect *this)
+{
+        gint               page_num;
+        GtkTreeSelection  *selection;
+        GtkTreeIter        iter;
+        GtkTreeModel      *model;        
+        gchar             *name;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        page_num = this->priv->current_page_num;
+        if (page_num == this->priv->recent_page_num)
+        {
+                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->recent_treeview));
+        }
+        else if (page_num == this->priv->search_all_page_num)
+        {
+                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
+        }
+        else
+        {
+                g_print ("notebook page = %d\n", page_num);
+                g_assert_not_reached ();
+        }
+
+        if (gtk_tree_selection_get_mode (selection) == GTK_SELECTION_NONE)
+        {
+                name = NULL;
+        }
+        else
+        {
+                gtk_tree_selection_get_selected (selection, &model, &iter);
+                gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
+        }
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+        return name;
+}
+
+
+/****************************************************************************/
+/* set selected label template name.                                        */
+/****************************************************************************/
+void
+gl_media_select_set_name (glMediaSelect *this,
+                          gchar         *name)
+{
+        GtkTreeSelection  *selection;
+        GtkTreeModel      *model;
+        GtkTreeIter        iter;
+        GtkTreePath       *path;
+        gchar             *name_i;
+        gboolean           flag;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (this->priv->search_all_treeview));
+        g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
+
+        model = GTK_TREE_MODEL (this->priv->search_all_store);
+
+        for ( flag = gtk_tree_model_get_iter_first (model, &iter);
+              flag;
+              flag = gtk_tree_model_iter_next(model, &iter) )
+        {
+                gtk_tree_model_get (model, &iter, NAME_COLUMN, &name_i, -1); 
+                if (strcasecmp(name, name_i) == 0)
+                {
+                        gtk_tree_selection_select_iter (selection, &iter);
+                        path = gtk_tree_model_get_path (model, &iter);
+                        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (this->priv->search_all_treeview),
+                                                      path,
+                                                      NULL,
+                                                      TRUE, 0.5, 0.0);
+                        gtk_tree_path_free (path);
+                        break;
+                }
+        }
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+/****************************************************************************/
+/* query current filter parameters.                                         */
+/****************************************************************************/
+void
+gl_media_select_get_filter_parameters (glMediaSelect  *this,
+                                       gchar         **page_size_id,
+                                       gchar         **category_id)
+{
+        gchar *page_size_name, *category_name;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "");
+
+        g_free (*page_size_id);
+        g_free (*category_id);
+
+        page_size_name =
+                gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->page_size_combo));
+
+        *page_size_id = lgl_db_lookup_paper_id_from_name (page_size_name);
+
+        category_name =
+                gtk_combo_box_get_active_text (GTK_COMBO_BOX (this->priv->category_combo));
+
+        *category_id = lgl_db_lookup_category_id_from_name (category_name);
+
+        g_free (page_size_name);
+        g_free (category_name);
+}
+
+
+/****************************************************************************/
+/* set filter parameters.                                                   */
+/****************************************************************************/
+void
+gl_media_select_set_filter_parameters (glMediaSelect  *this,
+                                       const gchar    *page_size_id,
+                                       const gchar    *category_id)
+{
+        gchar *page_size_name;
+        gchar *category_name;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        page_size_name = lgl_db_lookup_paper_name_from_id (page_size_id);
+        if (page_size_name == NULL)
+        {
+                page_size_name = g_strdup (_("Any"));
+        }
+
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->page_size_combo),
+                                       page_size_name);
+
+        category_name = lgl_db_lookup_category_name_from_id (category_id);
+        if (category_name == NULL)
+        {
+                category_name = g_strdup (_("Any"));
+        }
+
+        gl_combo_util_set_active_text (GTK_COMBO_BOX (this->priv->category_combo),
+                                       category_name);
+        g_free (page_size_name);
+        g_free (category_name);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Load list store from template name list.                       */
+/*--------------------------------------------------------------------------*/
+static void
+load_recent_list (glMediaSelect      *this,
+                  GtkListStore       *store,
+                  GtkTreeSelection   *selection,
+                  GList              *list)
+{
+        GList            *p;
+        GtkTreeIter       iter;
+        lglUnits          units;
+        lglTemplate      *template;
+        lglTemplateFrame *frame;
+        GdkPixbuf        *pixbuf;
+        gchar            *size;
+        gchar            *layout;
+        gchar            *description;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        gtk_list_store_clear (store);
+
+
+        if ( this->priv->recent_info_bar )
+        {
+                gtk_container_remove (GTK_CONTAINER (this->priv->recent_info_vbox),
+                                      this->priv->recent_info_bar);
+                this->priv->recent_info_bar = NULL;
+        }
+
+        if (list)
+        {
+
+                units = gl_prefs_model_get_units (gl_prefs);
+
+                for ( p=list; p!=NULL; p=p->next )
+                {
+
+                        gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data);
+
+                        template = lgl_db_lookup_template_from_name (p->data);
+                        frame    = (lglTemplateFrame *)template->frames->data;
+                        pixbuf   = gl_mini_preview_pixbuf_cache_get_pixbuf (p->data);
+
+                        size     = lgl_template_frame_get_size_description (frame, units);
+                        layout   = lgl_template_frame_get_layout_description (frame);
+                        description = g_strdup_printf ("<b>%s: %s</b>\n%s\n%s",
+                                                       (gchar *)p->data,
+                                                       template->description,
+                                                       size,
+                                                       layout);
+                        g_free (size);
+                        g_free (layout);
+
+                        lgl_template_free (template);
+
+                        gtk_list_store_append (store, &iter);
+                        gtk_list_store_set (store, &iter,
+                                            NAME_COLUMN, p->data,
+                                            PREVIEW_COLUMN, pixbuf,
+                                            DESCRIPTION_COLUMN, description,
+                                            -1);
+
+                        g_object_unref (G_OBJECT (pixbuf));
+                        g_free (description);
+                }
+
+                gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+                gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
+                gtk_tree_selection_select_iter (selection, &iter);
+
+        }
+        else
+        {
+                this->priv->recent_info_bar = gl_message_bar_new (GTK_MESSAGE_INFO,
+                                                                          GTK_BUTTONS_NONE,
+                                                                          "%s", _("No recent templates found."));
+                gl_message_bar_format_secondary_text (GL_MESSAGE_BAR (this->priv->recent_info_bar),
+                                                      "%s", _("Try selecting a template from the \"Search all templates\" page."));
+
+                gtk_box_pack_start (GTK_BOX (this->priv->recent_info_vbox),
+                                    this->priv->recent_info_bar,
+                                    FALSE, FALSE, 0);
+                gtk_widget_show_all (this->priv->recent_info_bar);
+
+                gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
+
+        }
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Load list store from template name list.                       */
+/*--------------------------------------------------------------------------*/
+static void
+load_search_all_list (glMediaSelect      *this,
+                      GtkListStore       *store,
+                      GtkTreeSelection   *selection,
+                      GList              *list)
+{
+        GList            *p;
+        GtkTreeIter       iter;
+        lglUnits          units;
+        lglTemplate      *template;
+        lglTemplateFrame *frame;
+        GdkPixbuf        *pixbuf;
+        gchar            *size;
+        gchar            *layout;
+        gchar            *description;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        gtk_list_store_clear (store);
+
+        if ( this->priv->search_all_info_bar )
+        {
+                gtk_container_remove (GTK_CONTAINER (this->priv->search_all_info_vbox),
+                                      this->priv->search_all_info_bar);
+                this->priv->search_all_info_bar = NULL;
+        }
+
+        if (list)
+        {
+
+                units = gl_prefs_model_get_units (gl_prefs);
+
+                for ( p=list; p!=NULL; p=p->next )
+                {
+
+                        gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data);
+
+                        template = lgl_db_lookup_template_from_name (p->data);
+                        frame    = (lglTemplateFrame *)template->frames->data;
+                        pixbuf   = gl_mini_preview_pixbuf_cache_get_pixbuf (p->data);
+
+                        size     = lgl_template_frame_get_size_description (frame, units);
+                        layout   = lgl_template_frame_get_layout_description (frame);
+                        description = g_strdup_printf ("<b>%s: %s</b>\n%s\n%s",
+                                                       (gchar *)p->data,
+                                                       template->description,
+                                                       size,
+                                                       layout);
+                        g_free (size);
+                        g_free (layout);
+
+                        lgl_template_free (template);
+
+                        gtk_list_store_append (store, &iter);
+                        gtk_list_store_set (store, &iter,
+                                            NAME_COLUMN, p->data,
+                                            PREVIEW_COLUMN, pixbuf,
+                                            DESCRIPTION_COLUMN, description,
+                                            -1);
+
+                        g_object_unref (G_OBJECT (pixbuf));
+                        g_free (description);
+                }
+
+                gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+                gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
+                gtk_tree_selection_select_iter (selection, &iter);
+
+        }
+        else
+        {
+                this->priv->search_all_info_bar = gl_message_bar_new (GTK_MESSAGE_INFO,
+                                                                              GTK_BUTTONS_NONE,
+                                                                              "%s", _("No match."));
+                gl_message_bar_format_secondary_text (GL_MESSAGE_BAR (this->priv->search_all_info_bar),
+                                                      "%s", _("Try selecting a different brand, page size or category."));
+
+                gtk_box_pack_start (GTK_BOX (this->priv->search_all_info_vbox),
+                                    this->priv->search_all_info_bar,
+                                    FALSE, FALSE, 0);
+                gtk_widget_show_all (this->priv->search_all_info_bar);
+
+                gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
+
+        }
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
diff --git a/src/media-select.h b/src/media-select.h
new file mode 100644 (file)
index 0000000..603eeb8
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ *  media-select.h
+ *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __MEDIA_SELECT_H__
+#define __MEDIA_SELECT_H__
+
+#include <gtk/gtk.h>
+
+
+G_BEGIN_DECLS
+
+#define GL_TYPE_MEDIA_SELECT (gl_media_select_get_type ())
+#define GL_MEDIA_SELECT(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_MEDIA_SELECT, glMediaSelect ))
+#define GL_MEDIA_SELECT_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_MEDIA_SELECT, glMediaSelectClass))
+#define GL_IS_MEDIA_SELECT(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_MEDIA_SELECT))
+#define GL_IS_MEDIA_SELECT_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_MEDIA_SELECT))
+
+typedef struct _glMediaSelect         glMediaSelect;
+typedef struct _glMediaSelectClass    glMediaSelectClass;
+
+typedef struct _glMediaSelectPrivate  glMediaSelectPrivate;
+
+struct _glMediaSelect {
+        GtkVBox                    parent_widget;
+
+        glMediaSelectPrivate  *priv;
+};
+
+struct _glMediaSelectClass {
+        GtkVBoxClass               parent_class;
+
+        void (*changed) (glMediaSelect *media_select, gpointer user_data);
+};
+
+
+GType      gl_media_select_get_type      (void) G_GNUC_CONST;
+
+GtkWidget *gl_media_select_new           (void);
+
+gchar     *gl_media_select_get_name      (glMediaSelect *this);
+
+void       gl_media_select_set_name      (glMediaSelect *this,
+                                          gchar         *name);
+
+void       gl_media_select_get_filter_parameters (glMediaSelect *this,
+                                                  gchar        **page_size_id,
+                                                  gchar        **category_id);
+
+void       gl_media_select_set_filter_parameters (glMediaSelect *this,
+                                                  const gchar   *page_size_id,
+                                                  const gchar   *category_id);
+
+G_END_DECLS
+
+#endif
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
index 466214835697ac7b8571d2421980c6f34a747c0b..b6a92596e42b67271554dbb5e3168b21bcef3934 100644 (file)
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include "hig.h"
+#include "marshal.h"
 #include "builder-util.h"
 #include "prefs.h"
-#include "template-history.h"
+#include "media-select.h"
+#include "mini-label-preview.h"
 #include "mini-preview.h"
-#include "media-combo.h"
-#include "rotate-label-button.h"
 
 #include "debug.h"
 
 
-#define MINI_PREVIEW_MIN_HEIGHT 300
-#define MINI_PREVIEW_MIN_WIDTH  256
+#define LABEL_PREVIEW_WIDTH  96
+#define LABEL_PREVIEW_HEIGHT 96
+
+#define MINI_PREVIEW_MIN_WIDTH  300
+#define MINI_PREVIEW_MIN_HEIGHT 360
 
 
 /*===========================================*/
@@ -48,10 +50,21 @@ struct _glNewLabelDialogPrivate {
 
         GtkBuilder *builder;
 
-       GtkWidget  *preview_vbox;
+       GtkWidget  *template_page_vbox;
         GtkWidget  *combo_hbox;
-       GtkWidget  *rotate_hbox;
+        GtkWidget  *combo;
 
+       GtkWidget  *rotate_page_vbox;
+        GtkWidget  *normal_radio;
+       GtkWidget  *rotated_radio;
+        GtkWidget  *normal_preview_hbox;
+       GtkWidget  *rotated_preview_hbox;
+        GtkWidget  *normal_preview;
+       GtkWidget  *rotated_preview;
+
+       GtkWidget  *confirm_page_vbox;
+       GtkWidget  *preview_vbox;
+        GtkWidget  *preview;
         GtkWidget  *desc_label;
         GtkWidget  *page_size_label;
         GtkWidget  *label_size_label;
@@ -59,10 +72,18 @@ struct _glNewLabelDialogPrivate {
         GtkWidget  *vendor_label;
         GtkWidget  *part_label;
         GtkWidget  *similar_label;
+};
 
-        GtkWidget  *preview;
-        GtkWidget  *combo;
-        GtkWidget  *rotate_button;
+/* Page numbers for traversing GtkAssistant */
+enum {
+        TEMPLATE_PAGE_NUM = 0,
+        ROTATE_PAGE_NUM,
+        CONFIRM_PAGE_NUM
+};
+
+enum {
+        COMPLETE,
+        LAST_SIGNAL
 };
 
 
@@ -70,6 +91,8 @@ struct _glNewLabelDialogPrivate {
 /* Private globals                           */
 /*===========================================*/
 
+static gint signals[LAST_SIGNAL] = { 0 };
+
 
 /*===========================================*/
 /* Local function prototypes                 */
@@ -77,6 +100,13 @@ struct _glNewLabelDialogPrivate {
 
 static void       gl_new_label_dialog_finalize        (GObject           *object);
 
+static void       cancel_cb                           (glNewLabelDialog  *this);
+static void       apply_cb                            (glNewLabelDialog  *this);
+static void       close_cb                            (glNewLabelDialog  *this);
+
+static gint       forward_page_function               (gint               current_page,
+                                                       glNewLabelDialog  *this);
+
 static void       combo_changed_cb                    (glNewLabelDialog  *this);
 static void       rotate_toggled_cb                   (glNewLabelDialog  *this);
 
@@ -89,7 +119,7 @@ static void       set_info                            (glNewLabelDialog  *this,
 /*****************************************************************************/
 /* Boilerplate object stuff.                                                 */
 /*****************************************************************************/
-G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_ASSISTANT);
 
 
 /*****************************************************************************/
@@ -105,6 +135,16 @@ gl_new_label_dialog_class_init (glNewLabelDialogClass *class)
        gl_new_label_dialog_parent_class = g_type_class_peek_parent (class);
 
        object_class->finalize = gl_new_label_dialog_finalize;
+
+        signals[COMPLETE] =
+            g_signal_new ("complete",
+                          G_OBJECT_CLASS_TYPE(object_class),
+                          G_SIGNAL_RUN_LAST,
+                          G_STRUCT_OFFSET (glNewLabelDialogClass, complete),
+                          NULL, NULL,
+                          gl_marshal_VOID__VOID,
+                          G_TYPE_NONE, 0);
+
 }
 
 
@@ -115,12 +155,16 @@ static void
 gl_new_label_dialog_init (glNewLabelDialog *this)
 {
        GtkWidget    *vbox;
+        gchar        *logo_filename;
+        GdkPixbuf    *logo;
         GtkBuilder   *builder;
         gchar        *builder_filename;
-        static gchar *object_ids[] = { "new_label_dialog_hbox", NULL };
+        static gchar *object_ids[] = { "template_page_vbox",
+                                       "rotate_page_vbox",
+                                       "confirm_page_vbox",
+                                       NULL };
         GError       *error = NULL;
         GtkWidget    *new_label_dialog_hbox;
-        gchar        *name;
 
        gl_debug (DEBUG_FILE, "START");
 
@@ -128,19 +172,9 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
 
        this->priv = g_new0 (glNewLabelDialogPrivate, 1);
 
-       gtk_container_set_border_width (GTK_CONTAINER (this), GL_HIG_PAD1);
-
-       gtk_dialog_set_has_separator (GTK_DIALOG (this), FALSE);
-       gtk_dialog_add_buttons (GTK_DIALOG (this),
-                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                GTK_STOCK_OK, GTK_RESPONSE_OK,
-                                NULL);
-        gtk_dialog_set_default_response (GTK_DIALOG (this), GTK_RESPONSE_OK);
-       gtk_window_set_destroy_with_parent (GTK_WINDOW (this), TRUE);
-       gtk_window_set_modal (GTK_WINDOW (this), TRUE);
-
-        vbox = gtk_dialog_get_content_area (GTK_DIALOG (this));
-
+        logo_filename = g_build_filename (GLABELS_ICON_DIR, GLABELS_ICON, NULL);
+       logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
+        g_free (logo_filename);
 
         builder = gtk_builder_new ();
         builder_filename = g_build_filename (GLABELS_DATA_DIR, "builder", "new-label-dialog.builder", NULL);
@@ -153,10 +187,15 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
        }
 
         gl_builder_util_get_widgets (builder,
-                                     "new_label_dialog_hbox",  &new_label_dialog_hbox,
-                                     "preview_vbox",           &this->priv->preview_vbox,
+                                     "template_page_vbox",     &this->priv->template_page_vbox,
                                      "combo_hbox",             &this->priv->combo_hbox,
-                                     "rotate_hbox",            &this->priv->rotate_hbox,
+                                     "rotate_page_vbox",       &this->priv->rotate_page_vbox,
+                                     "normal_radio",           &this->priv->normal_radio,
+                                     "rotated_radio",          &this->priv->rotated_radio,
+                                     "normal_preview_hbox",    &this->priv->normal_preview_hbox,
+                                     "rotated_preview_hbox",   &this->priv->rotated_preview_hbox,
+                                     "confirm_page_vbox",      &this->priv->confirm_page_vbox,
+                                     "preview_vbox",           &this->priv->preview_vbox,
                                      "desc_label",             &this->priv->desc_label,
                                      "page_size_label",        &this->priv->page_size_label,
                                      "label_size_label",       &this->priv->label_size_label,
@@ -166,29 +205,47 @@ gl_new_label_dialog_init (glNewLabelDialog *this)
                                      "similar_label",          &this->priv->similar_label,
                                      NULL);
 
-        gtk_container_add (GTK_CONTAINER (vbox), new_label_dialog_hbox);
         this->priv->builder = builder;
 
+        gtk_assistant_append_page (GTK_ASSISTANT (this), this->priv->template_page_vbox);
+        gtk_assistant_set_page_title (GTK_ASSISTANT (this), this->priv->template_page_vbox, _("Select Product"));
+        gtk_assistant_set_page_header_image (GTK_ASSISTANT (this), this->priv->template_page_vbox, logo);
+        gtk_assistant_set_page_type (GTK_ASSISTANT (this), this->priv->template_page_vbox, GTK_ASSISTANT_PAGE_INTRO);
+
+        this->priv->combo = gl_media_select_new ();
+        gtk_container_add (GTK_CONTAINER (this->priv->combo_hbox), this->priv->combo);
+
+        gtk_assistant_append_page (GTK_ASSISTANT (this), this->priv->rotate_page_vbox);
+        gtk_assistant_set_page_title (GTK_ASSISTANT (this), this->priv->rotate_page_vbox, _("Choose Orientation"));
+        gtk_assistant_set_page_header_image (GTK_ASSISTANT (this), this->priv->rotate_page_vbox, logo);
+        gtk_assistant_set_page_complete (GTK_ASSISTANT (this), this->priv->rotate_page_vbox, TRUE);
+
+        this->priv->normal_preview = gl_mini_label_preview_new (LABEL_PREVIEW_WIDTH, LABEL_PREVIEW_HEIGHT);
+        gtk_container_add (GTK_CONTAINER (this->priv->normal_preview_hbox), this->priv->normal_preview);
+        this->priv->rotated_preview = gl_mini_label_preview_new (LABEL_PREVIEW_WIDTH, LABEL_PREVIEW_HEIGHT);
+        gtk_container_add (GTK_CONTAINER (this->priv->rotated_preview_hbox), this->priv->rotated_preview);
+
+        gtk_assistant_append_page (GTK_ASSISTANT (this), this->priv->confirm_page_vbox);
+        gtk_assistant_set_page_title (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, _("Review"));
+        gtk_assistant_set_page_header_image (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, logo);
+        gtk_assistant_set_page_type (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, GTK_ASSISTANT_PAGE_CONFIRM);
+        gtk_assistant_set_page_complete (GTK_ASSISTANT (this), this->priv->confirm_page_vbox, TRUE);
+
         this->priv->preview = gl_mini_preview_new (MINI_PREVIEW_MIN_HEIGHT, MINI_PREVIEW_MIN_WIDTH);
         gl_mini_preview_set_draw_arrow (GL_MINI_PREVIEW (this->priv->preview), TRUE);
         gl_mini_preview_set_rotate (GL_MINI_PREVIEW (this->priv->preview), FALSE);
         gtk_container_add (GTK_CONTAINER (this->priv->preview_vbox), this->priv->preview);
 
-        this->priv->combo = gl_media_combo_new ();
-        gtk_container_add (GTK_CONTAINER (this->priv->combo_hbox), this->priv->combo);
+        gtk_assistant_set_forward_page_func (GTK_ASSISTANT (this), (GtkAssistantPageFunc)forward_page_function, this, NULL);
 
-        this->priv->rotate_button = gl_rotate_label_button_new ();
-        gtk_container_add (GTK_CONTAINER (this->priv->rotate_hbox), this->priv->rotate_button);
+       g_signal_connect_swapped (G_OBJECT(this), "cancel", G_CALLBACK(cancel_cb), this);
+       g_signal_connect_swapped (G_OBJECT(this), "apply",  G_CALLBACK(apply_cb),  this);
+       g_signal_connect_swapped (G_OBJECT(this), "close",  G_CALLBACK(close_cb),  this);
 
-       g_signal_connect_swapped (G_OBJECT (this->priv->combo), "changed",
-                         G_CALLBACK (combo_changed_cb), this);
-       g_signal_connect_swapped (G_OBJECT (this->priv->rotate_button), "changed",
-                         G_CALLBACK (rotate_toggled_cb), this);
+       g_signal_connect_swapped (G_OBJECT (this->priv->combo),         "changed", G_CALLBACK (combo_changed_cb),  this);
+       g_signal_connect_swapped (G_OBJECT (this->priv->normal_radio),  "toggled", G_CALLBACK (rotate_toggled_cb), this);
+       g_signal_connect_swapped (G_OBJECT (this->priv->rotated_radio), "toggled", G_CALLBACK (rotate_toggled_cb), this);
 
-        name = get_default_name ();
-        gl_media_combo_set_name (GL_MEDIA_COMBO (this->priv->combo), name);
-        gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (this->priv->rotate_button), name);
-        g_free (name);
         combo_changed_cb (this);
 
        gl_debug (DEBUG_FILE, "END");
@@ -237,6 +294,84 @@ gl_new_label_dialog_new (GtkWindow    *win)
 }
 
 
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Handle non-linear forward traversal.                           */
+/*--------------------------------------------------------------------------*/
+static gint
+forward_page_function (gint              current_page,
+                       glNewLabelDialog *this)
+{
+        gchar                     *name;
+        lglTemplate               *template;
+        const lglTemplateFrame    *frame;
+        gdouble                    w, h;
+
+        switch (current_page)
+        {
+        case TEMPLATE_PAGE_NUM:
+                name = gl_media_select_get_name (GL_MEDIA_SELECT (this->priv->combo));
+                if ( name != NULL )
+                {
+                        template = lgl_db_lookup_template_from_name (name);
+                        frame    = (lglTemplateFrame *)template->frames->data;
+                        lgl_template_frame_get_size (frame, &w, &h);
+
+                        if ( w == h )
+                        {
+                                /* Skip rotate page for square and circular labels. */
+                                return CONFIRM_PAGE_NUM;
+                        }
+                }
+                return ROTATE_PAGE_NUM;
+
+        case ROTATE_PAGE_NUM:
+                return CONFIRM_PAGE_NUM;
+
+        case CONFIRM_PAGE_NUM:
+        default:
+                return -1;
+        }
+
+        return -1;
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  cancel callback.                                               */
+/*--------------------------------------------------------------------------*/
+static void
+cancel_cb (glNewLabelDialog *this)
+{
+                                                                               
+       gtk_widget_destroy (GTK_WIDGET(this));
+
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  apply callback                                                 */
+/*--------------------------------------------------------------------------*/
+static void
+apply_cb (glNewLabelDialog *this)
+{
+
+        g_signal_emit (G_OBJECT (this), signals[COMPLETE], 0);
+
+}
+
+                         
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  close callback                                                 */
+/*--------------------------------------------------------------------------*/
+static void
+close_cb (glNewLabelDialog *this)
+{
+                                                                               
+       gtk_widget_destroy (GTK_WIDGET(this));
+
+}
+
+                         
 /*---------------------------------------------------------------------------*/
 /* PRIVATE.  Template changed callback.                                      */
 /*---------------------------------------------------------------------------*/
@@ -247,12 +382,17 @@ combo_changed_cb (glNewLabelDialog  *this)
 
        gl_debug (DEBUG_FILE, "START");
 
-       name = gl_media_combo_get_name (GL_MEDIA_COMBO (this->priv->combo));
+       name = gl_media_select_get_name (GL_MEDIA_SELECT (this->priv->combo));
+
+        gl_mini_label_preview_set_by_name (GL_MINI_LABEL_PREVIEW (this->priv->normal_preview),  name, FALSE);
+        gl_mini_label_preview_set_by_name (GL_MINI_LABEL_PREVIEW (this->priv->rotated_preview), name, TRUE);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (this->priv->normal_radio), TRUE);
 
        gl_mini_preview_set_by_name (GL_MINI_PREVIEW (this->priv->preview), name);
-        gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (this->priv->rotate_button), name);
         set_info (this, name);
 
+        gtk_assistant_set_page_complete (GTK_ASSISTANT (this), this->priv->template_page_vbox, (name != NULL));
+
        g_free (name);
 
        gl_debug (DEBUG_FILE, "END");
@@ -269,48 +409,13 @@ rotate_toggled_cb (glNewLabelDialog  *this)
 
        gl_debug (DEBUG_FILE, "START");
 
-        state = gl_rotate_label_button_get_state (GL_ROTATE_LABEL_BUTTON (this->priv->rotate_button));
+        state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (this->priv->rotated_radio));
         gl_mini_preview_set_rotate (GL_MINI_PREVIEW (this->priv->preview), state);
 
        gl_debug (DEBUG_FILE, "END");
 }
 
 
-/*---------------------------------------------------------------------------*/
-/* PRIVATE.  Get default template name.                                      */
-/*---------------------------------------------------------------------------*/
-static gchar *
-get_default_name (void)
-{
-        gchar *name = NULL;
-        GList *list;
-
-        list = gl_template_history_model_get_name_list (gl_template_history);
-
-        if ( list )
-        {
-                name = g_strdup (list->data);
-                gl_template_history_model_free_name_list (list);
-        }
-        else
-        {
-                gchar *page_size;
-
-                page_size = gl_prefs_model_get_default_page_size (gl_prefs);
-                list = lgl_db_get_template_name_list_all (NULL, page_size, NULL);
-                g_free (page_size);
-
-                if ( list )
-                {
-                        name = g_strdup (list->data);
-                        lgl_db_free_template_name_list (list);
-                }
-        }
-
-        return name;
-}
-
-
 /*---------------------------------------------------------------------------*/
 /* PRIVATE.  Set information labels.                                         */
 /*---------------------------------------------------------------------------*/
@@ -406,7 +511,7 @@ gl_new_label_dialog_get_template_name (glNewLabelDialog *this)
 {
        gchar *name;
 
-       name = gl_media_combo_get_name (GL_MEDIA_COMBO (this->priv->combo));
+       name = gl_media_select_get_name (GL_MEDIA_SELECT (this->priv->combo));
 
        return name;
 }
@@ -420,7 +525,7 @@ gl_new_label_dialog_set_template_name (glNewLabelDialog *this,
                                       gchar            *name)
 {
        gl_mini_preview_set_by_name (GL_MINI_PREVIEW (this->priv->preview), name);
-       gl_media_combo_set_name (GL_MEDIA_COMBO (this->priv->combo), name);
+       gl_media_select_set_name (GL_MEDIA_SELECT (this->priv->combo), name);
         set_info (this, name);
 }
 
@@ -453,7 +558,7 @@ gl_new_label_dialog_set_filter_parameters (glNewLabelDialog *this,
 gboolean
 gl_new_label_dialog_get_rotate_state (glNewLabelDialog *this)
 {
-       return gl_rotate_label_button_get_state (GL_ROTATE_LABEL_BUTTON (this->priv->rotate_button));
+       return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (this->priv->rotated_radio));
 }
 
 
@@ -464,7 +569,7 @@ void
 gl_new_label_dialog_set_rotate_state (glNewLabelDialog *this,
                                      gboolean          state)
 {
-        gl_rotate_label_button_set_state (GL_ROTATE_LABEL_BUTTON (this->priv->rotate_button), state);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (this->priv->rotated_radio), state);
         gl_mini_preview_set_rotate (GL_MINI_PREVIEW (this->priv->preview), state);
 }
 
index 2029a9fc5d847e90b024c5369bc15c4500a8e16a..ccfd27fd525d5141f28099dfdb7a6b31d9be5abe 100644 (file)
@@ -45,7 +45,7 @@ typedef struct _glNewLabelDialogPrivate  glNewLabelDialogPrivate;
 
 struct _glNewLabelDialog
 {
-       GtkDialog                parent_instance;
+       GtkAssistant             parent_instance;
 
        glNewLabelDialogPrivate *priv;
 
@@ -53,7 +53,9 @@ struct _glNewLabelDialog
 
 struct  _glNewLabelDialogClass
 {
-       GtkDialogClass           parent_class;
+       GtkAssistantClass        parent_class;
+
+        void (*complete) (glNewLabelDialog *this, gpointer user_data);
 };
 
 
diff --git a/src/rotate-label-button.c b/src/rotate-label-button.c
deleted file mode 100644 (file)
index cf65db0..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- *  rotate-label-button.c
- *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include "rotate-label-button.h"
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <math.h>
-
-#include <libglabels.h>
-#include "mini-label-preview.h"
-#include "hig.h"
-#include "marshal.h"
-
-#include "debug.h"
-
-
-/*========================================================*/
-/* Private macros and constants.                          */
-/*========================================================*/
-
-#define SIZE 48
-
-
-/*===========================================*/
-/* Private types                             */
-/*===========================================*/
-
-struct _glRotateLabelButtonPrivate {
-
-        GtkWidget    *no_rotate_radio;
-        GtkWidget    *rotate_radio;
-        GtkWidget    *no_rotate_preview;
-        GtkWidget    *rotate_preview;
-};
-
-enum {
-       CHANGED,
-       LAST_SIGNAL
-};
-
-
-/*===========================================*/
-/* Private globals                           */
-/*===========================================*/
-
-static gint rotate_label_button_signals[LAST_SIGNAL] = { 0 };
-
-
-/*===========================================*/
-/* Local function prototypes                 */
-/*===========================================*/
-
-static void gl_rotate_label_button_finalize    (GObject                *object);
-
-static void toggled_cb                         (GtkToggleButton        *toggle,
-                                               gpointer                user_data);
-
-
-/****************************************************************************/
-/* Boilerplate Object stuff.                                                */
-/****************************************************************************/
-G_DEFINE_TYPE (glRotateLabelButton, gl_rotate_label_button, GTK_TYPE_HBOX);
-
-
-static void
-gl_rotate_label_button_class_init (glRotateLabelButtonClass *class)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (class);
-
-       gl_rotate_label_button_parent_class = g_type_class_peek_parent (class);
-
-       object_class->finalize = gl_rotate_label_button_finalize;
-
-       rotate_label_button_signals[CHANGED] =
-           g_signal_new ("changed",
-                         G_OBJECT_CLASS_TYPE(object_class),
-                         G_SIGNAL_RUN_LAST,
-                         G_STRUCT_OFFSET (glRotateLabelButtonClass, changed),
-                         NULL, NULL,
-                         gl_marshal_VOID__VOID,
-                         G_TYPE_NONE, 0);
-
-}
-
-
-static void
-gl_rotate_label_button_init (glRotateLabelButton *this)
-{
-        GtkWidget *vbox;
-        GtkWidget *label;
-
-        this->priv = g_new0 (glRotateLabelButtonPrivate, 1);
-
-        gtk_box_set_spacing (GTK_BOX (this), GL_HIG_PAD2);
-
-        this->priv->no_rotate_radio = gtk_radio_button_new (NULL);
-        gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (this->priv->no_rotate_radio),
-                                    FALSE);
-        vbox = gtk_vbox_new (FALSE, 1);
-        this->priv->no_rotate_preview = gl_mini_label_preview_new (SIZE, SIZE);
-        gtk_box_pack_start (GTK_BOX (vbox), this->priv->no_rotate_preview, FALSE, FALSE, 0);
-        label = gtk_label_new (_("Normal"));
-        gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-        gtk_container_add (GTK_CONTAINER (this->priv->no_rotate_radio), vbox);
-
-
-        this->priv->rotate_radio    = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (this->priv->no_rotate_radio));
-        gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (this->priv->rotate_radio),
-                                    FALSE);
-        vbox = gtk_vbox_new (FALSE, 1);
-        this->priv->rotate_preview    = gl_mini_label_preview_new (SIZE, SIZE);
-        gtk_box_pack_start (GTK_BOX (vbox), this->priv->rotate_preview, FALSE, FALSE, 0);
-        label = gtk_label_new (_("Rotated"));
-        gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-        gtk_container_add (GTK_CONTAINER (this->priv->rotate_radio), vbox);
-
-        gtk_box_pack_start (GTK_BOX (this), this->priv->no_rotate_radio, FALSE, FALSE, 0);
-        gtk_box_pack_start (GTK_BOX (this), this->priv->rotate_radio, FALSE, FALSE, 0);
-        
-        /* Connect signals to controls */
-       g_signal_connect (G_OBJECT (this->priv->no_rotate_radio),
-                         "toggled",
-                         G_CALLBACK (toggled_cb), this);
-       g_signal_connect (G_OBJECT (this->priv->rotate_radio),
-                         "toggled",
-                         G_CALLBACK (toggled_cb), this);
-}
-
-
-static void
-gl_rotate_label_button_finalize (GObject *object)
-{
-       glRotateLabelButton      *this = GL_ROTATE_LABEL_BUTTON (object);
-
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (GL_IS_ROTATE_LABEL_BUTTON (object));
-
-       g_free (this->priv);
-
-       G_OBJECT_CLASS (gl_rotate_label_button_parent_class)->finalize (object);
-}
-
-
-GtkWidget *
-gl_rotate_label_button_new (void)
-{
-       glRotateLabelButton *this;
-
-       this = g_object_new (gl_rotate_label_button_get_type (), NULL);
-
-       return GTK_WIDGET (this);
-}
-
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  modify widget due to change of check button                    */
-/*--------------------------------------------------------------------------*/
-static void
-toggled_cb (GtkToggleButton *toggle,
-            gpointer         user_data)
-{
-
-       /* Emit our "changed" signal */
-       g_signal_emit (G_OBJECT (user_data),
-                      rotate_label_button_signals[CHANGED], 0);
-
-}
-
-
-/****************************************************************************/
-/* query state of widget.                                                   */
-/****************************************************************************/
-gboolean
-gl_rotate_label_button_get_state (glRotateLabelButton *this)
-{
-       return
-           gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
-                                         (this->priv->rotate_radio));
-}
-
-/****************************************************************************/
-/* set state of widget.                                                     */
-/****************************************************************************/
-void
-gl_rotate_label_button_set_state (glRotateLabelButton *this,
-                                  gboolean             state)
-{
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                     (this->priv->rotate_radio), state);
-}
-
-/****************************************************************************/
-/* set template for widget.                                                 */
-/****************************************************************************/
-void
-gl_rotate_label_button_set_template_name (glRotateLabelButton *this,
-                                          gchar               *name)
-{
-       lglTemplate               *template;
-       const lglTemplateFrame    *frame;
-       gdouble                    raw_w, raw_h;
-
-       if (name == NULL)
-       {
-               gtk_widget_set_sensitive (this->priv->no_rotate_radio, FALSE);
-               gtk_widget_set_sensitive (this->priv->rotate_radio, FALSE);
-       }
-       else
-       {
-               template = lgl_db_lookup_template_from_name (name);
-                frame = (lglTemplateFrame *)template->frames->data;
-
-                gl_mini_label_preview_set_by_name (GL_MINI_LABEL_PREVIEW (this->priv->no_rotate_preview),
-                                                   name, FALSE);
-                gl_mini_label_preview_set_by_name (GL_MINI_LABEL_PREVIEW (this->priv->rotate_preview),
-                                                   name, TRUE);
-
-               lgl_template_frame_get_size (frame, &raw_w, &raw_h);
-               gtk_widget_set_sensitive (this->priv->no_rotate_radio,
-                                         (raw_w != raw_h));
-               gtk_widget_set_sensitive (this->priv->rotate_radio,
-                                         (raw_w != raw_h));
-
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                              (this->priv->no_rotate_radio), TRUE);
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                              (this->priv->rotate_radio), FALSE);
-       }
-
-}
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
diff --git a/src/rotate-label-button.h b/src/rotate-label-button.h
deleted file mode 100644 (file)
index 049d80e..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *  rotate-label-button.h
- *  Copyright (C) 2001-2009  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __ROTATE_LABEL_BUTTON_H__
-#define __ROTATE_LABEL_BUTTON_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_ROTATE_LABEL_BUTTON (gl_rotate_label_button_get_type ())
-#define GL_ROTATE_LABEL_BUTTON(obj) \
-        (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_ROTATE_LABEL_BUTTON, glRotateLabelButton ))
-#define GL_ROTATE_LABEL_BUTTON_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_ROTATE_LABEL_BUTTON, glRotateLabelButtonClass))
-#define GL_IS_ROTATE_LABEL_BUTTON(obj) \
-        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_ROTATE_LABEL_BUTTON))
-#define GL_IS_ROTATE_LABEL_BUTTON_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_ROTATE_LABEL_BUTTON))
-
-
-typedef struct _glRotateLabelButton         glRotateLabelButton;
-typedef struct _glRotateLabelButtonClass    glRotateLabelButtonClass;
-
-typedef struct _glRotateLabelButtonPrivate  glRotateLabelButtonPrivate;
-
-struct _glRotateLabelButton {
-       GtkHBox                      parent_widget;
-
-       glRotateLabelButtonPrivate  *priv;
-};
-
-struct _glRotateLabelButtonClass {
-       GtkHBoxClass                 parent_class;
-
-       void (*changed) (glRotateLabelButton  *rotate_label_button,
-                        gpointer              user_data);
-};
-
-
-GType      gl_rotate_label_button_get_type          (void) G_GNUC_CONST;
-
-GtkWidget *gl_rotate_label_button_new               (void);
-
-gboolean   gl_rotate_label_button_get_state         (glRotateLabelButton *rotate_label);
-
-void       gl_rotate_label_button_set_state         (glRotateLabelButton *rotate_label,
-                                                     gboolean             state);
-
-void       gl_rotate_label_button_set_template_name (glRotateLabelButton *rotate_label,
-                                                     gchar               *name);
-
-G_END_DECLS
-
-#endif
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */