Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4721546
Showing
4 changed files
with
547 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/usr/bin/perl | ||
$pkgdir = "/usr/local/share/oepbs"; | ||
|
||
use warnings; | ||
use strict; | ||
our($builder, $progdir, $basedir, $pkgdir); | ||
|
||
use utf8; # Needed for Hebrew | ||
use Encode; | ||
use POSIX qw/strftime/; | ||
use File::Spec::Functions qw(rel2abs); | ||
use File::Basename; | ||
use File::Copy; | ||
use Cwd; | ||
use Glib; | ||
use Gtk2 '-init'; | ||
|
||
$progdir = dirname(rel2abs($0)); | ||
|
||
$basedir = $progdir; | ||
my $guifile = "$basedir/opds.gui"; | ||
unless(-e $guifile) { | ||
print "Got here ($guifile)\n"; | ||
$basedir = $pkgdir; | ||
$guifile = "$basedir/opds.gui"; | ||
} | ||
|
||
require "$basedir/opdscreate.pl"; | ||
|
||
# print "GUI file: $guifile\n"; | ||
$builder = Gtk2::Builder->new(); | ||
$builder->add_from_file($guifile) or die "Couldn't read $guifile"; | ||
$builder->connect_signals( undef ); | ||
my $cwd = getcwd(); | ||
if($progdir ne $cwd) { | ||
my $ctrl = $builder->get_object("directory"); | ||
$ctrl->set_filename($cwd); | ||
# LoadContents($cwd); | ||
} | ||
|
||
my $window = $builder->get_object("window1") or die "Can't open main window"; | ||
|
||
$window->show_all(); | ||
|
||
Gtk2->main(); | ||
|
||
# Callbacks | ||
sub cb_window1_destroy { | ||
Gtk2->main_quit(); | ||
} | ||
|
||
sub cb_create { | ||
my $ctrl = $builder->get_object("directory"); | ||
my $txt = $ctrl->get_filename(); | ||
|
||
chdir $txt; | ||
|
||
$ctrl = $builder->get_object("catalogid"); | ||
my $catalogid = $ctrl->get_text(); | ||
|
||
$ctrl = $builder->get_object("selflink"); | ||
my $selflink = $ctrl->get_text(); | ||
|
||
$ctrl = $builder->get_object("rootlink"); | ||
my $rootlink = $ctrl->get_text(); | ||
|
||
$ctrl = $builder->get_object("catalogname"); | ||
my $catalogname = $ctrl->get_text(); | ||
|
||
$ctrl = $builder->get_object("catalogcreator"); | ||
my $catalogcreator = $ctrl->get_text(); | ||
|
||
$ctrl = $builder->get_object("acquisitionlink"); | ||
my $acqprefix = $ctrl->get_text(); | ||
|
||
CreateCatalog($txt, $catalogname, $catalogid, $selflink, $rootlink, $catalogcreator, $acqprefix); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,302 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<interface> | ||
<requires lib="gtk+" version="2.24"/> | ||
<!-- interface-naming-policy project-wide --> | ||
<object class="GtkWindow" id="window1"> | ||
<property name="can_focus">False</property> | ||
<property name="title" translatable="yes">OPDS Catalog generator</property> | ||
<signal name="destroy-event" handler="cb_window1_destory" swapped="no"/> | ||
<signal name="remove" handler="cb_window1_destroy" swapped="no"/> | ||
<child> | ||
<object class="GtkVBox" id="vbox1"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkHBox" id="hbox2"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkLabel" id="label1"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Directory: </property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkFileChooserButton" id="directory"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="action">select-folder</property> | ||
<property name="title" translatable="yes">Select directory</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">False</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkHBox" id="hbox3"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkLabel" id="label2"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Catalog ID: </property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">False</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkEntry" id="catalogid"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="invisible_char">•</property> | ||
<property name="primary_icon_activatable">False</property> | ||
<property name="secondary_icon_activatable">False</property> | ||
<property name="primary_icon_sensitive">True</property> | ||
<property name="secondary_icon_sensitive">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkHBox" id="hbox4"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkLabel" id="label3"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Self link: </property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkEntry" id="selflink"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="invisible_char">•</property> | ||
<property name="primary_icon_activatable">False</property> | ||
<property name="secondary_icon_activatable">False</property> | ||
<property name="primary_icon_sensitive">True</property> | ||
<property name="secondary_icon_sensitive">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">2</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkHBox" id="hbox5"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkLabel" id="label4"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Root link: </property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkEntry" id="rootlink"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="invisible_char">•</property> | ||
<property name="primary_icon_activatable">False</property> | ||
<property name="secondary_icon_activatable">False</property> | ||
<property name="primary_icon_sensitive">True</property> | ||
<property name="secondary_icon_sensitive">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">3</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkHBox" id="hbox6"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkLabel" id="label5"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">File name: </property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkEntry" id="catalogname"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="invisible_char">•</property> | ||
<property name="primary_icon_activatable">False</property> | ||
<property name="secondary_icon_activatable">False</property> | ||
<property name="primary_icon_sensitive">True</property> | ||
<property name="secondary_icon_sensitive">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">4</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkHBox" id="hbox7"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkLabel" id="label6"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Catalog creator: </property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkEntry" id="catalogcreator"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="invisible_char">•</property> | ||
<property name="primary_icon_activatable">False</property> | ||
<property name="secondary_icon_activatable">False</property> | ||
<property name="primary_icon_sensitive">True</property> | ||
<property name="secondary_icon_sensitive">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">5</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkHBox" id="hbox8"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkLabel" id="label7"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="label" translatable="yes">Acquisition link prefix: </property> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">False</property> | ||
<property name="position">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkEntry" id="acquisitionlink"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="invisible_char">•</property> | ||
<property name="primary_icon_activatable">False</property> | ||
<property name="secondary_icon_activatable">False</property> | ||
<property name="primary_icon_sensitive">True</property> | ||
<property name="secondary_icon_sensitive">True</property> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">1</property> | ||
</packing> | ||
</child> | ||
</object> | ||
<packing> | ||
<property name="expand">False</property> | ||
<property name="fill">True</property> | ||
<property name="position">6</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkButton" id="create"> | ||
<property name="label" translatable="yes">Create</property> | ||
<property name="visible">True</property> | ||
<property name="can_focus">True</property> | ||
<property name="receives_default">True</property> | ||
<property name="use_action_appearance">False</property> | ||
<signal name="clicked" handler="cb_create" swapped="no"/> | ||
</object> | ||
<packing> | ||
<property name="expand">True</property> | ||
<property name="fill">True</property> | ||
<property name="position">7</property> | ||
</packing> | ||
</child> | ||
</object> | ||
</child> | ||
</object> | ||
</interface> |
Oops, something went wrong.