Skip to content

Commit

Permalink
Fix styles
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Jun 29, 2024
1 parent 09c65a6 commit a93e9f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 0 additions & 2 deletions data/io.elementary.camera.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<gresources>
<gresource prefix="/io/elementary/camera">
<file compressed="true">Application.css</file>
</gresource>
<gresource prefix="/io/elementary/camera/icons">
<file alias="/icons/scalable/actions/timer-symbolic.svg">icons/symbolic/timer-symbolic.svg</file>
<file alias="/icons/scalable/actions/color-contrast-symbolic.svg">icons/symbolic/object-inverse-symbolic.svg</file>
</gresource>
Expand Down
8 changes: 6 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,15 @@ public class Camera.MainWindow : Gtk.ApplicationWindow {
var camera_menu_button = new Gtk.MenuButton () {
menu_model = camera_options
};
camera_menu_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);
camera_menu_button.add_css_class ("camera-menu");

var menubutton_child = camera_menu_button.get_first_child ();
menubutton_child.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION);
menubutton_child.add_css_class ("camera-menu");
menubutton_child.remove_css_class ("image-button");

camera_menu_revealer = new Gtk.Revealer () {
child = camera_menu_button,
overflow = VISIBLE,
transition_duration = 250,
transition_type = Gtk.RevealerTransitionType.SLIDE_RIGHT
};
Expand Down
25 changes: 12 additions & 13 deletions src/Widgets/CameraView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,16 @@ public class Camera.Widgets.CameraView : Gtk.Box {
description = _("Connect a webcam or other supported video device to take photos and video.")
};

picture = new Gtk.Picture () {
content_fit = CONTAIN,
hexpand = true,
vexpand = true
};

stack = new Gtk.Stack ();
stack.add_child (status_box);
stack.add_child (no_device_view);
stack.add_child (picture);

monitor.get_bus ().add_watch (GLib.Priority.DEFAULT, on_bus_message);

Expand Down Expand Up @@ -234,28 +241,20 @@ public class Camera.Widgets.CameraView : Gtk.Box {
hflip = (pipeline.get_by_name ("hflip") as Gst.Video.Direction);
color_balance = (pipeline.get_by_name ("balance") as Gst.Video.ColorBalance);

if (picture != null) {
stack.remove (picture);
}

dynamic Gst.Element videorate = pipeline.get_by_name ("videorate");
videorate.max_rate = 30;
videorate.drop_only = true;

var gtksink = Gst.ElementFactory.make ("gtk4paintablesink", "sink");
Gdk.Paintable gst_video_widget;
gtksink.get ("paintable", out gst_video_widget);
dynamic Gst.Element gtksink = Gst.ElementFactory.make ("gtk4paintablesink", "sink");

pipeline.add (gtksink);
pipeline.get_by_name ("videoscale").link (gtksink);

picture = new Gtk.Picture.for_paintable (gst_video_widget) {
content_fit = CONTAIN,
hexpand = true,
vexpand = true
};
Gdk.Paintable gst_video_widget;
gtksink.get ("paintable", out gst_video_widget);

picture.paintable = gst_video_widget;

stack.add_child (picture);
stack.visible_child = picture;
pipeline.set_state (Gst.State.PLAYING);
} catch (Error e) {
Expand Down

0 comments on commit a93e9f5

Please sign in to comment.