Guest User

Untitled

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