[chronojump] Nicer edit person photo controls



commit 1927aaa2569caa5faffe9cf49c901c6a7d5f2343
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jul 5 17:41:44 2018 +0200

    Nicer edit person photo controls

 glade/person_win.glade                             | 156 +++++++++++++--------
 images/md/baseline_attachment_blue_24dp.png        | Bin 0 -> 418 bytes
 images/md/baseline_photo_camera_do_red_24dp.png    | Bin 0 -> 440 bytes
 .../md/baseline_photo_camera_start_blue_24dp.png   | Bin 0 -> 447 bytes
 src/Makefile.am                                    |   3 +
 src/gui/person.cs                                  |  25 +++-
 6 files changed, 123 insertions(+), 61 deletions(-)
---
diff --git a/glade/person_win.glade b/glade/person_win.glade
index 9d25e5e8..9d6b5f54 100644
--- a/glade/person_win.glade
+++ b/glade/person_win.glade
@@ -279,18 +279,7 @@
                         <property name="n_rows">2</property>
                         <property name="n_columns">2</property>
                         <property name="column_spacing">20</property>
-                        <property name="row_spacing">10</property>
-                        <child>
-                          <widget class="GtkLabel" id="label9">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">Photo</property>
-                          </widget>
-                          <packing>
-                            <property name="x_options"/>
-                            <property name="y_options"/>
-                          </packing>
-                        </child>
+                        <property name="row_spacing">4</property>
                         <child>
                           <widget class="GtkLabel" id="label21">
                             <property name="visible">True</property>
@@ -351,19 +340,19 @@
                                   <widget class="GtkHBox" id="hbox6">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="spacing">6</property>
+                                    <property name="spacing">8</property>
                                     <child>
-                                      <widget class="GtkButton" id="button_zoom">
+                                      <widget class="GtkButton" id="button_add_photo_file">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
-                                        <property name="has_tooltip">True</property>
-                                        <signal name="clicked" handler="on_button_zoom_clicked" 
swapped="no"/>
-                                        <accelerator key="z" signal="clicked"/>
+                                        <property name="tooltip" translatable="yes">Add photo from 
file</property>
+                                        <signal name="clicked" handler="on_button_add_photo_file_clicked" 
swapped="no"/>
                                         <child>
-                                          <widget class="GtkImage" id="image_zoom">
+                                          <widget class="GtkImage" id="image_photo_from_file">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
+                                            <property name="stock">gtk-missing-image</property>
                                           </widget>
                                         </child>
                                       </widget>
@@ -374,16 +363,57 @@
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkButton" id="button_add_photo_file">
-                                        <property name="label" translatable="yes">Add photo</property>
+                                      <widget class="GtkHBox" id="hbox_camera">
                                         <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="receives_default">True</property>
-                                        <signal name="clicked" handler="on_button_add_photo_file_clicked" 
swapped="no"/>
+                                        <property name="can_focus">False</property>
+                                        <property name="spacing">2</property>
+                                        <child>
+                                          <widget class="GtkButton" id="button_take_photo_start_camera">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="tooltip" translatable="yes">Start 
webcam</property>
+                                            <signal name="clicked" 
handler="on_button_take_photo_start_camera_clicked" swapped="no"/>
+                                            <child>
+                                              <widget class="GtkImage" id="image_photo_start_camera">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="stock">gtk-missing-image</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <widget class="GtkButton" id="button_take_photo_do">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <property name="tooltip" translatable="yes">Take 
snapshot</property>
+                                            <signal name="clicked" handler="on_button_take_photo_do_clicked" 
swapped="no"/>
+                                            <child>
+                                              <widget class="GtkImage" id="image_photo_do">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="stock">gtk-missing-image</property>
+                                              </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">True</property>
-                                        <property name="fill">True</property>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="pack_type">end</property>
                                         <property name="position">1</property>
                                       </packing>
                                     </child>
@@ -394,33 +424,6 @@
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
-                                <child>
-                                  <widget class="GtkButton" id="button_take_photo_start_camera">
-                                    <property name="label">Start webcam</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <signal name="clicked" 
handler="on_button_take_photo_start_camera_clicked" swapped="no"/>
-                                  </widget>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <widget class="GtkButton" id="button_take_photo_do">
-                                    <property name="label" translatable="yes">Take snapshot</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <signal name="clicked" handler="on_button_take_photo_do_clicked" 
swapped="no"/>
-                                  </widget>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
@@ -436,6 +439,49 @@
                             <property name="y_options"/>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkHBox" id="hbox5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <widget class="GtkLabel" id="label9">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Photo</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkButton" id="button_zoom">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="has_tooltip">True</property>
+                                <signal name="clicked" handler="on_button_zoom_clicked" swapped="no"/>
+                                <accelerator key="z" signal="clicked"/>
+                                <child>
+                                  <widget class="GtkImage" id="image_zoom">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                  </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="x_options">GTK_FILL</property>
+                            <property name="y_options"/>
+                          </packing>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -572,9 +618,6 @@
                                     <child>
                                       <placeholder/>
                                     </child>
-                                    <child>
-                                      <placeholder/>
-                                    </child>
                                     <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
@@ -1983,6 +2026,9 @@
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
diff --git a/images/md/baseline_attachment_blue_24dp.png b/images/md/baseline_attachment_blue_24dp.png
new file mode 100644
index 00000000..abfe97b1
Binary files /dev/null and b/images/md/baseline_attachment_blue_24dp.png differ
diff --git a/images/md/baseline_photo_camera_do_red_24dp.png b/images/md/baseline_photo_camera_do_red_24dp.png
new file mode 100644
index 00000000..5c78e21d
Binary files /dev/null and b/images/md/baseline_photo_camera_do_red_24dp.png differ
diff --git a/images/md/baseline_photo_camera_start_blue_24dp.png 
b/images/md/baseline_photo_camera_start_blue_24dp.png
new file mode 100644
index 00000000..406ecff0
Binary files /dev/null and b/images/md/baseline_photo_camera_start_blue_24dp.png differ
diff --git a/src/Makefile.am b/src/Makefile.am
index f9ee9bd7..5fbf7b65 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -382,6 +382,9 @@ RESOURCES = \
        ../images/spreadsheet.png,spreadsheet.png \
        ../images/report_view.png,report_view.png \
        ../images/preferences-system.png,preferences-system.png \
+       ../images/md/baseline_attachment_blue_24dp.png,image_attachment.png \
+       ../images/md/baseline_photo_camera_start_blue_24dp.png,image_photo_start_camera.png \
+       ../images/md/baseline_photo_camera_do_red_24dp.png,image_photo_do.png \
        ../images/md/ic_home_blue_24dp_1x.png,image_home.png \
        ../images/md/ic_import_1x.png,import.png \
        ../images/md/ic_export_1x.png,export.png \
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 42fc6857..3fdfa279 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -810,9 +810,14 @@ public class PersonAddModifyWindow
        [Widget] Gtk.Button button_load_person;
        [Widget] Gtk.Image image_load_person;
 
+       [Widget] Gtk.Image image_photo_from_file;
+       [Widget] Gtk.Image image_photo_start_camera;
+       [Widget] Gtk.Image image_photo_do;
+
        [Widget] Gtk.Button button_add_photo_file;
        [Widget] Gtk.Button button_take_photo_start_camera;
        [Widget] Gtk.Button button_take_photo_do;
+       [Widget] Gtk.HBox hbox_camera;
        
        [Widget] Gtk.Label label_date;
        //[Widget] Gtk.Button button_change_date;
@@ -920,10 +925,17 @@ public class PersonAddModifyWindow
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_person_outline.png");
                image_load_person.Pixbuf = pixbuf;
 
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_attachment.png");
+               image_photo_from_file.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_photo_start_camera.png");
+               image_photo_start_camera.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_photo_do.png");
+               image_photo_do.Pixbuf = pixbuf;
+
                if(UtilAll.GetOSEnum() == UtilAll.OperatingSystems.LINUX)
-                       button_take_photo_start_camera.Visible = true;
+                       hbox_camera.Visible = true;
                else
-                       button_take_photo_start_camera.Visible = showCapturePhoto;
+                       hbox_camera.Visible = showCapturePhoto;
 
                //delete a -1.png or -1.jpg added before on a new user where "accept" button was not pressed 
and window was closed
                deleteOldPhotosIfAny(-1);
@@ -947,7 +959,7 @@ public class PersonAddModifyWindow
                if(photoBigFile != "")
                {
                        button_zoom.Sensitive = true;
-                       button_add_photo_file.Label = Catalog.GetString("Change photo");
+                       //button_add_photo_file.Label = Catalog.GetString("Change photo");
                }
                else
                        button_zoom.Sensitive = false;
@@ -1050,7 +1062,7 @@ public class PersonAddModifyWindow
        {
                Pixbuf pixbuf = new Pixbuf (filenameMini);
                image_photo_mini.Pixbuf = pixbuf;
-               button_add_photo_file.Label = Catalog.GetString("Change photo");
+               //button_add_photo_file.Label = Catalog.GetString("Change photo");
                button_zoom.Sensitive = true;
        }
 
@@ -1069,7 +1081,7 @@ public class PersonAddModifyWindow
                }
 
                button_take_photo_start_camera.Sensitive = false;
-               button_take_photo_do.Visible = true;
+               button_take_photo_do.Sensitive = true;
 
                /*
                 * TODO: reimplement this with ffmpeg
@@ -1128,7 +1140,7 @@ public class PersonAddModifyWindow
                }
 
                button_take_photo_start_camera.Sensitive = true;
-               button_take_photo_do.Visible = false;
+               button_take_photo_do.Sensitive = false;
        }
 
        //libCesarplayer method, jpeg
@@ -1246,6 +1258,7 @@ public class PersonAddModifyWindow
 
                PersonAddModifyWindowBox.pDN = pDN;
                PersonAddModifyWindowBox.app1_checkbutton_video = app1_checkbutton_video;
+               PersonAddModifyWindowBox.button_take_photo_do.Sensitive = false;
 
                PersonAddModifyWindowBox.person_win.Show ();
 


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