Guest User

Untitled

a guest
Jun 19th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 3.18 KB | None | 0 0
  1. diff --git a/src/cheese-window.vala b/src/cheese-window.vala
  2. index c9fa2c2..42614fb 100644
  3. --- a/src/cheese-window.vala
  4. +++ b/src/cheese-window.vala
  5. @@ -92,6 +92,7 @@ public class Cheese.MainWindow : Gtk.Window
  6.    private Gtk.Action       effects_page_prev_action;
  7.    private Gtk.Action       effects_page_next_action;
  8.    private Gtk.Action       share_action;
  9. +  private Gtk.Action       preferences_action;
  10.    private Gtk.ActionGroup  main_actions;
  11.  
  12.    private bool is_fullscreen;
  13. @@ -102,6 +103,7 @@ public class Cheese.MainWindow : Gtk.Window
  14.    private bool is_camera_actions_sensitive;
  15.    private bool action_cancelled;
  16.    private bool is_command_line_startup;
  17. +  private bool is_first_device = true;
  18.  
  19.    private Gtk.Button[] buttons;
  20.  
  21. @@ -180,6 +182,7 @@ public class Cheese.MainWindow : Gtk.Window
  22.      {
  23.        if (event.button == 3)
  24.         thumbnail_popup.popup (null, thumb_view, null, event.button, event.time);
  25. +        share_action.set_sensitive (true);
  26.      }
  27.      else
  28.      if (event.type == Gdk.EventType.2BUTTON_PRESS)
  29. @@ -1339,7 +1342,9 @@ public class Cheese.MainWindow : Gtk.Window
  30.                                      "save_as",
  31.                                      "move_to_trash",
  32.                                      "delete",
  33. -                                    "move_all_to_trash"};
  34. +                                    "move_all_to_trash",
  35. +                                    "wide_mode",
  36. +                                    "fullscreen"};
  37.  
  38.        /* Gross hack because Vala's `in` operator doesn't really work */
  39.        bool flag;
  40. @@ -1465,6 +1470,7 @@ public class Cheese.MainWindow : Gtk.Window
  41.      effects_page_next_action = gtk_builder.get_object ("effects_page_next") as Gtk.Action;
  42.      effects_page_prev_action = gtk_builder.get_object ("effects_page_prev") as Gtk.Action;
  43.      share_action             = gtk_builder.get_object ("share") as Gtk.Action;
  44. +    preferences_action       = gtk_builder.get_object ("preferences") as Gtk.Action;
  45.  
  46.      shareable_media = new Cheese.ShareableMedia (this);
  47.      main_actions.pre_activate.connect(on_action_pre_activated);
  48. @@ -1577,6 +1583,7 @@ public class Cheese.MainWindow : Gtk.Window
  49.                           device,
  50.                           settings.get_int ("photo-x-resolution"),
  51.                           settings.get_int ("photo-y-resolution"));
  52. +
  53.      try {
  54.        camera.setup (device);
  55.      }
  56. @@ -1588,6 +1595,9 @@ public class Cheese.MainWindow : Gtk.Window
  57.        error_layer.show ();
  58.  
  59.        toggle_camera_actions_sensitivities (false);
  60. +
  61. +      camera.notify["num-camera-devices"].connect(add_first_hotplug_device);
  62. +
  63.        return;
  64.      }
  65.  
  66. @@ -1611,6 +1621,22 @@ public class Cheese.MainWindow : Gtk.Window
  67.      camera.play ();
  68.    }
  69.  
  70. +  private void add_first_hotplug_device ()
  71. +  {
  72. +    if (is_first_device) {
  73. +      setup_camera (null);
  74. +      video_preview.show ();
  75. +      error_layer.hide ();
  76. +
  77. +      toggle_camera_actions_sensitivities (true);
  78. +      preferences_action.set_sensitive (true);
  79. +      set_mode (MediaMode.PHOTO);
  80. +      enable_mode_change ();
  81. +
  82. +      is_first_device = false;
  83. +    }
  84. +  }
  85. +
  86.    /**
  87.     * Setup the thumbview thumbnail monitors.
  88.     */
Add Comment
Please, Sign In to add comment