[chronojump] DiscoverGui with header, without two top labels and with icon on Use this! buttons



commit e29049f3772d04b08ba6a1b051702d761b078429
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 20 18:00:21 2022 +0200

    DiscoverGui with header, without two top labels and with icon on Use this! buttons

 glade/app1.glade             | 72 ++++++++++++++------------------------------
 src/gui/app1/chronojump.cs   |  4 ---
 src/gui/chronopicRegister.cs | 43 +++++++++++++-------------
 3 files changed, 44 insertions(+), 75 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 6eb2419c7..261830b7f 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -26629,6 +26629,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -33037,18 +33040,6 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -33085,6 +33076,18 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -42428,6 +42431,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -50370,43 +50376,6 @@ Since Chronojump 2.1.3, backups contain the complete data.</property>
                                                             <property name="border_width">20</property>
                                                             <property name="spacing">20</property>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox224">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
-                                                            <child>
-                                                            <widget class="GtkLabel" 
id="label_micro_discover_ports">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkLabel" 
id="label_micro_discover_ports_detecting">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            <property name="label" 
translatable="yes">Detecting …</property>
-                                                            </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">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkScrolledWindow" 
id="scrolledwindow29">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
@@ -50441,6 +50410,9 @@ Since Chronojump 2.1.3, backups contain the complete data.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             </widget>
@@ -50449,7 +50421,7 @@ Since Chronojump 2.1.3, backups contain the complete data.</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 373fdae7e..dcce5f5fe 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -303,8 +303,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Table table_micro_discover;
        [Widget] Gtk.HBox hbox_contacts_detect_and_execute;
        [Widget] Gtk.Button button_contacts_detect;
-       [Widget] Gtk.Label label_micro_discover_ports;
-       [Widget] Gtk.Label label_micro_discover_ports_detecting;
        [Widget] Gtk.EventBox eventbox_button_micro_discover_cancel_close;
        [Widget] Gtk.Image image_button_micro_discover_cancel_close;
        [Widget] Gtk.Label label_button_micro_discover_cancel_close;
@@ -4551,8 +4549,6 @@ public partial class ChronoJumpWindow
                label_micro_discover_title.UseMarkup = true;
 
                discoverWin = new DiscoverWindow (current_mode, chronopicRegister,
-                       label_micro_discover_ports,
-                       label_micro_discover_ports_detecting,
                        table_micro_discover,
                        image_button_micro_discover_cancel_close,
                        label_button_micro_discover_cancel_close);
diff --git a/src/gui/chronopicRegister.cs b/src/gui/chronopicRegister.cs
index c28b18f93..3f4306b61 100644
--- a/src/gui/chronopicRegister.cs
+++ b/src/gui/chronopicRegister.cs
@@ -133,7 +133,6 @@ public class DiscoverWindow
 
        private Constants.Modes current_mode;
        private ChronopicRegister chronopicRegister;
-       private Gtk.Label label_micro_discover_ports_detecting;
        private Gtk.Table table_micro_discover;
        private Gtk.Image image_button_micro_discover_cancel_close;
        private Gtk.Label label_button_micro_discover_cancel_close;
@@ -141,15 +140,12 @@ public class DiscoverWindow
        private string portSelected;
 
        public DiscoverWindow (Constants.Modes current_mode, ChronopicRegister chronopicRegister,
-                       Gtk.Label label_micro_discover_ports,
-                       Gtk.Label label_micro_discover_ports_detecting,
                        Gtk.Table table_micro_discover,
                        Gtk.Image image_button_micro_discover_cancel_close,
                        Gtk.Label label_button_micro_discover_cancel_close)
        {
                this.current_mode = current_mode;
                this.chronopicRegister = chronopicRegister;
-               this.label_micro_discover_ports_detecting = label_micro_discover_ports_detecting;
                this.table_micro_discover = table_micro_discover;
                this.image_button_micro_discover_cancel_close = image_button_micro_discover_cancel_close;
                this.label_button_micro_discover_cancel_close = label_button_micro_discover_cancel_close;
@@ -178,20 +174,12 @@ public class DiscoverWindow
                                        notDiscovered_l.Add (crp);
                        }
 
-               label_micro_discover_ports.Text = string.Format (Catalog.GetPluralString (
-                                       "Found 1 device.",
-                                       "Found {0} devices.",
-                                       alreadyDiscovered_l.Count + notDiscovered_l.Count),
-                               alreadyDiscovered_l.Count + notDiscovered_l.Count);
-
                image_button_micro_discover_cancel_close.Pixbuf =
                                new Pixbuf (null, Util.GetImagePath(false) + "image_cancel.png");
                label_button_micro_discover_cancel_close.Text = Catalog.GetString("Cancel");
 
                if (alreadyDiscovered_l.Count > 0 || notDiscovered_l.Count > 0)
                {
-                       label_micro_discover_ports_detecting.Visible = true;
-
                        microDiscover = new MicroDiscover (notDiscovered_l);
 
                        setup_table_micro_discover_l (alreadyDiscovered_l, notDiscovered_l);
@@ -201,7 +189,6 @@ public class DiscoverWindow
                        GLib.Idle.Add (new GLib.IdleHandler (pulseDiscoverGTK));
                        discoverThread.Start();
                } else {
-                       label_micro_discover_ports_detecting.Visible = false;
                        UtilGtk.RemoveChildren (table_micro_discover);
 
                        image_button_micro_discover_cancel_close.Pixbuf =
@@ -232,10 +219,22 @@ public class DiscoverWindow
                button_microAlreadyDiscovered_l = new List<Gtk.Button> ();
 
                // 3) create widgets, lists, attach to table and show all
+
+               // 3a) create table header row
+               Gtk.Label l0 = new Gtk.Label ("<b>Device</b>");
+               Gtk.Label l1 = new Gtk.Label ("<b>Type</b>");
+               l0.UseMarkup = true;
+               l1.UseMarkup = true;
+               table_micro_discover.Attach (l0, (uint) 0, (uint) 1, (uint) 0, (uint) 1,
+                               AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
+               table_micro_discover.Attach (l1, (uint) 1, (uint) 2, (uint) 0, (uint) 1,
+                               AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
+
+               // 3b) create a row for each device
                for (int i = 0; i < alreadyDiscovered_l.Count; i ++)
-                       setup_row_micro_discover_l (alreadyDiscovered_l [i], i, true);
+                       setup_row_micro_discover_l (alreadyDiscovered_l [i], i + 1, true);
                for (int i = 0; i < notDiscovered_l.Count; i ++)
-                       setup_row_micro_discover_l (notDiscovered_l [i], i + alreadyDiscovered_l.Count, 
false);
+                       setup_row_micro_discover_l (notDiscovered_l [i], i + 1 + alreadyDiscovered_l.Count, 
false);
 
                table_micro_discover.ShowAll();
        }
@@ -265,7 +264,13 @@ public class DiscoverWindow
                }
 
 
-               Gtk.Button b = new Gtk.Button("Use this");
+               Gtk.HBox hbox = new Gtk.HBox (false, 6);
+               Gtk.Image image = new Gtk.Image (new Pixbuf (null, Util.GetImagePath(false) + 
"image_done_blue.png"));
+               Gtk.Label label = new Gtk.Label ("Use this!");
+               hbox.PackStart (image);
+               hbox.PackStart (label);
+               Gtk.Button b = new Gtk.Button (hbox);
+
                if (alreadyDiscovered)
                {
                        b.Sensitive = discoverMatchCurrentMode (crp.Type);
@@ -341,7 +346,6 @@ public class DiscoverWindow
                                        (progressbar_microNotDiscovered_l[i]).Text = "----";
                        }
 
-                       label_micro_discover_ports_detecting.Visible = false;
                        image_button_micro_discover_cancel_close.Pixbuf =
                                new Pixbuf (null, Util.GetImagePath(false) + "image_close.png");
                        label_button_micro_discover_cancel_close.Text = Catalog.GetString("Close");
@@ -456,12 +460,9 @@ public class DiscoverWindow
        public void CancelCloseFromUser ()
        {
                if (discoverThread != null && discoverThread.IsAlive && microDiscover != null)
-               {
-                       //label_micro_discover_ports.Text = Catalog.GetString("Cancelling");
                        microDiscover.Cancel = true;
-               } else {
+               else
                        FakeButtonClose.Click ();
-               }
        }
 
        public ChronopicRegister ChronopicRegisterGet {


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