Adding missing files.

This commit is contained in:
sergiotarxz 2021-07-19 22:48:15 +02:00
parent b9186a6ecc
commit 73606081ba
Signed by: sergiotarxz
GPG Key ID: E5903508B6510AC2
3 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,32 @@
package MangaReader::GObject;
use v5.30.0;
use strict;
use warnings;
use Glib::Object::Introspection;
use Cairo::GObject;
Glib::Object::Introspection->setup(
basename => 'Gtk',
version => '4.0',
package => 'Gtk4',
);
Glib::Object::Introspection->setup(
basename => 'Gio',
version => '2.0',
package => 'G',
);
Glib::Object::Introspection->setup(
basename => 'Gdk',
version => '4.0',
package => 'Gtk4::Gdk',
);
Glib::Object::Introspection->_register_boxed_synonym(
"cairo", "RectangleInt",
"gdk_rectangle_get_type"
);
1

View File

@ -0,0 +1,23 @@
package MangaReader::View::Generator;
use v5.30.0;
use strict;
use warnings;
sub new {
my $class = shift;
die "$class is abstract" if $class eq __PACKAGE__;
my $self = bless {}, $class;
my $definition = $self->Definition;
my $builder =
Gtk4::Builder->new_from_string( $definition, length $definition );
$self->{builder} = $builder;
return $self;
}
sub Builder {
my $self = shift;
return $self->{builder};
}
1;

View File

@ -0,0 +1,43 @@
package MangaReader::View::Generator::MainMenuGenerator;
use v5.30.0;
use parent 'MangaReader::View::Generator';
use strict;
use warnings;
use Mojo::Template;
sub Definition {
my $mojo_template = Mojo::Template->new;
$mojo_template->auto_escape(1);
return $mojo_template->render(<< 'EOF');
<interface>
<object id="grid" class="GtkGrid">
<property name="visible">true</property>
<child>
<object class="GtkLabel">
<property name="label"><%= '<big>mangafox.fun</big>' %></property>
<property name="use-markup">true</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object id="download" class="GtkButton">
<property name="visible">true</property>
<property name="label">Download</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
</layout>
</object>
</child>
</object>
</interface>
EOF
}
1