[chronojump] Better UtilGtk contrast. nice gui: session/more[/import]



commit 2425689205a513f97d755e23f5a059efca0a47f9
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 1 12:58:40 2020 +0200

    Better UtilGtk contrast. nice gui: session/more[/import]

 glade/app1.glade                     | 332 ++++++++++++++++++++++++-----------
 src/gui/app1/chronojump.cs           |   7 +-
 src/gui/app1/sessionLoadAndImport.cs |   2 +-
 src/utilGtk.cs                       |  49 ++++--
 4 files changed, 274 insertions(+), 116 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index d863dc39..649a5563 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -35158,29 +35158,37 @@ then click this button.</property>
                                             <property name="show_tabs">False</property>
                                             <property name="show_border">False</property>
                                             <child>
-                                              <widget class="GtkVBox" id="vbox84">
+                                              <widget class="GtkHBox" id="hbox374">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <child>
-                                                  <widget class="GtkHBox" id="hbox374">
+                                                  <widget class="GtkVBox" id="vbox56">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
                                                     <child>
                                                       <widget class="GtkVBox" id="vbox174">
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">False</property>
+                                                        <property name="border_width">10</property>
                                                         <property name="spacing">30</property>
                                                         <child>
                                                           <widget class="GtkFrame" id="frame11">
+                                                            <property name="width_request">450</property>
+                                                            <property name="height_request">400</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="label_xalign">0</property>
-                                                            <property name="shadow_type">none</property>
+                                                            <property name="shadow_type">in</property>
+                                                            <child>
+                                                            <widget class="GtkViewport" id="viewport8">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="border_width">4</property>
                                                             <child>
                                                             <widget class="GtkVBox" id="vbox191">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="border_width">25</property>
+                                                            <property name="border_width">20</property>
                                                             <property name="spacing">100</property>
                                                             <child>
                                                             <widget class="GtkVBox" id="vbox192">
@@ -35612,6 +35620,8 @@ then click this button.</property>
                                                             </child>
                                                             </widget>
                                                             </child>
+                                                            </widget>
+                                                            </child>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox_session_more">
                                                             <property name="visible">True</property>
@@ -35664,7 +35674,7 @@ then click this button.</property>
                                                           </widget>
                                                           <packing>
                                                             <property name="expand">True</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">0</property>
                                                           </packing>
                                                         </child>
@@ -35691,8 +35701,8 @@ then click this button.</property>
                                                             </child>
                                                           </widget>
                                                           <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">1</property>
                                                           </packing>
                                                         </child>
@@ -35724,36 +35734,62 @@ then click this button.</property>
                                               </packing>
                                             </child>
                                             <child>
-                                              <widget class="GtkVBox" id="session_import_box">
+                                              <widget class="GtkHBox" id="hbox93">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="spacing">20</property>
                                                 <child>
-                                                  <widget class="GtkVBox" id="vbox175">
+                                                  <widget class="GtkVBox" id="vbox65">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
-                                                    <property name="spacing">30</property>
                                                     <child>
-                                                      <widget class="GtkLabel" id="label24">
+                                                      <widget class="GtkVBox" id="session_import_box">
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">False</property>
-                                                        <property name="xalign">0</property>
-                                                        <property name="label" translatable="yes">Where do 
you want to import?</property>
-                                                      </widget>
-                                                      <packing>
-                                                        <property name="expand">False</property>
-                                                        <property name="fill">False</property>
-                                                        <property name="position">0</property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <widget class="GtkAlignment" id="alignment37">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="bottom_padding">10</property>
-                                                        <property name="left_padding">20</property>
+                                                        <property name="spacing">30</property>
                                                         <child>
-                                                          <widget class="GtkVBox" id="vbox176">
+                                                          <widget class="GtkFrame" id="frame13">
+                                                            <property name="width_request">450</property>
+                                                            <property name="height_request">400</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">none</property>
+                                                            <child>
+                                                            <widget class="GtkViewport" id="viewport1">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="border_width">4</property>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox175">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="border_width">20</property>
+                                                            <property name="spacing">30</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label471">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label" translatable="yes">Where 
do you want to import?</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkAlignment" id="alignment37">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="bottom_padding">10</property>
+                                                            <property name="left_padding">20</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox159">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox176">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">20</property>
@@ -35767,8 +35803,8 @@ then click this button.</property>
                                                             <property name="draw_indicator">True</property>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
@@ -35783,66 +35819,33 @@ then click this button.</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
-                                                          </widget>
-                                                        </child>
-                                                      </widget>
-                                                      <packing>
-                                                        <property name="expand">True</property>
-                                                        <property name="fill">True</property>
-                                                        <property name="position">1</property>
-                                                      </packing>
-                                                    </child>
-                                                  </widget>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">True</property>
-                                                    <property name="position">0</property>
-                                                  </packing>
-                                                </child>
-                                                <child>
-                                                  <widget class="GtkHButtonBox" id="hbuttonbox3">
-                                                    <property name="visible">True</property>
-                                                    <property name="can_focus">False</property>
-                                                    <property name="layout_style">spread</property>
-                                                    <child>
-                                                      <widget class="GtkVBox" id="vbox177">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <child>
-                                                          <widget class="GtkButton" 
id="app1s_button_cancel1">
-                                                            <property name="label">gtk-cancel</property>
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="can_default">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="use_stock">True</property>
-                                                            <signal name="clicked" 
handler="app1s_on_button_cancel1_clicked" swapped="no"/>
-                                                            <accelerator key="Escape" signal="clicked"/>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="expand">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">0</property>
-                                                          </packing>
-                                                        </child>
-                                                      </widget>
-                                                      <packing>
-                                                        <property name="expand">False</property>
-                                                        <property name="fill">False</property>
-                                                        <property name="position">0</property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <widget class="GtkVBox" id="vbox178">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="spacing">20</property>
-                                                        <child>
-                                                          <widget class="GtkButton" 
id="app1s_button_select_file_import_same_database">
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkVButtonBox" id="vbuttonbox1">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="app1s_button_select_file_import_same_database">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
@@ -35855,15 +35858,15 @@ then click this button.</property>
                                                             <property name="label" translatable="yes">Use 
same database</property>
                                                             </widget>
                                                             </child>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="expand">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">0</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkButton" 
id="app1s_button_select_file_import">
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="app1s_button_select_file_import">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
@@ -35899,10 +35902,144 @@ then click this button.</property>
                                                             </child>
                                                             </widget>
                                                             </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox_session_more1">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label24">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Session</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label472">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">/</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label473">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">More</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label474">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">/</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">3</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label475">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Import</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">4</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="type">label_item</property>
+                                                            </packing>
+                                                            </child>
                                                           </widget>
                                                           <packing>
                                                             <property name="expand">True</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkHButtonBox" id="hbuttonbox3">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="layout_style">spread</property>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox177">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="app1s_button_cancel1">
+                                                            <property name="label">gtk-cancel</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="can_default">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="use_stock">True</property>
+                                                            <signal name="clicked" 
handler="app1s_on_button_cancel1_clicked" swapped="no"/>
+                                                            <accelerator key="Escape" signal="clicked"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
                                                             <property name="position">1</property>
                                                           </packing>
                                                         </child>
@@ -35910,15 +36047,14 @@ then click this button.</property>
                                                       <packing>
                                                         <property name="expand">True</property>
                                                         <property name="fill">False</property>
-                                                        <property name="position">1</property>
+                                                        <property name="position">0</property>
                                                       </packing>
                                                     </child>
                                                   </widget>
                                                   <packing>
-                                                    <property name="expand">False</property>
+                                                    <property name="expand">True</property>
                                                     <property name="fill">False</property>
-                                                    <property name="pack_type">end</property>
-                                                    <property name="position">1</property>
+                                                    <property name="position">0</property>
                                                   </packing>
                                                 </child>
                                               </widget>
@@ -35939,7 +36075,7 @@ then click this button.</property>
                                               </packing>
                                             </child>
                                             <child>
-                                              <widget class="GtkVBox" id="vbox179">
+                                              <widget class="GtkVBox" id="app1s_vbox_notebook_load">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="spacing">10</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index fd518a70..e16d2598 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -752,12 +752,11 @@ public partial class ChronoJumpWindow
        {
                if(personsAtTop)
                {
-                       UtilGtk.HBoxDoContrastLabels (viewport_hpaned_contacts_main, hbox_top_person);
-                       UtilGtk.HBoxDoContrastLabels (viewport_hpaned_contacts_main, hbox_top_person_encoder);
+                       UtilGtk.ContrastLabelsHBox (viewport_hpaned_contacts_main, hbox_top_person);
+                       UtilGtk.ContrastLabelsHBox (viewport_hpaned_contacts_main, hbox_top_person_encoder);
                }
 
-               UtilGtk.HBoxDoContrastLabels (viewport_hpaned_contacts_main, hbox_session_more);
-               UtilGtk.VBoxDoContrastLabels (viewport_hpaned_contacts_main, vbox_session_overview);
+               UtilGtk.ContrastLabelsNotebook (viewport_hpaned_contacts_main, app1s_notebook);
        }
 
        private void testNewStuff()
diff --git a/src/gui/app1/sessionLoadAndImport.cs b/src/gui/app1/sessionLoadAndImport.cs
index ab3a838f..3c26f924 100644
--- a/src/gui/app1/sessionLoadAndImport.cs
+++ b/src/gui/app1/sessionLoadAndImport.cs
@@ -81,7 +81,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label app1s_file_path_import;
        [Widget] Gtk.Notebook app1s_notebook_load_button_animation;
        [Widget] Gtk.HButtonBox app1s_hbuttonbox_page2_import;
-       [Widget] Gtk.HBox app1s_hbox_load_controls;
+       [Widget] Gtk.VBox app1s_vbox_notebook_load;
 
        //notebook tab 3
        [Widget] Gtk.Label app1s_label_import_session_name;
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 10c90f6d..6526aff1 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -602,33 +602,56 @@ public class UtilGtk
                e.ModifyBg(StateType.Prelight, color);
        }
 
-       public static void HBoxDoContrastLabels (Gtk.Viewport v, Gtk.HBox hbox)
+       public static void ContrastLabelsHBox (Gtk.Viewport v, Gtk.HBox hbox)
        {
-               containerDoContrastLabels (v, (Gtk.Container) hbox);
+               contrastLabelsContainer (v, (Gtk.Container) hbox);
        }
-       public static void VBoxDoContrastLabels (Gtk.Viewport v, Gtk.VBox vbox)
+       public static void ContrastLabelsVBox (Gtk.Viewport v, Gtk.VBox vbox)
        {
-               containerDoContrastLabels (v, (Gtk.Container) vbox);
+               contrastLabelsContainer (v, (Gtk.Container) vbox);
        }
-       public static void TableDoContrastLabels (Gtk.Viewport v, Gtk.Table table)
+       public static void ContrastLabelsTable (Gtk.Viewport v, Gtk.Table table)
        {
-               containerDoContrastLabels (v, (Gtk.Container) table);
+               contrastLabelsContainer (v, (Gtk.Container) table);
        }
-       private static void containerDoContrastLabels (Gtk.Viewport v, Gtk.Container container)
+       public static void ContrastLabelsNotebook (Gtk.Viewport v, Gtk.Notebook notebook)
+       {
+               contrastLabelsContainer (v, (Gtk.Container) notebook);
+       }
+
+       private static void contrastLabelsContainer (Gtk.Viewport v, Gtk.Container container)
        {
                foreach(Gtk.Widget w in container.Children)
                {
                        if(w.GetType() == typeof(Gtk.Label))
                                LabelDoContrastColor (v, (Gtk.Label) w);
-                       else if(w.GetType() == typeof(Gtk.HBox))
-                               HBoxDoContrastLabels (v, (Gtk.HBox) w);
-                       else if(w.GetType() == typeof(Gtk.VBox))
-                               VBoxDoContrastLabels (v, (Gtk.VBox) w);
-                       else if(w.GetType() == typeof(Gtk.Table))
-                               TableDoContrastLabels (v, (Gtk.Table) w);
+
+                       else if(w.GetType() == typeof(Gtk.Alignment))
+                       {
+                               Gtk.Widget child = ((Gtk.Alignment) w).Child;
+                               if(isContainer(child))
+                                       contrastLabelsContainer (v, (Gtk.Container) child);
+                       }
+                       else if(isContainer(w))
+                               contrastLabelsContainer (v, (Gtk.Container) w);
                }
        }
 
+       private static bool isContainer(Gtk.Widget w)
+       {
+               return ( w.GetType() == typeof(Gtk.HBox) ||
+                               w.GetType() == typeof(Gtk.VBox) ||
+                               w.GetType() == typeof(Gtk.Table) ||
+                               w.GetType() == typeof(Gtk.Notebook) ||
+                               w.GetType() == typeof(Gtk.Frame) ||
+                               w.GetType() == typeof(Gtk.CheckButton) //||
+                               // Gtk.RadioButton is not working, so solutions are
+                               // 1 have them inside a new viewport (recommended)
+                               // 2 have it without the radio (will be a button and no need to colorize)
+                               //w.GetType() == typeof(Gtk.RadioButton) );
+                       );
+       }
+
        public static void LabelDoContrastColor (Gtk.Viewport v, Gtk.Label l)
        {
                if(ColorIsDark(v.Style.Background(StateType.Normal)))



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