CVS debian/patches

CVS User rousseau ludovic.rousseau@free.fr
Sun, 02 Jan 2005 15:02:08 -0700


Update of /cvsroot/pkg-bins/debian/patches
In directory haydn:/tmp/cvs-serv24716

Modified Files:
	04_bins-edit-gui.dpatch 
Log Message:
simplify since a large part is now included upstream (bins 1.1.27)


--- /cvsroot/pkg-bins/debian/patches/04_bins-edit-gui.dpatch	2004/07/31 18:13:07	1.2
+++ /cvsroot/pkg-bins/debian/patches/04_bins-edit-gui.dpatch	2005/01/02 22:02:08	1.3
@@ -1,8 +1,9 @@
 #!/bin/sh -e
-## bins-edit-gui by Ludovic Rousseau <rousseau@acer.maison.bogus>
+## bins-edit-gui by Ludovic Rousseau <rousseau@debian.org>
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description
+## DP: bins-edit-gui.glade is in /usr/share/bins/ instead of
+## DP: /usr/local/share/bins/
 
 if [ $# -lt 1 ]; then
     echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
@@ -23,18 +24,9 @@
 exit 0
 
 @DPATCH@
---- bins-edit-gui	2004-07-30 22:32:22.000000000 +0200
-+++ bins-edit-gui	2004-07-31 20:10:52.000000000 +0200
-@@ -22,7 +22,7 @@
- EOF
- # -- end GPL notice --
- 
--$version = "0.7";
-+$version = "0.9";
- 
- @album_tags = qw(title longdesc shortdesc sampleimage);
- @image_tags = qw(title event location people date description);
-@@ -125,13 +125,17 @@
+--- bins-edit-gui.old	2004-12-30 16:23:01.000000000 +0100
++++ bins-edit-gui	2004-12-30 16:24:48.000000000 +0100
+@@ -125,7 +125,7 @@
  Gnome->init("bins-edit-gui", $version);
  Gtk->init;
  
@@ -43,309 +35,3 @@
  if (! -r $glade) {
      $glade = "bins-edit-gui.glade" ; # developer hack
      print "DEVELOPER HACK\n";
-+    if (! -r $glade) {
-+	die "No bins-edit-gui.glade available";
-+    }
- }
- #$g = new Gtk::GladeXML($glade, 'image_edit_top');
- $g = new Gtk::GladeXML($glade);
-+die "Gtk::GladeXML($glade) initialization failed; check required packages" unless $g;
- 
- $g->signal_autoconnect_from_package('main'); # main:: so we can grab stuff directly
- 
-@@ -156,6 +160,17 @@
- $gpl_text =~ s/^\# ?//gm;
- $licensetext->insert(undef, undef, undef, $gpl_text);
- 
-+## album-panel globals
-+$albumedit = $g->get_widget('album_edit_top');
-+$albumfile = $g->get_widget('album_edit_filename');
-+$albumprop = $g->get_widget('album_prop_list');
-+# work around libglade 0.17 bug (debbugs #147051)
-+$albumprop->set_column_title(0, _("Property"));
-+$albumprop->set_column_title(1, _("Value"));
-+# end workaround.
-+$albumname = $g->get_widget('album_name_entry');
-+$albumname->set_popdown_strings(@album_tags);
-+$albumvalue = $g->get_widget('album_edit_text');
- 
- sub on_dismiss_about_clicked {
-     $licensebox->hide;
-@@ -287,7 +302,12 @@
- 	my $fieldname = ($field_node->xql("\@name"))[0]->xql_toString;
- 	my $fieldval = $field_node->xql_toString;
- 	print "N: $fieldname  V: $fieldval\n" if $debug;
--	$field{$fieldname} = $UTF2Latin->convert($fieldval);
-+	my $newval;
-+	do {
-+	    $newval = $UTF2Latin->convert($fieldval);
-+	    charmap_failed("load_image_tags", $fieldval) if (not defined $newval);
-+	} until defined $newval;
-+	$field{$fieldname} = $newval;
-     }
- 
-     undef $newimage_tagged_or;
-@@ -335,6 +355,26 @@
-     $dirty = 0;
- }
- 
-+sub charmap_failed($$) {
-+    my $ipop = $g->get_widget('iconv_failed_dialog');
-+
-+    my $lbutton = $g->get_widget('iconv_latin1_charmap_button');
-+    $lbutton->set_active(Gtk->true); # really we mean it
-+    my $ubutton = $g->get_widget('iconv_user_charmap_button');
-+    my $uentry = $g->get_widget('iconv_user_charmap_entry');
-+    # if there's a value there, it is from the previous attempt, and is wrong.
-+    $uentry->set_text("");
-+
-+    $ipop->run_and_close;
-+
-+    if ($lbutton->get_active) {
-+	set_encoding("LATIN1");
-+    } elsif ($ubutton->get_active) {
-+	set_encoding($uentry->get_text);
-+    }
-+
-+}
-+
- sub save_image_tags {
-     my $test_filename = shift;
-     if ((not $dirty) && ($newimage_or eq $newimage_loaded_or)) {
-@@ -360,7 +400,14 @@
- 	my $newfield = new XML::DOM::Element($doc, "field");
- 	print "creating <$k> with <$f{$k}>\n" if $debug;
- 	$newfield->setAttribute("name", $k); # needs quoting!
--	$newfield->addText($Latin2UTF->convert($f{$k}));
-+	print "k: ", $k, " f: ", $f{$k}, " L2U: ", $Latin2UTF->convert($f{$k}), "\n" if $debug;
-+	my $newval;
-+	do {
-+	    $newval = $Latin2UTF->convert($f{$k});
-+	    charmap_failed("save_image_tags", $f{$k}) if (not defined $newval);
-+	} until defined $newval;
-+	
-+	$newfield->addText($newval);
- 	$parent->appendChild($newfield);
- 	print "created $k with $f{$k}\n" if $debug;
- 	}
-@@ -396,6 +443,25 @@
-     }
-     $dirty = 1;
- });
-+
-+sub my_album_replace_text($$) {
-+    my $aw = shift;
-+    my $text = shift;
-+    $aw->set_point(0);
-+    $aw->forward_delete($albumvalue->get_length());
-+    $aw->insert(undef, undef, undef, $text);
-+    $aw->set_editable(Gtk->true);
-+}
-+
-+# album version
-+$albumname->entry->signal_connect('changed', sub {
-+    my $entry = shift;
-+    my $val = $album{$entry->get_text};
-+    if (defined $val) {
-+	my_album_replace_text($albumvalue, $val);
-+    }
-+    $album_dirty = 1;
-+});
-     
- sub my_gtk_find_row {		# returns row
-     my ($clist, $col, $value) = @_;
-@@ -428,6 +494,28 @@
- 	$ilist->select_row($ilist->rows()-1, 0);
-     }
- });
-+# album version
-+$albumvalue->signal_connect('changed', sub {
-+    my $entry = shift;
-+    my $newval = $entry->get_chars(0,-1);
-+    my $tag = lc($albumname->entry->get_text);
-+    $album{$tag} = $newval;
-+    $dirty = 1;
-+    my $row = my_gtk_find_row($albumprop, 0, $tag);
-+    print "row: $row tag: $tag newval: $newval\n" if $debug;
-+    # oh, no tag yet, add one
-+    if ($row != -1) {
-+	$albumprop->set_text($row, 1, $newval);
-+    } else {
-+	# triggers select-row?
-+	$albumprob->append("\u$tag", $newval);
-+	# update the dropdown too
-+	@known_tags = sort (@known_tags, $tag);
-+	$albumname->set_popdown_strings(@known_tags);
-+	# force it all back
-+	$albumprob->select_row($ilist->rows()-1, 0);
-+    }
-+});
- 
- $ilist->signal_connect('select-row', sub {
-     my ($clist, $row, $col, $event, $udata) = @_;
-@@ -439,6 +527,17 @@
-     $value_entry->entry->grab_focus();
- });
- 
-+# album version
-+$albumprop->signal_connect('select-row', sub {
-+    my ($clist, $row, $col, $event, $udata) = @_;
-+    print "list: $clist row: $row col: $col event: $event udata: $udata\n" 
-+	if $debug;
-+    $albumname->entry->set_text($clist->get_text($row,0));
-+    my_album_replace_text($albumvalue, $clist->get_text($row,1));
-+    print "focus on $value_entry\n" if $debug;
-+    $albumvalue->grab_focus();
-+});
-+
- 
- # filter out .xml files, as we always derive them from the images
- # (also lets us eventually use the images as database keys instead)
-@@ -583,9 +682,10 @@
- 	    $use_w = $use_w / $rat;
- 	    $use_h = $use_h / $rat;
- 	    $newimage->render($use_w, $use_h);
--	    my $my_image = $newimage->copy_image();
--	    my $my_mask  = $newimage->copy_mask();
-+	    my $my_image = $newimage->copy_image(); # returns Gtk::Gdk::Pixmap
-+	    my $my_mask  = $newimage->copy_mask();  # returns Gtk::Gdk::Bitmap
- 	    $w->set($my_image, $my_mask);
-+	    $my_image->imlib_free();
- 	} else {
- 	    # come up with more clever "test pattern" later?
- 	    $w->set(undef, undef);
-@@ -641,3 +741,134 @@
-     load_image $current_filename, "keeptags";
-     status(_("Image restored."));
- }
-+
-+### album stuff ###
-+sub load_album_tags($);
-+
-+sub on_album1_activate {
-+    $current_album = $current_filename;
-+    # basename
-+    $current_album =~ s{[^/]*$}{}; # } perl-mode-sucks
-+    # make a complete name out of it
-+    $current_album .= "album.xml" if (-d "${current_album}");
-+    $albumfile->set($current_album);
-+    load_album_tags($current_album);
-+    $albumedit->show;
-+}
-+
-+sub on_open2_activate {
-+    status(_("File browser not yet implemented."));
-+}
-+
-+sub on_close1_activate {
-+    # save if dirty
-+    save_album_tags($current_album) if $album_dirty;
-+    $albumedit->hide;
-+}
-+
-+sub on_revert2_activate {
-+    load_album_tags $current_album;
-+    status(sprintf(_("Reverted from %s."), $current_album));
-+}
-+
-+sub save_album_tags;
-+
-+sub on_save2_activate {
-+    save_album_tags $current_album;
-+}
-+
-+# sub on_exit2_activate {
-+#     &on_exit1_activate(@_);
-+# }
-+
-+sub load_album_tags($) {
-+    %old_album = %album;	# save for later recall
-+
-+    my $test_filename = shift;
-+    $parser = new XML::DOM::Parser;
-+    if (-r "${test_filename}" ) {
-+	$album_doc = $parser->parsefile ("${test_filename}");
-+    } else {
-+	# literal minimal tree
-+	$album_doc = $parser->parse('<?xml version="1.0" encoding="UTF-8"?><album><description></description><bins></bins></album>');
-+	status(sprintf(_("%s not found, constructing"), "${test_filename}"));
-+    }
-+
-+
-+    undef %album;
-+
-+    for my $i (@album_tags) {
-+	$album{$i} = "";
-+    }
-+
-+    for my $field_node ($album_doc->xql("album/description/field")) {
-+	my $fieldname = ($field_node->xql("\@name"))[0]->xql_toString;
-+	my $fieldval = $field_node->xql_toString;
-+	print "N: $fieldname  V: $fieldval\n" if $debug;
-+	$album{$fieldname} = $UTF2Latin->convert($fieldval);
-+    }
-+
-+    # a clist is output only.  someday, replace it with a list of
-+    # editboxes, even if we have to write one all in perl.
-+
-+    # in the mean time, we vector out to a pair of combo boxes and let
-+    # the user edit there, while copying the changes back live.
-+
-+    # save last index if any...
-+    my $oldtag;
-+    my $oldrow = $albumprop->focus_row();
-+    $oldtag = $albumprop->get_text($oldrow, 0) if $oldrow > 0;
-+    print "old $oldrow: $oldtag\n" if $debug;
-+    $albumprop->clear;
-+    for my $i (sort keys %album) {
-+	$albumprop->append("\u$i", $album{$i});
-+    }
-+    if ($oldrow > 0) {
-+	my $newrow = my_gtk_find_row($albumprop, 0, $oldtag);
-+	print "new $newrow\n" if $debug;
-+	if ($newrow > 0) {
-+	    $albumprop->set_focus_row($newrow);
-+	    $albumprop->grab_focus();
-+	}
-+    }
-+
-+    # help the user enter stuff
-+    $albumname->set_popdown_strings(@known_tags);
-+    # tag as unchanged
-+    $dirty = 0;
-+}
-+
-+sub save_album_tags {
-+    my $test_filename = shift;
-+    if (not $album_dirty) {
-+	status(sprintf(_("%s not dirty, not saved"), ${test_filename}));
-+	return;
-+    }
-+
-+    my $parent = ($album_doc->xql("album/description"))[0]; # first one
-+    my %f = %album;
-+
-+    # write out the tree...
-+    for my $xmlfield ($album_doc->xql("album/description/field")) {
-+	my $namestr = $xmlfield->getAttribute("name");
-+	if (defined $f{$namestr}) {
-+	    # delete this node so we can append it later
-+	    $xmlfield->getParentNode->removeChild($xmlfield);
-+	}
-+    }
-+    # now append the remaining ones...
-+    for my $k (keys %f) {
-+	next if ($f{$k} eq "");
-+	my $newfield = new XML::DOM::Element($album_doc, "field");
-+	print "creating <$k> with <$f{$k}>\n" if $debug;
-+	$newfield->setAttribute("name", $k); # needs quoting!
-+	$newfield->addText($Latin2UTF->convert($f{$k}));
-+	$parent->appendChild($newfield);
-+	print "created $k with $f{$k}\n" if $debug;
-+	}
-+
-+    $album_doc->printToFile("${test_filename}");
-+    status(sprintf(_("Saved %s."), $test_filename));
-+    # undirty it
-+    $album_dirty = 0;
-+}